This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2007-12-14 11:03:24

_Doctor_Who_
Scratcher
Registered: 2007-12-06
Posts: 10

Pausing ONE thing!

<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)


98% of the teenage population will try, does or has tried smoking pot. If you're one of the 2% who hasn't, copy & paste this into your signature.

Offline

 

#2 2007-12-14 11:45:06

EdnaC
Scratcher
Registered: 2007-08-28
Posts: 100+

Re: Pausing ONE thing!

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

 

#3 2007-12-16 03:45:30

_Doctor_Who_
Scratcher
Registered: 2007-12-06
Posts: 10

Re: Pausing ONE thing!

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.


98% of the teenage population will try, does or has tried smoking pot. If you're one of the 2% who hasn't, copy & paste this into your signature.

Offline

 

#4 2007-12-16 04:34:24

Paddle2See
Scratch Team
Registered: 2007-10-27
Posts: 1000+

Re: Pausing ONE thing!

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.


http://i39.tinypic.com/2nav6o7.gif

Offline

 

#5 2007-12-16 05:18:34

_Doctor_Who_
Scratcher
Registered: 2007-12-06
Posts: 10

Re: Pausing ONE thing!

Okay! i'll go do that!


98% of the teenage population will try, does or has tried smoking pot. If you're one of the 2% who hasn't, copy & paste this into your signature.

Offline

 

#6 2008-04-20 12:54:07

DoctorB
Scratcher
Registered: 2008-04-20
Posts: 18

Re: Pausing ONE thing!

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.


If there are any exquisite or VERY POWERFULL Super Smash Brothers Brawl players out there, tell me your brawl & wii code and try to beat me, i've versed many people and won, i would like a challange, i'll get my brawl & wii code back to here, just check every now and then!!! :-)

Offline

 

Board footer