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
24
S
3
Posts: 462
Reputation: 2,207

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
366
S
217
G
82
Posts: 23,248
Reputation: 183,494

Post » Mon Mar 09, 2015 7:54 pm

@ashley - perfect. thank you!
B
24
S
3
Posts: 462
Reputation: 2,207

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
33
S
8
G
1
Posts: 679
Reputation: 3,480

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
63
S
16
G
63
Posts: 2,170
Reputation: 39,985

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
24
S
3
Posts: 462
Reputation: 2,207

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
366
S
217
G
82
Posts: 23,248
Reputation: 183,494

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
33
S
8
G
1
Posts: 679
Reputation: 3,480


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 2 guests