Quote:
Originally Posted by Jackweird
I am running into a issue on one problem i have what i have to do is
1. Create a generic random movement method that will use random numbers to pick a direction and a amount, and will cause a butterfly to move accordingly
2. and also Place six butterflies in a list and create a methods and events to make all of the butterflies fly around gently in an Alice world, flapping their wings and moving about randomly
If some one could point me in the right direction it would be great
|
If you have
Learning to program with Alice look in the Tips and Techniques section of Chapter 6 at the Random motion example.
Basically you want to move each object a random amount up/down, left/right and forward/back. This is usually accomplished in three lines, one for each pair of directions. and giving the "random number" function (under world/function) a minimum that is negative and a maximum that is positive. So, for instance, the butterfly move instruction might look like this:
butterfly move up random number minimum = -0.05 Maximum = 0.05
Hope that helps