Alice Community  

Go Back   Alice Community > Alice 2 > How do I...?

Reply
 
Thread Tools Display Modes
Driving Test
Old
MikeC
Guest
 
Status:
Posts: n/a
Default Driving Test - 04-11-2010, 11:43 PM

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!
   
Reply With Quote
Old
MikeC
Guest
 
Status:
Posts: n/a
Default 04-12-2010, 06:38 PM

Any one?
   
Reply With Quote
Old
bjia56
Guest
 
Status:
Posts: n/a
Default 04-12-2010, 06:40 PM

Quote:
Originally Posted by MikeC View Post
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!
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.
   
Reply With Quote
Old
MikeC
Guest
 
Status:
Posts: n/a
Default 04-12-2010, 06:58 PM

Quote:
Originally Posted by bjia56 View Post
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.
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.
   
Reply With Quote
Old
shaydon
Senior Member
 
Status: Offline
Posts: 445
Join Date: Dec 2009
Location: Caspian Border
Default 04-12-2010, 07:02 PM

umm.. try if car is (1mtr)... of 'cone1' do method 'crash'
   
Reply With Quote
Old
MikeC
Guest
 
Status:
Posts: n/a
Default 04-12-2010, 07:18 PM

Quote:
Originally Posted by shaydon View Post
umm.. try if car is (1mtr)... of 'cone1' do method 'crash'
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?
   
Reply With Quote
Old
bjia56
Guest
 
Status:
Posts: n/a
Default 04-12-2010, 07:24 PM

Are you able to post your current world? I'll take a look and see what I can suggest.
   
Reply With Quote
Old
MikeC
Guest
 
Status:
Posts: n/a
Default 04-12-2010, 07:31 PM

Quote:
Originally Posted by bjia56 View Post
Are you able to post your current world? I'll take a look and see what I can suggest.
Yes I can. Thanks!
Attached Files
File Type: a2w Driving Test.a2w (886.9 KB, 76 views)
   
Reply With Quote
Old
bjia56
Guest
 
Status:
Posts: n/a
Default 04-12-2010, 07:55 PM

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.
   
Reply With Quote
Old
MikeC
Guest
 
Status:
Posts: n/a
Default 04-12-2010, 08:10 PM

Quote:
Originally Posted by bjia56 View Post
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.
Thanks!! I'll see what I can do.
   
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Copyright ©2024, Carnegie Mellon University
Alice 2.x © 1999-2012, Alice 3.x © 2008-2012, Carnegie Mellon University. All rights reserved.