random spawning

stimpersstimpers Member Posts: 34
edited November -1 in Working with GS (Mac)
i am making a game where you have one actor that stays in its place and other actors come to it on a set route and the main actor has to move up and down to either avoid or collide. I need a efficent method to spawn actors at random and i got lost with the how to guides at the interger part
-thanks and good look with your production.

Comments

  • DrGlickertDrGlickert Member Posts: 1,135
    Define efficient.

    Do you want them on a steady stream? You could use timers;

    EVERY 1 second, spawn actor

    I have a game where I have power-ups that fall from the top of the screen. I have a timer for that with a random time associated with it;

    EVERY random(15,30) seconds, Spawn Actor: Power Up. X: random (10,770) Y: 350

    That will spawn a power up to fall every 15-30 seconds, it will also spawn some place randomly along the left to right and will spawn outside of the player's view (above the scene). On the Power-up I have an accelerate in the 270 degrees direction which makes it come downwards and the player can then pick it up.
Sign In or Register to comment.