Help with Random Enemy Spawn Points

0 favourites
  • 5 posts
From the Asset Store
Connect the dots in the correct order and draw happy animals!
  • I'm having trouble with something I think most advance users will probably find very basic, but if I can get some help on this I'd appreciate it.

    I have 4 enemies that I want to spawn at 4 spawn points, but I don't want the enemies to be random, just what spawn point they spawn on. So all 4 enemies (no duplicates) will spawn on start of layout but in different locations based on where I place the spawn points (the red sprites), if that makes any sense.

    RandomSpawnPoints

    Tagged:

  • Still not described too well, do you mean each enemy has their own spawn point? If so, you could just create 4 objects and spawn them from their spawn point rather than use one. If it must be one spawn point object, then you need to pick them in some way. For example with an instance variable equal to 1, you could say pick spawn point where var=1, spawn enemy 1; pick spawn point where var=2, spawn enemy 2.

  • Thanks for your reply. Maybe I'm misunderstanding what you are explaining, but it doesn't sound random to me. If enemy 1 spawns on spawn point 1 every time, it's not random. I have other things I want to do with the spawn points much later in development, but right now I want the enemies to all spawn on screen at once, but choosing random spawn points each time the game loads.

    So some times when the game loads, Enemy 1 spawns at the spawn point with UID2 or sometimes with UID5, or maybe UID 4. If Enemy 1 spawns randomly at a spawn point with UID2, I want the other enemies to pick a different spawn point randomly until all 4 enemies have spawned at different spawn points. Does that make sense? I think I'm starting to confuse myself.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I thought maybe you meant that but then in the post it says 'enemies should not be random' and it was confusing. Anyway, there you go dropbox.com/scl/fi/2tgaqwcbwq18rfr3r39au/RandomSpawnPoints_edited.c3p

  • Excellent! Exactly what I wanted. I appreciate you creating an example I can look at and for making it very simple to understand the logic. Thank you very much!

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