Discuss Scratch

greendayfan7
Scratcher
78 posts

please HELP me with wall collisions

HELP ME
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.

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

this is my signature
I have exactly 8934 posts

Powered by DjangoBB