Random Position
xacto
Member Posts: 146
I am trying to create objects that would fly down from the top of the screen. I need them to be placed in RANDOM times as well as RANDOM positions.
I created an Actor and placed it on the top of the screen and then created a RULE behavior with the following code:
When ANY condition are valid:
An attribute changes: game.Time equals random(0,5)
Change Attribute self.Position.X To random (0,400)
Is the right way to do this?
I created an Actor and placed it on the top of the screen and then created a RULE behavior with the following code:
When ANY condition are valid:
An attribute changes: game.Time equals random(0,5)
Change Attribute self.Position.X To random (0,400)
Is the right way to do this?
Comments
The Spawn Actor behavior is fun to use for random position.
Is there something that I am missing?
I created an actor attribute that holds an integer. (RandomInt)
Gave the actor a Change Attribute to set that attribute to some random number.
Instead of your method of 'An attribute changes: game.Time equals random(0,5)' I made it,
'An attribute changes: game.Time is greater than RandomInt."
Hope that helps
I created a new program with the following code:
1. Created an Actor
2. Created an Actor Integer and named it randomInt
3. Created a Change Attribute: self.randomInt to random(0,100)
4. Created a Display Text: self.randomInt
5. I place the Actor in the scene
When I hit the Preview it displays a number like it suppose to, however if I run it again or press rewind it will display the exact same number.
Ok... here is where it gets strange. I noticed that if I wait a couple of minuets and run it again it will display a different number. Sometimes it works, sometime it does not. Is this a bug?
I am confused.
Awesome job so far with the Starfire game btw.