So I am pretty new to scratch and the reason I got into it was because it is on my rasberry pi I just got...
I have been working on this race program for some time now and I want to make it if I press the up arrow key and the left arrow key then the car will turn 5 degrees to the left and go forward but it only goes left once after that it just goes strait it the direction it was put (5 degrees)
I have looked at several sources and haven't found anything. Thanks to whoever can help me!
Offline
I forgot to say when u let go of the arrow keys it must stop...
Offline
Since your car is turning and moving, I think that instead of giving you entire scripts, I might be able to help by fixing what you already have. So could you show your scripts or upload your project? Remember, if you don't want to do this, just say.
Anyway, hello DaPoliteSniper and welcome to Scratch! I wish you an easy path to learning how to program!
Last edited by ErnieParke (2012-12-31 13:46:38)
Offline
I am very sorry I can't upload them my raspberry pi doesn't have an Internet connection yet
(Don't have the parts) and I don't have the program for this turn I deleted the 5 or more tries that failed
Offline
Were you using the
when [right arrow v] key pressedhat blocks?
when gf clicked forever if <key [right arrow v] pressed?> turn cw (10) degrees end endThis kind of scripting can work with other scripts at the same time.
Last edited by Kileymeister (2012-12-31 17:06:07)
Offline
Kileymeister wrote:
Were you using the
when [right arrow v] key pressedhat blocks?
Those blocks only work one at a time, and cannot be active simultaneously. Because of this, your scripts would make the car turn left once, stop using that script, and start using only the move forward scripts.
Instead of those blocks, try usingwhen gf clicked forever if <key [right arrow v] pressed?> turn cw (10) degrees end endThis kind of scripting can work with other scripts at the same time.
I think that you meant [turn (10) degrees] and not [move 10 steps], though other than that, you've got everything correct.
Offline
ErnieParke wrote:
Kileymeister wrote:
Were you using the
when [right arrow v] key pressedhat blocks?
Those blocks only work one at a time, and cannot be active simultaneously. Because of this, your scripts would make the car turn left once, stop using that script, and start using only the move forward scripts.
Instead of those blocks, try usingwhen gf clicked forever if <key [right arrow v] pressed?> turn cw (10) degrees end endThis kind of scripting can work with other scripts at the same time.I think that you meant [turn (10) degrees] and not [move 10 steps], though other than that, you've got everything correct.
Blar, the move 10 steps was supposed to signify general script goodness, but I agree that could cause some misinterpretation. Good call.
Offline
Sorry if you didn't unberstant my fault...
When the up arrow and left arrow key is pressed I want the car to turn 5 degrees to the left and then go forward untill the keys are released.
Thanks if anyone can help
Sorry for the trouble!
Offline
If I understand you correctly, the block you are looking for is the wait until block. Does this sample script achieve your goal?
when gf clicked forever wait until <key [right arrow v] pressed?> turn cw (5) degrees wait until <not <key [right arrow v] pressed?> > endThis script will control the turning, and the wait until blocks will ensure that it never turns more than 5 degrees from a single press of the right arrow.
when gf clicked forever move (10) steps endEDIT: It seems time atrophies my skill with scratch blocks. I fixed the trouble I was having.
Last edited by demosthenes (2012-12-31 19:30:15)
Offline
The problem is I am making a really simple race game and little cars go around the track.
I do not only have this I have a lot of other things so I am not sure it is a simple as this.
This is not my only task...I have a number of other things that do along with this.
I am sort is this seems stupid in any way again I am new
Offline
Don't hesitate to ask questions! We love when you do. Did my post help?
If you need more help or if my answer didn't work, just ask!
Offline