+ 1

What should I add to my code?

I'm trying to make a game where you have to collect yellow squares with the red one, moving it via the buttons, but I don't know how to do the animation and to make the red square move when you press the buttons. When I try to do the animation everything dissappears and only the red square is there. Can you tell me what else do I need for my code? I'll be vert thankfull! P.S. I marked the animation, that I tried to make, with comments on the JS section. https://code.sololearn.com/W8pLj0yL7Fu5/?ref=app

14th Oct 2022, 8:27 PM
Momchil
3 Réponses
+ 2
If you look at my game code, which is a similar idea, you might see that you need to clear the screen and redraw the new position. https://code.sololearn.com/WNZS2vR4tvzD/?ref=app
14th Oct 2022, 9:29 PM
Ausgrindtube
Ausgrindtube - avatar
+ 3
All good and happy coding! I'm looking forward to testing out your game when it's finished!!
15th Oct 2022, 10:19 AM
Ausgrindtube
Ausgrindtube - avatar
+ 2
Ausgrindtube thanks alot for your advice!
15th Oct 2022, 10:11 AM
Momchil