Random non-repeating spawn points?
Cowuniverse
Member, PRO Posts: 97
I looked up how to make random, specified spawn points and got that down with tables, but I have a coin that spawns twice in the same location and I don't want that to happen. Instead I want it to always go to a random point other than the on it was just at. Thank you for the help.
Best Answer
-
Hopscotch Posts: 2,782
ok, soo, let us rather use math to make a non repeating random list of numbers:
mod( LastNumber-1+random(1,TotalRange-1) , 3 ) +1
First create a new self.attribute, NumberRange
Then add tis behavior
Change Attribute self.NumberRange = TableColCount(game.coin points)
then, where you change game.coin spawn do this
Change Attribute game.coin spawn = mod(game.coin spawn-1+random(1,self.NumberRange-1))+1
The rest is the same.
Answers
@Cowuniverse, this is a forum for game developers, not clairvoyants.
You will need to give more info as to how you approach it and what is not working.
You say you looked up and use tables for the random spawn points. Then you should be good.
But since it is not working for you, we have no idea what you did, thus no idea what to suggest.
Post a screenshot of your rules maybe.
MESSAGING, X-PLATFORM LEADERBOARDS, OFFLINE-TIMER, ANALYTICS and BACK-END CONTROL for your GameSalad projects
www.APPFORMATIVE.com
@Hopscotch
That is the table and the other screenshot is in the behaviors in the coin. I'm trying to make the coin not spawn at the same point twice, but at one of the other 4 points it isn't already on.
@Cowuniverse
Please show me the expressions in the "Spawn Actor" behavior.
Do you store the position the last coin was on? Then you could just check that "game.coin spawn" is not equal to the last spawn position.
MESSAGING, X-PLATFORM LEADERBOARDS, OFFLINE-TIMER, ANALYTICS and BACK-END CONTROL for your GameSalad projects
www.APPFORMATIVE.com
how would you check? that is wasn't at the last position?
where do I put this part?
@Hopscotch Never mind I got it to work. Thank you very much!
@Cowuniverse, my pleasure, glad it helped.
MESSAGING, X-PLATFORM LEADERBOARDS, OFFLINE-TIMER, ANALYTICS and BACK-END CONTROL for your GameSalad projects
www.APPFORMATIVE.com