User Tag List

Results 1 to 6 of 6

Thread: Auto Targeting An Enemy From Above

  1. #1
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleiOS Export Module
    Megabeard's Avatar
    Join Date
    Sep 2015
    Posts
    40
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Auto Targeting An Enemy From Above

    Hey all,

    I had a game mechanic in mind that I can't quite wrap my head around in terms of the programming and I was hoping someone could help me out.

    In my game, you are dropping bombs while sidescrolling above onto enemies down below. One of the power ups I wanted to make available to players allows the bomb to drop, and then hit the nearest available target. However, since there are multiple enemies on the ground that are constantly moving, I'm struggling to make the bomb hit anything specifically, and it ends up moving in one random direction. I would like it to detect, move to, and hit the closest by enemy on the ground.

    Any ideas on how I could go about doing this? Normally I'd post my MFA, but it's a bit of a mess right now. I can create a mock up if anyone needs a better idea of what I mean, but any help is appreciated on my end!

  2. #2
    Clicker Fusion 2.5 DeveloperiOS Export ModuleSWF Export Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)
    Sumo's Avatar
    Join Date
    Jul 2008
    Posts
    642
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Auto Targeting An Enemy From Above

    I would group all of the enemies in a qualifier. Qualifiers let you test the entire group for certain conditions. So after you put your enemies in the "enemy" qualifier for example, you can use the distance equation/expression to test for the distances between the bomb and the enemies. Im not sure if there's an condition or expression for choosing the closest enemy since I'm not at my computer right now, but that's the general idea that's in my head at the moment. I feel like there's a similar condition for "choosing an object". I can look into it soon if you still need help.

  3. #3
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export Module
    UltimateWalrus's Avatar
    Join Date
    Jul 2006
    Posts
    824
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Example of finding the nearest object attached.
    Attached files Attached files

  4. #4
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleiOS Export Module
    Megabeard's Avatar
    Join Date
    Sep 2015
    Posts
    40
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you both for the responses, but I am still struggling. It may be that I am not executing the movement of the bomb itself correctly, but using the code you came up with UltimateWalrus, I get similar results to before. Except this time, the bomb always moves to the right. I have created a mock up of my issue if either of you guys are willing to take a quick look.

    Interestingly enough, for some reason, my mock up acts a bit different in that the movements are ignored completely. Maybe due to my use of qualifiers?
    Attached files Attached files

  5. #5
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export Module
    UltimateWalrus's Avatar
    Join Date
    Jul 2006
    Posts
    824
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You didn't change my code to make it use your object, so of course it's not going to work :] Fixed version attached
    Attached files Attached files

  6. #6
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleiOS Export Module
    Megabeard's Avatar
    Join Date
    Sep 2015
    Posts
    40
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    D'oh! That explains it haha. Thank you for all the help UltimateWalrus! It's working great now.

Similar Threads

  1. Replies: 5
    Last Post: 4th October 2014, 04:43 PM
  2. Targeting iphone 5 and the last version of iPad /ipad mini
    By Decoamorim in forum iOS Export Module 2.5
    Replies: 5
    Last Post: 30th March 2014, 03:31 PM
  3. Strange thing: If Enemy Alterable Value A = Enemy Alterable Value B
    By King_Cool in forum Multimedia Fusion 2 - Technical Support
    Replies: 11
    Last Post: 26th March 2012, 05:29 PM
  4. targeting a particular program
    By NathanGlover in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 30th October 2007, 01:03 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
  •