Link to home
Start Free TrialLog in
Avatar of rpreiss
rpreiss

asked on

I am using the alice programing enviornment to make a race car game

How do i get the while command to work.  I want the car to turn left when the left key is held down. and then similarly to back, forward and right.  I'm just trying, not sure anyone would have reason to know Alice.  This is for a class.

Thanks

Artie
Avatar of InteractiveMind
InteractiveMind
Flag of United Kingdom of Great Britain and Northern Ireland image

I'm not familiar with Alice. But in the languages I've used to do similar things, you wouldn't use a while statement; instead, one technique would be to start turning left when the left key is pressed; and then stop when either that key is released, or a key to counteract it is pressed.
So it's really a set of state variables, and if-statements.

Hopefully that gives you an idea..?
ASKER CERTIFIED SOLUTION
Avatar of dukesnoopy
dukesnoopy

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial