Driving Test
Hello. I am having trouble with project 3 in chapter 6. I can get the car to move freely but not sure how to stop the car and have text appear when I touch a cone. Help would be much appreciated. Thanks!
|
Any one?
|
[QUOTE=MikeC;19712]Hello. I am having trouble with project 3 in chapter 6. I can get the car to move freely but not sure how to stop the car and have text appear when I touch a cone. Help would be much appreciated. Thanks![/QUOTE]
Unfortunately, I have no idea what you mean by "project 3 in chapter 6," probably because I don't have any of the Alice textbooks. |
[QUOTE=bjia56;19761]Unfortunately, I have no idea what you mean by "project 3 in chapter 6," probably because I don't have any of the Alice textbooks.[/QUOTE]
I have to maneuver a car around some cones and if the car hits a cone the car stops and text appears. I have created three methods for the car movements forward, left and right using the while ... is pressed. I'm not sure how to make the car stop and the text appear when I hit a cone. |
umm.. try if car is (1mtr)... of 'cone1' do method 'crash'
|
[QUOTE=shaydon;19769]umm.. try if car is (1mtr)... of 'cone1' do method 'crash'[/QUOTE]
Ok I made a car.method crash to move car 0 meters and set is showing to true then in world I put if/else if car is within .05 meter of cone; car.crash but nothing happens so I know im doing something wrong? |
Are you able to post your current world? I'll take a look and see what I can suggest.
|
1 Attachment(s)
[QUOTE=bjia56;19771]Are you able to post your current world? I'll take a look and see what I can suggest.[/QUOTE]
Yes I can. Thanks! |
Ok I would suggest having a Boolean variable to see whether you can move or not, then have each of the "while [key] is pressed do" include an "if" statement to test whether the car can be moved.
Then you can do what shaydon suggested, only include at the beginning of the method a statement that changes the variable value. |
[QUOTE=bjia56;19773]Ok I would suggest having a Boolean variable to see whether you can move or not, then have each of the "while [key] is pressed do" include an "if" statement to test whether the car can be moved.
Then you can do what shaydon suggested, only include at the beginning of the method a statement that changes the variable value.[/QUOTE] Thanks!! I'll see what I can do. |
All times are GMT -5. The time now is 07:45 PM. |
Copyright ©2024, Carnegie Mellon University
Alice 2.x © 1999-2012, Alice 3.x © 2008-2012, Carnegie Mellon University. All rights reserved.