Spawn a guy on top of a random platform

  • Hi, first post

    I have a random spawned platform every 5 seconds, how do i make sure that an enemy will always be spawned on top of it and that he will not fall off while it moves?

  • WhiteX

    use the same logic that you are using for the platform on the enemy to spawn them randomly?

    you can use the pin behaviour to pin the enemy to the object so it won't fall.

  • well, here?s the thing, the platform spawns like this:

    System - Every 5 seconds

    System - Pick a random "Spawnpoint" instance >> System | Create obj platform om layer 0 at (spawnpoint.X, spawnpoint.Y)

    Doing the same to the enemy will make it spawn, but to any spawnpoint, not necessarily the one where the platform appeared.

    I tried to use it on a container bu when the guy dies, the platform goe kaput and i need it for the player to use

  • you have several options:

    1.- Use a variable such as lastSpawnpoint

    2.- Or store spawnpoint.X and spawnpoint.Y as param0 and param1 to pass to a function call.

    3- Or use an array if the spawn positions are "fixed" (i.e. you want them to be created at defined positions)

    4.- Another one: make the last created spawnPoint sprite have it's variable "IsThisSpawnPointTheLatestOne" set to True (and the others to False), so enemies can only be created there.

    5.- Use IID

    honestly SC2 makes it very easy :)

    If you want to explore any of these just ask :)

  • Will it always be the same platform linked to the same enemy or are platforms and enemies completely random ?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • - it seems that 3 is the best bet, but i am a newbie on arrays

    @plinkie, for now, it is a singe enemy on a singla platform, tomorrow will be a family of platforms on a family of enemies

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)