User Tag List

Page 1 of 2 1 2 LastLast
Results 1 to 10 of 11

Thread: Detecting Collisions Once Per Object

  1. #1
    Clicker Multimedia Fusion 2 DeveloperiOS Export Module

    Join Date
    May 2011
    Location
    Pennsylvania, USA
    Posts
    25
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Detecting Collisions Once Per Object

    Ok, so the game I'm working on is of the tower defense genre. I have turrets that are shooting mortars at the line of enemies. Once the mortars hit the map, an explosion animation plays and the enemies can take damage by passing over the animation. I'm checking against collision between the enemies and the mortar explosion animation to subtract damage from the health of the enemies. However, I don't want the damage to apply more than once to the same enemy when it passes over the explosion animation. I tried using "Only one action when event loops" limit condition to stop the health subtraction from happening every tick of game loop, however, when I have multiple explosion animation happening and two DIFFERENT enemies passing over the SEPARATE explosion animations, NO health is subtracted from EITHER enemy. Does anyone know of a solution to help tackle this problem? Do I need to keep track of whether a particular enemy already passed over a specific explosion and limit the action that way, or is there a simpler way? Also, the explosion animation plays for a long duration, such that multiple enemies can pass over the same explosion and each take damage, so it's not as simple as stopping/destroying the animation as soon as an enemy passes over it.

    Thanks!

  2. #2
    No Products Registered

    Join Date
    Apr 2013
    Posts
    68
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Are you testing for collision or overlap? Testing for collision should do it the way you want.

  3. #3
    Clicker Multimedia Fusion 2 DeveloperiOS Export Module

    Join Date
    May 2011
    Location
    Pennsylvania, USA
    Posts
    25
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I tried it both ways to be sure, neither seemed to do the trick.

    *Always
    +Collision between Mortar and Enemy

    will make it so it triggers the damage on every step of the game loop, and imperceptibly the enemy is destroyed immediately (even though it is really like 3 game ticks)

    When I change to:

    *Always
    +Only one action when event loops
    +Collision between Mortar and Enemy

    It looks like it works at first, but when there are two different mortar animations occurring at the same time, and 2 different enemies simultaneously pass through their respective mortar explosions, they act like mutually exclusive locks and block either from registering damage.

  4. #4
    No Products Registered

    Join Date
    Apr 2013
    Posts
    68
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Remove the "Always" from conditions. It's unnecessary.

  5. #5
    Clicker Multimedia Fusion 2 DeveloperiOS Export Module

    Join Date
    May 2011
    Location
    Pennsylvania, USA
    Posts
    25
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Not to get off topic, does it add execution cycles to the runtime?

  6. #6
    No Products Registered

    Join Date
    Apr 2013
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Check if the explosion's animation frame is between 1 and 2. This will make first impact deal damage only.

  7. #7
    Forum Moderator Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleSWF Export ModuleXNA Export Module
    ProdigyX's Avatar
    Join Date
    Jan 2011
    Posts
    1,197
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Any red event SHOULD be on top.

    Collision Events are red.

    Therefore any collision event should be on top.

  8. #8
    Clickteam Clickteam
    Danny's Avatar
    Join Date
    Aug 2007
    Location
    United Kingdom
    Posts
    3,016
    Mentioned
    21 Post(s)
    Tagged
    2 Thread(s)
    Quote Originally Posted by PushTheLimit View Post
    Not to get off topic, does it add execution cycles to the runtime?
    Depends, but in this instance, red events are immediate events so the runtime 'looks out' for these kind of red events (ie: collision detection/fastloops) and it will execute them as a priority over normal conditions... in your example there is no need for 'always' as the collision event will trigger the very split second it happens...
    Want to learn Clickteam Fusion 2.5?




  9. #9
    Clicker Fusion 2.5 MacFusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleXNA Export Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    gkinfinity's Avatar
    Join Date
    May 2011
    Location
    USA
    Posts
    284
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by RedRookLord View Post
    Check if the explosion's animation frame is between 1 and 2. This will make first impact deal damage only.
    This will only work if if it's overlapping the explosion during it's 1st or 2nd frame though. What if the explosion animation size starts off small and grows (as many explosion animations probably would)? An object that overlaps the explosion on frame 3 wouldn't detect the collision at all

  10. #10
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleiOS Export ModuleSWF Export ModuleXNA Export Module

    Join Date
    Jun 2006
    Location
    UK
    Posts
    519
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Do
    + Explosion is overlapping Enemy (not colliding, overlapping)
    + Enemy Internal Flag 0 is off (or whatever flag you like)
    - Set enemy Flag 0 on
    - Take Damage

    then a second event

    + NEGATE Explosion is overlapping enemy
    - Set enemy flag 0 off

    Should work I think

Page 1 of 2 1 2 LastLast

Similar Threads

  1. Detecting Nearest object?
    By PandaExplosion in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 27th July 2011, 03:37 PM
  2. Detecting when an object is 'destroyed' problem...
    By rhodestown in forum Multimedia Fusion 2 - Technical Support
    Replies: 5
    Last Post: 20th December 2008, 09:53 PM
  3. Detecting Closing of File Object Selector
    By drnebula in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 28th March 2007, 07:15 PM
  4. Detecting object in an area one by one
    By elautor in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 25th February 2007, 02:43 PM
  5. Detecting collisions without the objects colliding
    By Mantoid in forum Multimedia Fusion 2 - Technical Support
    Replies: 9
    Last Post: 18th November 2006, 09:28 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •