How can I randomize two numbers in "direction" slot
Simple Gamer Arts
Member, PRO Posts: 305
My actor spawns and I want him to either go left or right (0, 180)... how do I randomize this in the move behavior?
Comments
One way that would work,
Create a new Index attribute. Make it change to a random value between 0 and 1.
Random(0,1)
Then have two seperate rules for the actor that is spawned.
When Index Attribute is equal to 0.
Then Move direction 0.
When Index Attribute is equal to 1
Then Move direction to 180.
Hope that helps,
GSLearn.com | Templates | Free Demos | Udemy Course
Or,
Create a new Index attribute. Make it change to a random value between 0 and 1.
Random(0,1)
Then have a move behaviour directly below. In the Direction section, open up the expression editor and enter in the following.
(Index.Attribute*==0)and(0)or(180)
*You will need to select the the Index attribute. Not the word.
GSLearn.com | Templates | Free Demos | Udemy Course
Or,
If you just want to use the move behaviour,
You could just add the following into the direction section expression editor:
(Random(0,1)==0)and(0)or(180)
GSLearn.com | Templates | Free Demos | Udemy Course
@Two.E Thanks so much!!! it worked. I used the first one.
You can also set the direction to:
Random(0,1)*180
I knew there was a simple way. Almost got there on my own!
GSLearn.com | Templates | Free Demos | Udemy Course
It's one of those questions with several million solutions !
You could also do it with the speed . . . .
random(((0,1)
*
2)-1)*
300