Tick after events, before draw

For developers using the Construct 2 Javascript SDK

Post » Sun Mar 23, 2014 9:52 pm

If I recall correctly, Construct Classic allowed plugins to have two tick methods - one called before processing events, and another called after processing events but before drawing - which allowed plugins to account for changes to objects arising from events processed before the frame was rendered. Is there anything similar in Construct 2?

I feel I should mention that my plugin - MagiCam, specifically - is not drawn, so running my tick logic in the draw method is out of the question.
Moderator
B
113
S
41
G
20
Posts: 1,586
Reputation: 19,116

Post » Sun Mar 23, 2014 10:10 pm

Look in the pin behavior. At least I think that's the behavior that does it, there are others. The function was called tick2() but now it's called posttick or something like that. The function is usually right after the tick function.
B
92
S
32
G
106
Posts: 5,272
Reputation: 69,455

Post » Sun Mar 23, 2014 10:14 pm

Yeah, I just found that, but it appears to work differently for plugins and behaviors. Plugins call it tick2 and you need to call runtime.tick2Me(), whereas behaviors call it posttick and it gets called automatically.

Thanks.
Moderator
B
113
S
41
G
20
Posts: 1,586
Reputation: 19,116

Post » Thu Jan 15, 2015 7:52 pm

Hey, Is this still the case? I was looking in the "scroll to" behavior and found found that it uses tick2 and not posttick? Am I missing something?
Image
B
33
S
11
G
2
Posts: 564
Reputation: 5,153

Post » Fri Jan 16, 2015 2:27 pm

Check preview.js to see the exact difference.

Search for tick2() posttick() etc and youll find where/when theyre called
B
77
S
13
G
8
Posts: 1,973
Reputation: 9,891


Return to Javascript SDK

Who is online

Users browsing this forum: No registered users and 0 guests