Spawning an enemy away from player

Discussion and feedback on Construct 2

Post » Thu Feb 26, 2015 7:34 pm

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!!
B
4
Posts: 11
Reputation: 222

Post » Thu Feb 26, 2015 8:15 pm

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.
B
57
S
15
G
11
Posts: 912
Reputation: 12,606

Post » Thu Feb 26, 2015 8:22 pm

GeometriX wrote: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!!! :D

EDIT: It works!! Thank you GeometriX!
B
4
Posts: 11
Reputation: 222


Return to Construct 2 General

Who is online

Users browsing this forum: BackendFreak, blackhornet, rayolaser and 16 guests