Is there a Condition for when an Object is created?

This forum is currently in read-only mode.
From the Asset Store
This is a single chapter from the "Construct Starter Kit Collection". It is the Student Workbook for its Workshop.
  • Hi all, I've been experimenting with Construct and finding it very well designed and intuitive for game design. I'd like to ask you for some help on this issue, I couldn't find any reference in forum or searches:

    I wish to have Objects created dynamically, and to have some code performed when an object is created. Is there a Condition, or otherwise a way to "catch" when an object is created, to initialize it? Right now, the only way I can think of is creating a Function for every object, such as "UnitInitialize", "EnemyInitialize", and calling it after creating each object, which seems a bit overcomplicated.


  • How about using a private variable?

    If you set that objects variable to say 0, that could mean it is not created.

    Then when you actually create the object set its variable to 1, and have a condition that checks if is 1.

    Might need a trigger once on the comparison event.

  • You can just put the action right after the creation of the object, like:

    +Create object "enemy"

    set "enemy" position to 0,0

    It will select only the recently created object

  • Thanks for the tips! I've incorporated those into my code.

    However, I think something along the lines of what I was requesting is something that would be pretty useful in Construct, for code organization and simplification reasons.

  • I think its probably good coding practise to use functions to create objects anyway, rather than having random object create triggers all over your event sheet.

    I can see why it might be nice to have a "Initialize" sort of thing though

  • I've recently studied a little Phyton, and there's something called "init" for objects. It's a place of the code where you put any code an object will run right after it's created. Maybe it's possible to use this kind of phyton code with construct, I dont know, and maybe on a new update a "object is initialized" condiction could be added

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • How would you deal with multiple instances?

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