When an object is created/destroyed

For questions about using Classic.

Post » Tue May 11, 2010 5:39 pm

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 ;) .
B
2
S
1
G
2
Posts: 23
Reputation: 846

Post » Tue May 11, 2010 6:53 pm

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
B
4
G
2
Posts: 27
Reputation: 854

Post » Tue May 11, 2010 8:23 pm

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
Image Image
B
161
S
48
G
90
Posts: 7,347
Reputation: 66,749

Post » Thu May 13, 2010 12:03 pm

hi
thank you for your answers :).

[quote="vinnie":26uasvwe]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[/quote:26uasvwe]
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 ;) .

[quote="newt":26uasvwe]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.[/quote:26uasvwe]I 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[/quote:26uasvwe]I 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
B
2
S
1
G
2
Posts: 23
Reputation: 846


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 8 guests