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
27
S
5
Posts: 472
Reputation: 2,502

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
378
S
219
G
84
Posts: 23,863
Reputation: 187,909

Post » Mon Mar 09, 2015 7:54 pm

@ashley - perfect. thank you!
B
27
S
5
Posts: 472
Reputation: 2,502

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
38
S
11
G
4
Posts: 712
Reputation: 5,471

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.
B
68
S
17
G
65
Posts: 2,182
Reputation: 41,304

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
27
S
5
Posts: 472
Reputation: 2,502

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
378
S
219
G
84
Posts: 23,863
Reputation: 187,909

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
38
S
11
G
4
Posts: 712
Reputation: 5,471


Return to Construct 2 General

Who is online

Users browsing this forum: piranha305 and 10 guests