Spawning an enemy away from player

  • Hello everybody!

    I've been googling this problem for a while but I haven't found a good easy answer.

    I just started using Construct 2 and I'm making a game where some triangles spawn and when they touch the player the health of the player decreases. I've set the triangles to spawn randomly but sometimes they spawn on top of the player, making the game end quickly. How can I make this bug go away?

    I can send screenshots if needed

    Thanks for the help!!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • This should go in the How Do I forum.

    There are a few ways to handle these sorts of situations. The way I do it is with an invisible dummy object, let's call it a spawner. I create the spawner(s) wherever I'd like my objects to spawn, and then spawn the spawner there instead. Next is to check if it's overlapping the player/obstacles/walls/etc. If it is, destroy it. Then create a function for the spawner to create your object.

  • This should go in the How Do I forum.

    There are a few ways to handle these sorts of situations. The way I do it is with an invisible dummy object, let's call it a spawner. I create the spawner(s) wherever I'd like my objects to spawn, and then spawn the spawner there instead. Next is to check if it's overlapping the player/obstacles/walls/etc. If it is, destroy it. Then create a function for the spawner to create your object.

    I'll try that now and see if that works!

    Thank you so much for the reply!!!

    EDIT: It works!! Thank you GeometriX!

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