Alice Community

Alice Community (http://www.alice.org/community/index.php)
-   How do I...? (http://www.alice.org/community/forumdisplay.php?f=16)
-   -   Chapter 7 Assignment 6 - Bumper Cars (http://www.alice.org/community/showthread.php?t=3193)

Lariien 10-10-2009 05:22 PM

Chapter 7 Assignment 6 - Bumper Cars
 
:confused: I'm having trouble completing the bumper car challenge. It's directions are to have 4 bumper cars in a loop of going around the bumper ring. They must turn every time they hit a wall or another car.
Help?!

Dameria 10-10-2009 09:57 PM

How about you have an inner ring and and outer ring, and for the inner ring you do:
(loop infinite (if (car is within threshold of inner ring) do (car rotate right 0.05, duration: 0.25, style: abruptly))

And if the car hits outer ring, do the same thing, except rotate car left instead of right. The inner ring can be an oval in the middle of the track, and the outer ring you may have to build yourself.

You could also add the same thing with the other cars, but that would be a little more complicated, requiring more coding.


All times are GMT -5. The time now is 12:22 PM.

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