how to disable an event for 4 seconds on trigger

Get help using Construct 2

Post » Thu May 01, 2014 8:17 am

the title is a bit broad. so basically what i want to do is make it so that whenever a red dot is created, the events (the ones in the picture) don't come into play til 4 seconds later. this can be easily done with groups but the problem is that i only want it to happen to newly spawned red dots
help.JPG
You do not have the required permissions to view the files attached to this post.
Last edited by notalkingplz on Thu May 01, 2014 8:32 am, edited 2 times in total.
B
5
Posts: 26
Reputation: 283

Post » Thu May 01, 2014 8:23 am

Wait 4 seconds. It's in the System object.

...That's what you meant, right?
HARMLESS SIGNATURE THAT IS VIEWED BY OTHERS AS OFFENSIVE AND CONTROVERSIAL
B
14
S
3
G
3
Posts: 356
Reputation: 4,377

Post » Thu May 01, 2014 8:33 am

fassFlash wrote:Wait 4 seconds. It's in the System object.

...That's what you meant, right?


yeah but how would you utilize that in my situation?
B
5
Posts: 26
Reputation: 283

Post » Thu May 01, 2014 10:29 am

give red dot an instance variable like vulnarable=false
after you spawn that object put wait 4 seconds action and after that set that variable to true.
only do actions if its variable is true

use the one below if your game glitches, dont remember the object and make all of the red dots instance variable's true

give red dot an instance variable like 4.
every 1 second of game time pick all red dots and reduce their instance varibale by 1 if its not already 0
do actions with red dots only if their instance variable is equal to 0

however you will see from the attached file (just draw something and wait) it perfectly remembers the last created object
You do not have the required permissions to view the files attached to this post.
Truth shall be your freedom...
B
14
S
2
G
1
Posts: 45
Reputation: 930

Post » Thu May 01, 2014 2:18 pm

Aleq wrote:give red dot an instance variable like vulnarable=false
after you spawn that object put wait 4 seconds action and after that set that variable to true.
only do actions if its variable is true

use the one below if your game glitches, dont remember the object and make all of the red dots instance variable's true

give red dot an instance variable like 4.
every 1 second of game time pick all red dots and reduce their instance varibale by 1 if its not already 0
do actions with red dots only if their instance variable is equal to 0

however you will see from the attached file (just draw something and wait) it perfectly remembers the last created object


so this is what i've done. do you reckon it's efficient? is there any way i can change it to make it more efficient?
game.JPG
You do not have the required permissions to view the files attached to this post.
B
5
Posts: 26
Reputation: 283

Post » Thu May 01, 2014 2:59 pm

if you mean less actions and conditions for efficiency i have another idea.
Forget about the instance variables. Just turn off red dots collision on default and turn their collision on after 4 seconds. U need to remove your "overlapping" conditions in this case. I still dont understand why do u need "overlapping" anyway. Collision also means objects has been overlapped already.
I think it would be better couse less actions/conditions means more efficient game running.

However im not an expert on C2 performance issues. So i dont know it very well if it is better to playing with collision instead of using instance variables. But less coding for sure.

But in normal cases one of the most performance killer ting is checking collisions on each update tick on games. if there are alot of items to check collisions ur game has lesser performance. With this style ur sprites at lest will not have any collision checking for 4 seconds lol
Truth shall be your freedom...
B
14
S
2
G
1
Posts: 45
Reputation: 930

Post » Thu May 01, 2014 4:05 pm

Aleq wrote:if you mean less actions and conditions for efficiency i have another idea.
Forget about the instance variables. Just turn off red dots collision on default and turn their collision on after 4 seconds. U need to remove your "overlapping" conditions in this case. I still dont understand why do u need "overlapping" anyway. Collision also means objects has been overlapped already.
I think it would be better couse less actions/conditions means more efficient game running.

However im not an expert on C2 performance issues. So i dont know it very well if it is better to playing with collision instead of using instance variables. But less coding for sure.

But in normal cases one of the most performance killer ting is checking collisions on each update tick on games. if there are alot of items to check collisions ur game has lesser performance. With this style ur sprites at lest will not have any collision checking for 4 seconds lol


there was one time while testing the game, the red dot and blue dot overlapped but nothing happened, that's why i put overlapping in it. i tested it again and it works fine now so i removed it. thanks for all the help and tips!
B
5
Posts: 26
Reputation: 283

Post » Thu May 01, 2014 8:21 pm

np.

if collision event doesn't fired properly it means one of your objects is going too fast relative to its size. actually they dont go any where you change its place on every tick of the game like making a cartoon. if your objects speed is too fast that means it teleports more than the size of the object it should collide on each tick. so you have to balance the sizes and speed of your objects.

even if you see them overlapping eachother and no collision happens thats worse couse game runs 2 seperate loops one is calculation other is drawing. that means calculation runs slower than drawing. which should be opposite. you have to improove your performance

dont afraid to increase their sizes. everything is too small already when u think about mobile devices.
Truth shall be your freedom...
B
14
S
2
G
1
Posts: 45
Reputation: 930


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 19 guests