Taken from the Scratch Wiki:
when gf clicked go to x: (0) y: (0) point in direction (pick random (-179) to (180)) set [Move Speed v] to [0] forever move (Move Speed) steps if <touching [edge v]?> change x by (([sin v] of (direction)) * ((0) - (Move Speed))) if <touching [edge v]?> point in direction ((180) - (direction)) else point in direction ((0) - (direction)) end change x by (([sin v] of (direction)) * (Move Speed)) end
Offline