About Every Tick

Get help using Construct 2

Post » Mon Aug 11, 2014 8:51 pm

Hi, i have a question regarding Every Tick.

I have read in the "How events work" section that: "Every event is checked once per tick (about 60 times a second on most computers), and they are run from top to bottom in the event sheet.

Before and after, i read it, i was using "Every Tick" this way:

Screenshot 2014-08-11 17.47.28.png


I think that to compare two values or make collision happens, i need the every tick, for what i understand, its not need it right?
But in cases that i need to display score, or something like that, it is useful the "Every Tick"

I dont fully understand the purpose of Every Tick after reading the how events work, can someone help me to understand, i know its an easy question, sorry.
You do not have the required permissions to view the files attached to this post.
B
9
S
2
Posts: 52
Reputation: 1,360

Post » Mon Aug 11, 2014 8:58 pm

It can get quite confusing, the logic in your head is right.
The point is that events in Construct (conditions) already are checked everytick, so you don't need to add that block (it's already hidden in there).

An example of usage for everytick would be moving a sprite do the right, you can use
On Every Tick > Sprite set X to Sprite.X+1

this way the sprite will move 1 pixel to the right every frame.
Please tag me with @caiorosisca if your post is refering to me :). I don't always follow the topics I answer.
B
11
S
4
G
1
Posts: 272
Reputation: 1,643

Post » Mon Aug 11, 2014 9:17 pm

Tx Caio @caiorosisca for the reply! I really appreciate. I have another question now that i have that concept more clear.

its the same to say:
On Every Tick > Sprite set X to Sprite.X+1

to:
If 0 = 0 > Sprite set X to Sprite.X+1

I mean, the events are checked everytick by default, if i make a condition always true, its the same as saying "On every tick" ?

cheers!
B
9
S
2
Posts: 52
Reputation: 1,360

Post » Mon Aug 11, 2014 9:28 pm

every event condition is considered every tick, hence 1+2 is functionally equivalent to 3 in your diagram, irrespective of your subsequenct use of the event trigger. I don't see why collisions or score displays would change this.

you should be able to test this very easily by writing the code to display something.. perhaps incrementing text in two text boxes, one driven by each event structure.

I would ask why you need to update the score every 15 milliseconds though? personally I update scores perhaps 1 per second, or 5 times per second, or on an action. it just keeps the load on the system down.


PS: to your second question, yes that would move the sprite one pixel every tick.. just remember that ticks are not precisely regular so if you are depending on them... they could change if the game logic gets busier. if would be better imho to stick with every XX seconds... instead.
B
7
S
3
G
1
Posts: 184
Reputation: 1,352

Post » Mon Aug 11, 2014 9:40 pm

The 'every tick' event is just a dummy/placeholder to remind you that it is executed every tick. You need this where you don't have another event/condition on which to hang your actions. You can just as well leave it completely blank. Or, have a 'dummy' condition as you described, but that might look silly (but that's subjective).
Last edited by codah on Mon Aug 11, 2014 10:20 pm, edited 2 times in total.
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596

Post » Mon Aug 11, 2014 9:41 pm

tx @rho!,

I would ask why you need to update the score every 15 milliseconds though? > Actually im not, but im trying to learn from some capx i donwloaded from the site, and those are questions that i have looking at the events sheet, tryiing to understand how are they making things happend!

Cheers, and tx for the replys!
B
9
S
2
Posts: 52
Reputation: 1,360

Post » Mon Aug 11, 2014 9:50 pm

Scirra Founder
B
398
S
236
G
88
Posts: 24,441
Reputation: 194,671

Post » Mon Aug 11, 2014 10:45 pm

Tx, i will read it
B
9
S
2
Posts: 52
Reputation: 1,360


Return to How do I....?

Who is online

Users browsing this forum: IGDev and 20 guests