Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » please HELP me with wall collisions
- GIitchInTheMatrix
- Scratcher
1000+ posts
please HELP me with wall collisions
To prevent the player from walking through walls, this code is something that may work.
To do this most efficiently, code like this may work:
forever
if <touching [Level v] ?> then
move ((0) - (Speed)) steps
end
end
To do this most efficiently, code like this may work:
forever
if <key [W v] pressed?> then
change [Speed Y v] by (1)
end
if <key [S v] pressed?> then
change [Speed Y v] by (-1)
end
if <key [A v] pressed?> then
change [Speed X v] by (0)
end
if <key [D v] pressed?> then
change [Speed X v] by (0)
end
change x by (Speed X)
change y by (Speed Y)
end
- Discussion Forums
- » Help with Scripts
- » please HELP me with wall collisions