Alice Community  

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

Reply
 
Thread Tools Display Modes
Creating Boundries & effects
Old
sabrewulf
Guest
 
Status:
Posts: n/a
Default Creating Boundries & effects - 04-24-2009, 04:17 PM

I am working on a program and i would like to be able to let the user control a vehicle on the program. The issue that i am having is that i would like to restrict the user to stay within a certain circle. This is what i am unsure on how to do.
Does anyone know how to go about creating random movements for a vehicle? I think this could be accomplished with having a variable that is randomly selected(forward, reverse, left, right, etc) then random choose a number for the distance to travel.
And going along with the second part, how would i write(if its even possible) that if the user controlling the car, collides with the other car(computer controlled), then do a method(crash sound, fire, etc)?

Any help would be much appriciated.
   
Reply With Quote
Boundary solution
Old
NivekNamttid
Guest
 
Status:
Posts: n/a
Lightbulb Boundary solution - 09-22-2009, 09:55 PM

For the boundary, place an Object in the world, drop a Object move to vehicle tab into the world screen, and then move the Object to the center of where you want the boundary to be. Then, make a repeating if/else statement (True) that tests whether the vehicle is inside a threshold of that central Object. In the else box, put vehicle move one meter towards central Object. That should keep it in the boundary.
In case that was confusing, if you read what the program does aloud, it would say: If vehicle is within threshold of central Object, do nothing. If vehicle is not (else) then vehicle move one meter towards central Object.

Last edited by NivekNamttid; 09-22-2009 at 09:56 PM. Reason: clarification
   
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 ©2023, Carnegie Mellon University
Alice 2.x © 1999-2012, Alice 3.x © 2008-2012, Carnegie Mellon University. All rights reserved.