Spawn object random location, not near player

0 favourites
  • 6 posts
From the Asset Store
Players follower. use it for anything which follows the player
  • So i've created a little zombie-like game.

    Every time you kill a zombie there will spawn another one randomly at the map... There is one problem, A zombie can now spawn in the player or at one pixel from the player, making it an impossible game.

    Does anybody know how to spawn an object at a random location, but not near another object?

    Tnx

  • Put on a check for something like : When zombie spawns > if overlapping player > select new location

  • Put on a check for something like : When zombie spawns > if overlapping player > select new location

    So something like this? (Sorry just started construct)

    <img src="http://i42.tinypic.com/2ykf86r.png" border="0" />

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • <img src="http://postimg/image/llv80nwwn/" border="0" />

    <img src="http://postimg/image/rp1wlw18t/" border="0" />

    Wish I could upload Capx, but here is an example of what you could do. Create an invisible spawn object that moves around randomly and spawns a zombie every five seconds or so. Also have an invisible player field pinned to the player, if the spawn overlaps that field then it moves else where to spawn the zombie. I am fairly new to construct myself but I did this when playing around and it worked for me!

    Hope it helps otherwise I am sure someone else can get you something even better. <img src="smileys/smiley4.gif" border="0" align="middle" />

  • Kinda. That could loop properly. Would need to be tested. Also you'd need to delete the old one that was overlapping the player.

  • Okay, will check first in the morning, tnx!

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