Pin vs Every Tick

Discussion and feedback on Construct 2

Post » Mon May 07, 2012 2:00 pm

In your case is better to set the position of the shadow every tick. If your levels are flat you just need to set the X position of the shadow to the X of the characters (Y is constant).

And don't worry about performance with 'every tick', it's as light as most other events. The main thing you need to care in terms of event sheet performance is loops.
Scirra Employee
B
129
S
45
G
15
Posts: 705
Reputation: 15,413

Post » Mon May 07, 2012 2:47 pm

@ModalCore, your case sounds like one where performance is irrelevant. As this thread shows, people often ask "which is faster, A or B?" and the answer is usually "neither, you will not be able to measure any difference in framerate at all whichever you use, so just use whichever works or whichever is easiest to set up". You could spend hours tuning all your events and not get any performance benefit. Everything which matters is in the manual entry Performance Tips, anything not in there is pretty much negligable!
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,580

Post » Mon May 07, 2012 10:52 pm

People... 'every tick' is THE most useful event... Don't get confused and start not using it!
B
90
S
30
G
24
Posts: 3,189
Reputation: 32,400

Post » Tue May 08, 2012 12:24 am

Lmao sqiddster :D
B
40
S
11
G
4
Posts: 665
Reputation: 8,403

Post » Wed May 09, 2012 8:51 pm

I use "pin" behaviour in my game (jigsaw puzzle) to move automatically 24 shadows behind 24 sprites (drag & drop "moving together" effect without any X/Y management).

The real benefit for me is to keep body line code and "on every tick" sub code for game's logic and conditionnal behaviours. If the pin effect is constant, no need to overload body code and "on every tick events" more than needed !.
B
16
S
5
G
3
Posts: 298
Reputation: 5,240

Post » Tue Jun 26, 2012 9:56 am

[QUOTE=naelian] If the pin effect is constant, no need to overload body code and "on every tick events" more than needed !.[/QUOTE]

In my case, the shadow is pinned to a character that can move 8 ways and jump (like "Double Dragon", "Streets of Rage", "TNMT" etc.)

When the player (or any other mob) jumps, I used to unpin the shadow, move the mob up a bit, shrink the shadow and repin it. Worked fine until I tried jumping and changing the direction mid-jump (I'm not sure whether I'll deactivate this) and the shadow got out of sync.

This is why I created a shadow function that moves the shadow of each mob according to the mobs X/Y (collission sprite) as well as Z value (animated sprite). By seperating shadow calculation and jump function I can implement in-jump movements easier (double jump, interceptions and collisions, in-jump attacks) but bloat my code a bit more.

I'm running out of events soon and don't have the allowance (of my better half) to spend money on this pet project of mine. She said I should build something like Bejewled or a BubbleShooter...
Maybe I'll start an IndiGoGo Project or something to gather the money for some better artworks, sprites and a license to keep going.
B
4
Posts: 19
Reputation: 363

Previous

Return to Construct 2 General

Who is online

Users browsing this forum: Colludium and 2 guests