Spawning Enemy Problem?!?!?

Get help using Construct 2

Post » Wed Apr 08, 2015 12:32 am

Okay my game consists of an enemy that can spawn in 1 of 2 places. I did this by copy and pasting the enemy and then using the 'pick random instance' and then create enemy. (they spawn every 2 seconds)
When running it through my browser it works fine and it chooses one of the to spawning positions as I wanted. I have created a front page for the game which is basically an image and the play button which will take you to the game layout, which again when running through my browser works fine. However...........................when I run it through my browser just for the very start of the game it will spawn 2 enemies either overlapping on another or from both spawn positions together.

I can only assume that when I run it through my browser, when I'm on the start layout and not the game layout if I wait 2 seconds or more then the game layout is already running and therefore will spawn an enemy (since it spawns every 2 seconds) which will accompany the other enemy.

I thought that I should then have that 'on start of layout'............and then input the **'pick random instance' and then create enemy**. This still didn't work. :?

Does anyone know what I'm doing wrong?

THANK YOU SO MUCH!!!!!!!!!!!!!!!!!!!!
B
3
Posts: 36
Reputation: 253

Post » Wed Apr 08, 2015 1:37 am

yes the Every 2 seconds event starts immediately after the layout is loaded.

Make sure you are destroying the object On Start of Layout since in the editor you may have it on the screen.
B
88
S
29
G
14
Posts: 1,154
Reputation: 15,003

Post » Wed Apr 08, 2015 1:06 pm

But when i code 'on start of layout - destroy enemy' the enemy doesn't spawn at all after that since its just been destroyed
B
3
Posts: 36
Reputation: 253

Post » Wed Apr 08, 2015 6:36 pm

does your spawn condition require there to be an enemy somewhere?

I'd need to see your capx
B
88
S
29
G
14
Posts: 1,154
Reputation: 15,003

Post » Thu Apr 09, 2015 1:57 am

Yeah here is a screenshot.............

Image
B
3
Posts: 36
Reputation: 253

Post » Sun Apr 12, 2015 11:05 pm

Hi,

Delete "pick a random..... instance", it should work
Image Image
B
22
S
13
G
130
Posts: 869
Reputation: 67,816

Post » Mon Apr 13, 2015 2:31 pm

Won't that cause both enemies to spawn at the same time?
B
3
Posts: 36
Reputation: 253

Post » Mon Apr 13, 2015 2:38 pm

Im pretty sure it wont work, if you have "Pick a random Ninjaspawnplace" and there are none in the layout, then that will turn False and it will never create any new ninjasspawnplace for you.

It seems a bit weird why you would pick a random Spawn place and then create another spawn place? From your original description, it sounded like you wanted to spawn enemies at the spawn locations and not new spawn places? but maybe I misunderstood that. :)
B
44
S
11
G
2
Posts: 1,182
Reputation: 6,828

Post » Mon Apr 13, 2015 2:41 pm

if all the instance are destroyed , the system can not pick one random
Image Image
B
22
S
13
G
130
Posts: 869
Reputation: 67,816

Post » Mon Apr 13, 2015 2:46 pm

I'll create a quick image now of what I mean.
B
3
Posts: 36
Reputation: 253

Next

Return to How do I....?

Who is online

Users browsing this forum: rotacak and 7 guests