PDA

View Full Version : How do I make things move at Random


Jackweird
04-20-2013, 09:55 PM
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

chickentree
04-21-2013, 01:46 PM
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

adriana1calle
04-23-2013, 02:41 PM
I want to make some things like those, what do you reccomend? thanks! :)


-------------------------
casas en venta en cuenca (http://www.casasenventaencuenca.com)

chickentree
04-27-2013, 12:24 PM
I want to make some things like those, what do you reccomend? thanks! :)


-------------------------
casas en venta en cuenca (http://www.casasenventaencuenca.com)

I'm sorry, I'm not sure what you are asking, could be more specific?
If you are having a problem with my answer, please identify where the problem is or what you don't understand.
Mark