destroy object?

For developers using the Construct 2 Javascript SDK

Post » Tue Jan 17, 2012 11:14 am

Can plugins destory objects at runtime? If yes, how?

Couldn't find anything in the manual. It appears any object with type set to world automatically gets a destroy action, and when it is called onDestroy() is triggered, but I can't figure out how to destroy it from within JS.
B
22
S
9
G
5
Posts: 122
Reputation: 5,386

Post » Tue Jan 17, 2012 11:20 am

jQuery(element).remove();
B
44
S
12
G
13
Posts: 628
Reputation: 10,471

Post » Tue Jan 17, 2012 1:55 pm

@septeven, that won't work, it's only for modifying the DOM via jQuery and Construct 2 objects aren't in the DOM.

Use runtime.DestroyInstance(inst).
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,600

Post » Tue Jan 17, 2012 4:10 pm

my mistake ;)
B
44
S
12
G
13
Posts: 628
Reputation: 10,471


Return to Javascript SDK

Who is online

Users browsing this forum: No registered users and 1 guest