+ 2
Whenever I press jump nothing happens
32 Answers
+ 2
Ok i got my red ball but when i click jump nothing happens is there something wrong?
+ 2
You need to re-draw the circle...
Is it from the Game Development course? It is a pro project and I cannot access it but I assume they give an example for how to make the ball jump
+ 2
I think the gist is this:
When you click the button
* update count
* update circle position
* clear canvas
* draw circle on canvas (with new position)
+ 1
Put all your code inside if window.onload, else it will try to get the canvas before the canvas tag is loaded (that's the error in line 14)
+ 1
When we click the button, count is increased by 1. What do you should happen?
+ 1
You never display or output it. You could put a console.log(count); in the onclick function
+ 1
Yes, after increasing count
+ 1
I mean:
btn.onclick = function() {
count += 1;
console.log(count);
}
Whenever you ick the button, count will be shown
+ 1
The button function is already connected to the button element – you do this with the onclick in your js
+ 1
And redraw a circle?
0
Yes, its suppose to increase by 1 but i dont see it
0
Where it says btn.onclick or where exactly?
0
Tbh i have no idea can you like show me
0
You have to connect the jump button in HTML to js
0
How do you do that?
0
Ok now whenever i press the button the cirxle dissapears and it doesnt jump i think i did it right?
0
Yes its the Game Development with JS
0
Make use of requestAnimationFrame or setInterval
0
Can you show a example?
0
See how everything dissapears