Pin vs Every Tick

Discussion and feedback on Construct 2

Post » Sun May 06, 2012 2:06 am

For my Custom Mouse, what is faster?

(I am going to need to Pin or Move_To several objects at once)
B
40
S
11
G
4
Posts: 665
Reputation: 8,403

Post » Sun May 06, 2012 3:40 am

It really is exactly the same.
Whatever floats your boat ;)
B
90
S
30
G
24
Posts: 3,189
Reputation: 32,400

Post » Sun May 06, 2012 3:44 am

Neither. Use whichever is most convenient.
Scirra Founder
B
359
S
214
G
72
Posts: 22,949
Reputation: 178,574

Post » Sun May 06, 2012 3:57 am

Ok :)
I am sorry to ask so many questions.. but it is 5 AM and i am OBSESSED with working at my game !
B
40
S
11
G
4
Posts: 665
Reputation: 8,403

Post » Mon May 07, 2012 9:13 am

I'm interested in this as well.
I'm working on a "pseudo" iso 8way platformer with "jumpable" things and a z attribute for mobs that jump or fly.

All my mobs (player and enemy) consist of:
- an invisible collision/movement sprite
- a shadow sprite
- a player sprite for animations
- an effect sprite (emoticons for sleep, anger, talking etc.)
- (optional) a health bar sprite


When the player jumps, I increase his z-value, unpin him, move the animation sprite up to his z-value and repin him. Meanwhile I shrunk the shadow sprite while he's in the air.

Worked perfect until I started smashing the buttons/keys and had him move around while jumping. Then there where moments, when his animation sprite and his shadow and collision sprite lost their relative positions because while unpinned, other movement events changed the position of the collision sprite but didn't update the position of the animation sprite.

This could not happen if I maintain all sprite positions based on "every tick", the position of the collision sprite and sprite variables like z. Is it better to replace the existing PIN behavior with events that update the position every tick? I thought that with more mobs on screen PIN might be better performance wise...

B
4
Posts: 19
Reputation: 363

Post » Mon May 07, 2012 9:22 am

Ive heard Every Tick is kinda useless, since Construc2 runs from Up to Down every tick So its more a "function" to run several things in the right order with sub events etc.
B
40
S
11
G
4
Posts: 665
Reputation: 8,403

Post » Mon May 07, 2012 9:23 am

It's pretty much "Always"
B
62
S
21
G
12
Posts: 1,910
Reputation: 13,155

Post » Mon May 07, 2012 9:24 am

Yeah :) That was a good way to put it
B
40
S
11
G
4
Posts: 665
Reputation: 8,403

Post » Mon May 07, 2012 9:54 am

I'm not sure I get what you mean.

Useless as in "shouldn't be used"? Allways do x, then y, then z is more or less what I thought it would do. That's why I had concerns about the performance when doing all those actions for "5*number of mobs" sprites + lots of other things "every allways" compared to a pin behavior.
B
4
Posts: 19
Reputation: 363

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

Next

Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 14 guests