Discuss Scratch

WYWL
Scratcher
19 posts

stuck in wall issue

im making a maze game, but i have no idea on how to fix my figure not in the wall. i want to make it so that my figure does not get stuck in the wall.

unrelated question, how do i make a top down scroller script?

here's the script:
when I receive [maze]
forever
if <not <touching [walls] ?>> then
if <key [w] pressed?> then
change y by (5)
end
if <key [a] pressed?> then
change x by (-5)
end
if <key [s] pressed?> then
change y by (-5)
end
if <key [d] pressed?> then
change x by (-5)
end


else

end
end

what can i do?

Last edited by WYWL (March 29, 2024 09:20:04)

Haydensscratch
Scratcher
29 posts

stuck in wall issue

After each movement bit, put a
if <touching [walls] ?> then
move (-5) steps
end

Or

if <touching [walls] ?> then
repeat until <not <touching [walls] ?>>
move (-1) steps
end
end

I would love to see your project after you’re done so pls send me the link afterwards

Powered by DjangoBB