How do I create an object only once in a given condition?

0 favourites
  • 3 posts
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • Hi guys!

    In terms of programming, how can an object be created only once in a given condition?

    As I'm not a programmer, whenever I put a "create object" condition, the Construct keeps creating an object infinitely and filling the device's memory.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Set the condition to "Trigger Once" or use "On Start of Layout" for example. If you having given condition that remain unchanged it is more likely the action will continue to execute creating object.

    For example the condition comparing player position:

    "is player.X < 200?"---> "create enemy at x = 100, y = 300"

    See the statement will keep creating enemy as long as player x position less than 200. In order to make the action executes once, a "Trigger Once" should be added under same condition. Try to experiment by putting "Trigger Once" before or after comparing player position because the result will be different.

  • Set the condition to "Trigger Once" or use "On Start of Layout" for example. If you having given condition that remain unchanged it is more likely the action will continue to execute creating object.

    For example the condition comparing player position:

    "is player.X < 200?"---> "create enemy at x = 100, y = 300"

    See the statement will keep creating enemy as long as player x position less than 200. In order to make the action executes once, a "Trigger Once" should be added under same condition. Try to experiment by putting "Trigger Once" before or after comparing player position because the result will be different.

    Thanks, dude! :D

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