This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2012-08-17 15:54:03

Firedrake969
Scratcher
Registered: 2011-11-24
Posts: 1000+

Velocity wall collision glitch

In the game that I am working on, in level 3, the walls glitch sometimes.  Any help?


Click the sign.
https://s3.amazonaws.com/eterna/eterna2/logo2.png

Offline

 

#2 2012-08-17 16:45:09

41w4y5
Scratcher
Registered: 2012-08-15
Posts: 100+

Re: Velocity wall collision glitch

Check out this project I made a while ago (different account)


http://i.imgur.com/Em1YC.png

Offline

 

#3 2012-08-17 16:47:22

MoreGamesNow
Scratcher
Registered: 2009-10-12
Posts: 1000+

Re: Velocity wall collision glitch

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)


http://images2.layoutsparks.com/1/218929/rubiks-cube-animated-rotating.gif
"Cogito ergo sum" --  I think, therefore I am

Offline

 

#4 2012-08-18 12:43:36

Firedrake969
Scratcher
Registered: 2011-11-24
Posts: 1000+

Re: Velocity wall collision glitch

MoreGamesNow wrote:

[i]stuff removed because it was too long[i]

Thanks!


Click the sign.
https://s3.amazonaws.com/eterna/eterna2/logo2.png

Offline

 

Board footer