User Tag List

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

Thread: Mass homing shots and enemies

  1. #1
    Clicker Fusion 2.5iOS Export ModuleInstall Creator Pro
    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)

    Join Date
    Aug 2012
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Mass homing shots and enemies

    I assume this is in the right place.

    In my project I'm using various different shot types, some of which I want to be able to home in on enemies should they get within a certain range.

    I've tried many different ways to make this work and the best I can do only ever seems to check the shot against the most recently created enemy.

    I need a way to compare the distance of each and every shot to each and every enemy, so that the shot doesn't just fly past every enemy to hit the last one and I need it to only start homing in if it is within range.

    I already have a way to make the shot turn smoothly but right now I'm just trying to make it target the appropriate enemy.

    TheHellICantCrack.jpg

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

    Mass homing shots and enemies

    Maybe try grouping your enemies in a qualifier group. Then using compare two general values, use the distance equation to test the missiles distance from the qualifier group within a certain pixel range?


    Sent from my iPhone using Tapatalk

  3. #3
    Clickteam Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform Export ModuleInstall Creator Pro
    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)
    BartekB's Avatar
    Join Date
    Aug 2013
    Posts
    622
    Mentioned
    12 Post(s)
    Tagged
    0 Thread(s)
    Use a for each loop for this, with the following code:

    -> Always
    ---->> For each object of ("Bullet") named "loop"

    -> On foreach loop named "loop" for ("Bullet")
    ---->> Set internal flag 0 on
    ---->> MaxDistance to 500
    ---->> TargetFixed to 0
    ---->> For each object of ("Enemy") named "check_distance"
    ---->> Set internal flag 0 off

    -> On foreach loop named "check_distance" for ("Enemy")
    -> + Bullet's flag 0 is on
    -> + Bullet's MaxDistance > Sqr( (xBullet-xEnemy) pow 2 + (yBullet-yEnemy) pow 2 )
    ---->> TargetFixed to Enemy Fixed Value
    ---->> Max Distance to Sqr( (xBullet-xEnemy) pow 2 + (yBullet-yEnemy) pow 2 )

    -> On foreach loop named "loop" for ("Bullet")
    -> + Bullet's TargetFixed <> 0
    -> + Compare Bullet's TargetFixed to Enemy's Fixed Value
    ---->> Homing to target code

    This code can be slightly altered if you'd like the bullet to home into the first target it encounters (Doesn't change targets)
    The performance of this code depends on the amount of Bullets and Enemies they are on the frame.
    - BartekB, a.k.a Uppernate
    Join the Click Converse Discord! - https://discord.gg/7RNXFrC
    Dungeon Raiders! - Link soon™

  4. #4
    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)
    I have something like this in my game and actually i just selected that it should Look at the Enemy qualifier, it automatically selects the nearest active object then.

  5. #5
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform 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)Universal Windows Platform Export Module (Steam)
    DaveC's Avatar
    Join Date
    Jun 2007
    Location
    Perth, Australia
    Posts
    2,117
    Mentioned
    13 Post(s)
    Tagged
    0 Thread(s)

  6. #6
    Clicker Fusion 2.5iOS Export ModuleInstall Creator Pro
    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)

    Join Date
    Aug 2012
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Sumo View Post
    Maybe try grouping your enemies in a qualifier group. Then using compare two general values, use the distance equation to test the missiles distance from the qualifier group within a certain pixel range?
    Already using qualifiers and I've tried the distance equation, it only checks against the youngest enemy object, this was what i first tried.

  7. #7
    Clicker Fusion 2.5iOS Export ModuleInstall Creator Pro
    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)

    Join Date
    Aug 2012
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by BartekB View Post
    Use a for each loop for this, with the following code:

    -> Always
    ---->> For each object of ("Bullet") named "loop"

    -> On foreach loop named "loop" for ("Bullet")
    ---->> Set internal flag 0 on
    ---->> MaxDistance to 500
    ---->> TargetFixed to 0
    ---->> For each object of ("Enemy") named "check_distance"
    ---->> Set internal flag 0 off

    -> On foreach loop named "check_distance" for ("Enemy")
    -> + Bullet's flag 0 is on
    -> + Bullet's MaxDistance > Sqr( (xBullet-xEnemy) pow 2 + (yBullet-yEnemy) pow 2 )
    ---->> TargetFixed to Enemy Fixed Value
    ---->> Max Distance to Sqr( (xBullet-xEnemy) pow 2 + (yBullet-yEnemy) pow 2 )

    -> On foreach loop named "loop" for ("Bullet")
    -> + Bullet's TargetFixed <> 0
    -> + Compare Bullet's TargetFixed to Enemy's Fixed Value
    ---->> Homing to target code

    This code can be slightly altered if you'd like the bullet to home into the first target it encounters (Doesn't change targets)
    The performance of this code depends on the amount of Bullets and Enemies they are on the frame.
    and

    Similar ideas, both produce the same fault, it only checks against the youngest enemy object

    Quote Originally Posted by zip2kx View Post
    I have something like this in my game and actually i just selected that it should Look at the Enemy qualifier, it automatically selects the nearest active object then.
    I need the homing to activate only within a certain range unique to each shot type, nothing in your idea helps at all.

  8. #8
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform 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)Universal Windows Platform Export Module (Steam)
    DaveC's Avatar
    Join Date
    Jun 2007
    Location
    Perth, Australia
    Posts
    2,117
    Mentioned
    13 Post(s)
    Tagged
    0 Thread(s)
    what do you mean youngest enemy? It would be easy to adapt to make the missiles only move towards a target if they're in given a range from the target... besides that... each individual rocket always targets the nearest enemy regardless of what order the enemies were created etc.

  9. #9
    Clicker Fusion 2.5iOS Export ModuleInstall Creator Pro
    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)

    Join Date
    Aug 2012
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by DaveC View Post
    what do you mean youngest enemy? It would be easy to adapt to make the missiles only move towards a target if they're in given a range from the target... besides that... each individual rocket always targets the nearest enemy regardless of what order the enemies were created etc.
    Well for some reason I can't figure out it only seems to check against the most recently created enemy, that is the main problem I'm trying to figure out, how to make it check distance and other factors against enemy qualified objects regardless of order.

    No matter what I try it only ever seems to run this check against the youngest enemy.
    I don't know why.
    I want to find a way to fix that.

  10. #10
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform 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)Universal Windows Platform Export Module (Steam)
    DaveC's Avatar
    Join Date
    Jun 2007
    Location
    Perth, Australia
    Posts
    2,117
    Mentioned
    13 Post(s)
    Tagged
    0 Thread(s)
    Your code in the attached screen won't work because you're not cycling through each target and each missile.. but are you saying the example I posted doesn't work? because it definitely does..

Page 1 of 2 1 2 LastLast

Similar Threads

  1. Mass Graphics Loader
    By gondracorn in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 7th June 2014, 10:12 PM
  2. thrown enemies not detecting other enemies
    By mobichan in forum File Archive
    Replies: 4
    Last Post: 8th April 2009, 07:40 PM
  3. Creating a myspace mass bot using MMF, need help..
    By MikeB in forum Multimedia Fusion 2 - Technical Support
    Replies: 10
    Last Post: 23rd August 2008, 06:04 AM
  4. Mass movement of hot spots?
    By Shroomlock in forum Multimedia Fusion 2 - Technical Support
    Replies: 7
    Last Post: 21st March 2008, 01:28 AM

Posting Permissions

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