platform spawning problem.

njvdberge@gmail.comnjvdberge@gmail.com Indie Game DeveloperBreda, the NetherlandsMember Posts: 22

hey there im creating an endless runner, the game gets platforms spawned which fly in from the right of the screen.
i have a random spawn location on the y axis of the last platform. the next platform will spawn random between 40 and -40 pixels of the last platform.
but is i play for a while the platforms spawn that low or that high so i dont see no platforms anymore.
how can i prevent my platforms spawns outside of the screen?

Best Answer

  • RabidParrotRabidParrot Formally RabidParrot. Posts: 956
    Accepted Answer

    Tell the actors that when they are out of the screen they should return to it.

    For instance you are using an iPad, 768x1024,

    Tell the actor that if

    self.position.y > 768 **

    change (or constrain) attribute self.position.y 767 **
    Also,

    Tell the actor that if

    self.position.y < 0 **

    change (or constrain) attribute self.position.y 1 **

    ** = Might have to change depending on the size of the actor.

Sign In or Register to comment.