Discuss Scratch

captinpanther722
Scratcher
6 posts

help with collisions

I am trying to make a game where the animal will move around the cage randomly but it keeps going through the cage walls can anyone help me fix this
solar_sausage
Scratcher
100+ posts

help with collisions

just do something like this. Make sure to set the custom blocks to run without screen refresh.
forever
change x by (xSpeed)
extract from wall x
change y by (ySpeed)
extract from wall y
end

define extract from wall x
repeat until <not <touching [wall] ?>>
if <<(xSpeed) > [0]>> then
change x by (-1)
else
change x by (1)
end
end

define extract from wall y
repeat until <not <touching [wall] ?>>
if <<(ySpeed) > [0]>> then
change y by (-1)
else
change y by (1)
end
end

Hundreds of wazonz surround your current location. This is a warning from them to you, to run while you still can.

Powered by DjangoBB