Spawning coins

tomicz

  • Posts: 106
Hello there.

How do i spawn coins same way as in Temple run, my game is from top view though. So i have 3 lanes, and i want them randomly to spawn in all three lanes, but not in the same time, so only one lane at the moment.


TravisRoot

  • Posts: 6
Hey tomicz!

I would assign each lane a number attribute (0, 1, or 2) and have a "random number between __ and __ " decide which lane to spawn a coin in.

You could have the spawn behavior set to occur every, say, 4 seconds.

That's just the way I'd do it!

Squirrel Lord

  • Posts: 25
Travis is right. For a more detailed explenation:

Every {spawn coin time} seconds
--Set {LANE} to random number between 1 and 3.

If {LANE} =1
--Draw {COIN ACTOR} at {Lane 1 X} {Lane 1 Y}

Otherwise If {LANE} =2
--Draw {COIN ACTOR} at {Lane 2 X} {Lane 2 Y}

Otherwise If {LANE} =3
--Draw {COIN ACTOR} at {Lane 3 X} {Lane 3 Y}