+ 1

Bug

My Game: fight the zombie, won't work... If two elements touch each other, it must console.log a number (I am going to make an fight game, but for now a number is enough), but it console.log the number way tot quick https://code.sololearn.com/WEX1x7cT7o4q/?ref=app

17th Mar 2019, 8:11 AM
jelger.js
jelger.js - avatar
5 ответов
+ 2
Your animate functions are changing the sizes of your margins, rather than moving the picture. Also, your logic to compare whether the two are touching is incomplete. This is what I’ve achieved; https://code.sololearn.com/WaKOAlocKnxg/?ref=app The problem here is that your x1,y1, etc. variables are calculated before the picture moves. You may need to use a delay timer of some sort but I’ve not managed to do this.
17th Mar 2019, 9:49 AM
Russ
Russ - avatar
+ 2
Russ Thank you very much! Is it okay if use you code to make my game further?
17th Mar 2019, 11:53 AM
jelger.js
jelger.js - avatar
+ 1
jelger.js Yes of course, go agead! Glad I could help.
17th Mar 2019, 12:10 PM
Russ
Russ - avatar
+ 1
Congrats! Great code, keep going!
17th Mar 2019, 1:06 PM
Russ
Russ - avatar
0
Russ , I think I fixed the last bug, thanks that I could use it! https://code.sololearn.com/WpMCjHuhKoZC/?ref=app
17th Mar 2019, 12:13 PM
jelger.js
jelger.js - avatar