how do i make my sprite move in any direction with th keys, but if part of it is touching a certain colour not be able to move towards the colour?
Offline
Use this script.
when gf clicked repeat until <touching color [black]> if <right arrow key v pressed?> change x by [1] end if <left arrow key v pressed?> change x by [-1] end if <up arrow key v pressed?> change y by [1] end if <down arrow key v pressed?> change y by [-1] end end wait until <<<key right arrow pressed?> or <key left arrow pressed?>> or <<key up arrow pressed?> or <key down arrow pressed?>>>> broadcast [move again v]
Last edited by Spyderblade (2012-08-22 12:17:35)
Offline
Then copy that(except for the When green flag clicked part), and put it under this:
when i receive [move again v]
Offline
Spyderblade wrote:
Use this script.
when gf clicked repeat until <color [#000000] is touching [#00FFFF]?> if <key [right arrow v] pressed?> change x by [1] end if <key [left arrow v] pressed?> change x by [-1] end if <key [up arrow v] pressed?> change y by [1] end if <key [down arrow v] pressed?> change y by [-1] end end wait until <<<key [right arrow v] pressed?> or <key [left arrow v] pressed?>> or <<key [up arrow v] pressed?> or <key [down arrow v] pressed?>>> broadcast [move again v]
Fixed the scripts, and added something. The black represents a certain part of your sprite, not just the whole thing, and the other color represents the color you don't wish to move through.
Last edited by sonicfan12p (2012-08-22 12:27:45)
Offline