How do I fix object randomly spawning?

0 favourites
  • 2 posts
From the Asset Store
Welcome! I-Spy (Hidden objects) is an educational puzzle that is more than just seek-and-find activities.
  • 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?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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]

    [UFOSpawn<10]

    (nested)[blank condition]

    (nested)[Else] > Create object UFO2 on Layer 1 at random]

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