<when green flag clicked>
<if><color[ orange ]is over[ red
?
I want it to make a sprite controled by the arrows on the keyboard to stop. How?
Last edited by _Doctor_Who_ (2007-12-14 11:03:55)
Offline
That will depend on the script that is monitoring the keyboard and how your sprite moves. If you are using a Keypressed "Hat" to start the move script, you could just add an "If" at the beginning:
Keypressed (right arrow)
If <color touching other color>
Stop Script ---This will "exit" the script
Move commands ---If the colors aren't touching, the script keeps going
This will stop the rest of the script from executing and the sprite won't move. The problem is, now your sprite is "stuck". You may need to put some small dots of color on your sprite to serve as "sensors". For example, if the wall is red, and the right edge of your sprite has a yellow dot, you could test for yellow touching red in the script that moves the sprite to the right and only "stop" that script. This would let the key that moves the sprite to the left still work as normal, so the sprite could move away.
I usually monitor the keyboard inside a loop that is always running (smoother motion). In this case, you could test for "keypressed" (right arrow) AND (NOT <color1 touching color2>)
Hope that helps!
-Mr Ed
Offline
This may help people trying to help, this is my game:
You control a character using the key board. When you press the up arrow the sprite you have to catch moves down, if you press right that sprite gose left and so on. If you touch items it will stop the oposite sprite, extend time etc.
Offline
It might be easiest if you put the project as it is now up on the website and give us a link to it. Then we can take a look and see if we see a solution.
Offline
Okay! i'll go do that!
Offline
Just do it with if/else, if (the arrow keys) <not> pressed, switch to a costume(s) and he won't go anywhere, in the <else> put more if/elses for different outcomes, like moving with the arrow keys, oh by the way, Doctor Who, nice... that show is AWSOME, just watched the series premire of season 4.
Offline