When an object is created/destroyed

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

    I would like to know if there is a simple function to do that :

    "At the creation of an object" or "at the destruction of an object"

    -> do actions

    Like the feature in GM :

    • create event
    • destroy event

    Thank you for your answer .

  • why not use the conditions for creating an object as the conditions for whatever action it is you have in mind?

    think:

    instead of having a condition create an object and this creation of the object being another condition for yet another action

    why not:

    have the conditions that would create an object produce the actions you desire

  • Sorry no there is no specific function to do that, but fortunately Construct allows you to create just about any condition you can think of via private variables, globals, the Function object, and many other finite state objects.

    To do this with a private variable simply change the objects variable when its created, or destroyed. Then add a condition that always compares that variable, and does something when it changes.

    Even simpler is the Function object. With it you can call your own function when the object is created/ destroyed. Then you just make up your own function as:

    On function "myfunction"

    -> Do this

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • hi

    thank you for your answers .

    why not use the conditions for creating an object as the conditions for whatever action it is you have in mind?

    think:

    instead of having a condition create an object and this creation of the object being another condition for yet another action

    why not:

    have the conditions that would create an object produce the actions you desire

    Yes, in most of case, I think it will be good in a lot of case.

    In fact, there is a sort of "create" event thanks to that feature : properties (for object), private and global variable too can be usefull in this case .

    Sorry no there is no specific function to do that, but fortunately Construct allows you to create just about any condition you can think of via private variables, globals, the Function object, and many other finite state objects.

    To do this with a private variable simply change the objects variable when its created, or destroyed. Then add a condition that always compares that variable, and does something when it changes.

    have made that and it works fine, thank you .

    [quote:26uasvwe]Even simpler is the Function object. With it you can call your own function when the object is created/ destroyed. Then you just make up your own function as:

    On function "myfunction"

    -> Do this

    have tried to create a function, and it work very weel, thank.

    If you have some examples of functions utility, I'm interested too.

    Thanks again

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