Every X Seconds with Collision Cells?

Discussion and feedback on Construct 2

Post » Mon Mar 09, 2015 4:17 am

If you put:

every x seconds
enemy is overlapping player

Will it use the collision cells even though it's not the top event? If not, how would one do a "check overlapping" less often than every tick while using collision cells?
B
40
S
12
G
1
Posts: 532
Reputation: 4,147

Post » Mon Mar 09, 2015 11:01 am

Yes, it will use collision cells. The collision condition only needs to be the first condition in the event referring to those object types. "Every X seconds" is a system condition so does not refer to any object types. If you had a condition before it picking any "enemy" or "player" instances, that would force it to skip collision cells.
Scirra Founder
B
395
S
233
G
88
Posts: 24,376
Reputation: 193,842

Post » Mon Mar 09, 2015 7:54 pm

@ashley - perfect. thank you!
B
40
S
12
G
1
Posts: 532
Reputation: 4,147

Post » Tue Mar 10, 2015 3:03 pm

Ashley wrote:Yes, it will use collision cells. The collision condition only needs to be the first condition in the event referring to those object types. "Every X seconds" is a system condition so does not refer to any object types. If you had a condition before it picking any "enemy" or "player" instances, that would force it to skip collision cells.


is that mean to make the event like that ?

is overlapping object
every X seconds

or

every X seconds
is overlapping object

?
B
45
S
16
G
8
Posts: 792
Reputation: 8,306

Post » Tue Mar 10, 2015 3:15 pm

@matrixreal, you can use lots of different types of pre-conditions providing none of them involve objects that comprise the subsequent collision check. Every x seconds, a Variable equals, and so on.
A big fan of JavaScript.
B
74
S
20
G
69
Posts: 2,215
Reputation: 43,852

Post » Tue Mar 10, 2015 6:56 pm

@matrixreal - the second one - the first one checks every tick if its overlapping and only does the actions every x seconds, where as the 2nd one checks is overlapping every x seconds.
B
40
S
12
G
1
Posts: 532
Reputation: 4,147

Post » Wed Mar 11, 2015 12:31 pm

@matrixreal - both ways use collision cells, but it is faster to check "Every X seconds" first. Then it only does the collision check on the timer. If you check the collision then have "Every X seconds", it will wastefully check the collision every tick, and ignore the result every tick apart from the times "Every X seconds" is true.
Scirra Founder
B
395
S
233
G
88
Posts: 24,376
Reputation: 193,842

Post » Thu Mar 12, 2015 2:49 pm

wow its amazing thanks ashley for confirm that

my result with "every 0.1 seconds + is overlap " instead of "is overlap" alone are

fsp : 55 instead of 49
cpu usage : 17% instead of 28%
collisions checks : 110 intead of 450

its clearly different and i see that we earn a huge performances
B
45
S
16
G
8
Posts: 792
Reputation: 8,306


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 12 guests