How do I fix object randomly spawning?

Get help using Construct 2

Post » Thu Apr 06, 2017 10:58 am

I'm developing a top-down space shooter, and I have a mechanic in which when the player's "Score" variable reaches 10, it spawns one new enemy type and keeps spawning when one is killed.

I have done this by creating a variable called "UFOSpawn" which by default is set to 0, and sets to 1 when the players score reaches 10. When said variable is set to 1, the system will spawn the enemy type. If on

I have done this using the following method:


Creating a variable called "UFOSpawn", default value 0.

System>Score=10>Set "UFOSpawn" to 1

[GROUP "UFOSpawn":]
[System>Group "UFOSpawn" = Active>Create object UFO on Layer 1 at random]

System>UFOSpawn = 1>Set Group "UFOSpawn" Activated
System>UFOSpawn < 1>Set Group "UFOSpawn" Deactivated

UFO On created>Set UFOSpawn to 0


When I run the layout, for some reason one UFO object spawns in a random location even when Score = 0.

What am I doing wrong?
Posts: 1
Reputation: 152

Post » Thu Apr 06, 2017 1:54 pm

Try setting the group inactive in a start of layout event action. It may be starting activated.

Another simpler way to do this is instead of putting it in a group to use the variable as a condition in your spawn event.

[System>Group "UFOSpawn" >Create object UFO1 on Layer 1 at random]
(nested)[blank condition]
(nested)[Else] > Create object UFO2 on Layer 1 at random]
Check out my completed games on the Arcade! Capt. Doe Save the Universe! & Clicker Wizard!
Posts: 644
Reputation: 10,068

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 4 guests