In the game that I am working on, in level 3, the walls glitch sometimes. Any help?
Offline
You should be checking for collision immediately after you move and then correcting the previous movement, not immediately after your velocity changes.
when gf clicked forever if<key [right arrow v] pressed?> change [xv v] by (X speed) end if<key [left arrow v] pressed?> change [xv v] by ((X speed)*(-1)) end if<key [up arrow v] pressed?> change [yv v] by (Y speed) end if<key [down arrow v] pressed?> change [xv v] by ((Y speed)*(-1)) end if<key [space v] pressed?> set [X speed v] to (0.5) set [Y speed v] to (0.5) end if<key [r v] pressed?> set [X speed v] to (0.5) set [Y speed v] to (0.5) go to x:(-222) y:(161) end if<touching [Sprite2 v]?> go to x:(-222) y:(161) broadcast [Level v] end set [xv v] to ((0.9)*(xv)) set [yv v] to ((0.9)*(xv)) change x by (xv) if<touching [Sprite5 v]?> set [xv v] to ((-1)*(xv)) change x by (xv) end change y by (yv) if<touching [Sprite5 v]?> set [yv v] to ((-1)*(yv)) change y by (yv) end
Last edited by MoreGamesNow (2012-08-17 16:49:14)
Offline
MoreGamesNow wrote:
[i]stuff removed because it was too long[i]
Thanks!
Offline