0 Favourites

how to disable an event for 4 seconds on trigger

  • 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

    [attachment=1:13nln60r][/attachment:13nln60r]

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

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

  • 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?

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • 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

  • 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?

    [attachment=0:hs2w8do8][/attachment:hs2w8do8]

  • 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

  • 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!

  • 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.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread hot topic Locked topic
198 18,650
Tom's avatar
Tom Construct Team Founder
Unread hot topic
98 7,590
norum82's avatar
norum82
Unread hot topic
74 4,512
Dalal's avatar
Dalal