User Tag List

Results 1 to 10 of 10

Thread: Help with detecting collision with multiple enemies

  1. #1
    Clicker 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)
    Unknowner's Avatar
    Join Date
    Oct 2011
    Posts
    92
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Help with detecting collision with multiple enemies

    Hi I really don't know why this isn't working, I have multiple enemys walking around the map with a detector, when player overlaps this detector enemy should stop his movement, when player doesn't overlap, enemy start moving again

    +("Enemy_radius") is overlapping player
    - Start loop for each one of ("enemy"), loop name collide

    +On each one of ("enemy"), loop name "collide"
    +("Enemy_radius") is overlapping player
    +ID ("enemy") = ForEachLoopIndex("enemy")
    -Stop


    +On each one of ("enemy"), loop name "collide"
    +("Enemy_radius") is overlapping player (NEGATED)
    +ID ("enemy") = ForEachLoopIndex("enemy")
    -Start

    Note: enemy_radius and enemy have a spread value and enemy_radius always follow his enemy with same ID

  2. #2
    Clicker Fusion 2.5Fusion 2.5 Mac
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Fusion 2.5+ DLC (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    zip2kx's Avatar
    Join Date
    Jun 2015
    Posts
    787
    Mentioned
    17 Post(s)
    Tagged
    0 Thread(s)
    Why do you check for the ForEachLoopIndex?

    If you spread the value can't you just check for ID enemy = ID radius object?

  3. #3
    Clicker 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)
    Unknowner's Avatar
    Join Date
    Oct 2011
    Posts
    92
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by zip2kx View Post
    Why do you check for the ForEachLoopIndex?

    If you spread the value can't you just check for ID enemy = ID radius object?
    what do u mean? seems like i "solved" the problem checking always the same object on all, replacing enemy for enemy_radius "solved" it but then I can't use enemy_radius overlaping the player

    How can I check for each enemy if some radius is overlaping player then stop enemy?

  4. #4
    Clicker Fusion 2.5

    Join Date
    Dec 2009
    Posts
    63
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Does each enemy have a radius object? If so, wouldn't it be easier if the player had the radius, then just check for enemies colliding with the player's radius?

  5. #5
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export Module
    Fusion 2.5 (Steam)
    schrodinger's Avatar
    Join Date
    Nov 2014
    Posts
    3,155
    Mentioned
    27 Post(s)
    Tagged
    1 Thread(s)
    In this event:

    +On each one of ("enemy"), loop name "collide"
    +("Enemy_radius") is overlapping player
    +ID ("enemy") = ForEachLoopIndex("enemy")
    -Stop


    you don't have a link between the enemy radius and the enemy

    you should add something like:

    +On each one of ("enemy"), loop name "collide"
    +enemy_radius_ID = enemy_ID
    +("Enemy_radius") is overlapping player
    +ID ("enemy") = ForEachLoopIndex("enemy")
    -Stop


    to pick the specific enemy radius bounded to the specific enemy you are cycling
    (and you don't need the line in red as zip2kx says)

  6. #6
    Clicker 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)
    Unknowner's Avatar
    Join Date
    Oct 2011
    Posts
    92
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Graeme2408 View Post
    Does each enemy have a radius object? If so, wouldn't it be easier if the player had the radius, then just check for enemies colliding with the player's radius?
    You are right with that problem is solved

    Quote Originally Posted by schrodinger View Post
    In this event:

    +On each one of ("enemy"), loop name "collide"
    +("Enemy_radius") is overlapping player
    +ID ("enemy") = ForEachLoopIndex("enemy")
    -Stop


    you don't have a link between the enemy radius and the enemy

    you should add something like:

    +On each one of ("enemy"), loop name "collide"
    +enemy_radius_ID = enemy_ID
    +("Enemy_radius") is overlapping player
    +ID ("enemy") = ForEachLoopIndex("enemy")
    -Stop


    to pick the specific enemy radius bounded to the specific enemy you are cycling
    (and you don't need the line in red as zip2kx says)
    Still not working I did the same before u told me and didn't work aswell, btw this seems interesting because I want be able to get childs of my enemy and compare them for example I'm trying to do something like that:

    Player enter on ("enemy_vision")
    Enemy look in direction of player

    but I don't know how to reference the enemy or the enemy_vision atached since compare id's its not working, how you do that?

    EDIT: i'm calling the loop on an always condition "Start loop for each enemy , loop name "collide"

  7. #7
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export Module
    Fusion 2.5 (Steam)
    schrodinger's Avatar
    Join Date
    Nov 2014
    Posts
    3,155
    Mentioned
    27 Post(s)
    Tagged
    1 Thread(s)
    This works but you have to setup things properly,
    hard to say without seeing your code

    See superquick example below:

    look_at_me.mfa

    (move player with arrow keys)

  8. #8
    Clicker 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)
    Unknowner's Avatar
    Join Date
    Oct 2011
    Posts
    92
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by schrodinger View Post
    This works but you have to setup things properly,
    hard to say without seeing your code

    See superquick example below:

    look_at_me.mfa

    (move player with arrow keys)
    well I tested your code and seems like you are using fixed values and I'm using spread values on always event, tryed to modify your code to make it work with spread values but doesn't work, shouldn't work with it?

  9. #9
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export Module
    Fusion 2.5 (Steam)
    schrodinger's Avatar
    Join Date
    Nov 2014
    Posts
    3,155
    Mentioned
    27 Post(s)
    Tagged
    1 Thread(s)
    Yes it's exactly the same,
    just a different system to assign a reference ID to an object

    See same example with spread value:
    look_at_me_spread.mfa


    You generally don't need to spread values "always",
    and this might cause issues with pairing when you destroy objects and create new ones,
    but this all depends on how you coded your game.

    Using Fixed values you have all IDs automatically managed by Fusion so you can relief from doing this double work

    If you can strip down your code to the relevant pairing issue you are experiencing,
    and upload here, we can take a look and hopefully fix it if you need

  10. #10
    Clicker 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)
    Unknowner's Avatar
    Join Date
    Oct 2011
    Posts
    92
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by schrodinger View Post
    Yes it's exactly the same,
    just a different system to assign a reference ID to an object

    See same example with spread value:
    look_at_me_spread.mfa


    You generally don't need to spread values "always",
    and this might cause issues with pairing when you destroy objects and create new ones,
    but this all depends on how you coded your game.

    Using Fixed values you have all IDs automatically managed by Fusion so you can relief from doing this double work

    If you can strip down your code to the relevant pairing issue you are experiencing,
    and upload here, we can take a look and hopefully fix it if you need
    Okay now I solved it, using fixed values seems more stable for destroying and creating new objects as you said, my problem was I didnt sort correctly my code and enemy_radius wasn't generating correctly, thanks for all the time bro!!

Similar Threads

  1. Detecting closest object between multiple objects
    By Psychoplasmics in forum Fusion 2.5
    Replies: 11
    Last Post: 20th September 2016, 05:27 PM
  2. Replies: 10
    Last Post: 17th August 2016, 04:17 PM
  3. Detecting multiple destroyed duplicated objects?
    By Konidias in forum Multimedia Fusion 2 - Technical Support
    Replies: 16
    Last Post: 28th December 2010, 09:34 PM
  4. Detecting the point of collision
    By Red_Giant in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 20th July 2009, 09:32 PM
  5. thrown enemies not detecting other enemies
    By mobichan in forum File Archive
    Replies: 4
    Last Post: 8th April 2009, 07:40 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
  •