User Tag List

Results 1 to 7 of 7

Thread: closest enemie problem

  1. #1
    Clicker Multimedia Fusion 2 DeveloperSWF Export Module
    Tiles's Avatar
    Join Date
    Jun 2006
    Posts
    1,359
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    closest enemie problem

    I want multiple wartowers that fires to the closest enemie when he is in range. I have got it to work for one enemie. But with multiple enemies i get mad. Could anybody help me out there?

    First file is the single enemie solution. Second file is one of my lots of tries to get it to work with multiple enemies.

    Attached files Attached files

  2. #2
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleiOS 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)
    Popcorn's Avatar
    Join Date
    Jun 2006
    Location
    Norway, Bergen
    Posts
    2,367
    Mentioned
    13 Post(s)
    Tagged
    0 Thread(s)

    Re: closest enemie problem

    First off use the first example, delete all the events you have, make some more enemies and insert the Clickteam Movement Controller object into your frame (it comes with build 243).

    [events]
    *Always
    - Start loop "test" NObjects( "tower" )+NObjects( "enemie - 8 dir movement" ) times

    *On loop "test"
    +Pick one of tower
    +Pick one of enemie - 8 dir movement
    +DistObjects( "Clickteam Movement Controller", Fixed( "tower" ), Fixed( "enemie - 8 dir movement" ))<100
    -Shoot bullet at speed 100 towards
    [/events]

    The distance is found using "compare two general values" and then using the Clickteam Movement Controller.

  3. #3
    Clicker Multimedia Fusion 2 DeveloperSWF Export Module
    Tiles's Avatar
    Join Date
    Jun 2006
    Posts
    1,359
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: closest enemie problem

    Ookay, got it to work. This code snippet is great. Thank you Popcorn

    This method has some flaws though. The bullet starts to flicker between two enemies from time to time. Enemies move, and so the distance changes ... :/

    Have solved it by starting the fastloop with every 10" instead always. Maybe i can even start it less often. Or shoot the bullet much faster. Will tinker around with it. Anyway. Should do the trick for now

    What i have noticed is that MMF2 seems to handle instances different from MMF1.5.

    Tower is facing a direction should pick the tower with this direction, shouldn`t it? Or Tower is not overlapping bullet. It doesn't. I had to fastloop this part. But in the end i got it working

    11 kb
    Attached files Attached files

  4. #4
    Clicker Multimedia Fusion 2 DeveloperSWF Export Module
    Tiles's Avatar
    Join Date
    Jun 2006
    Posts
    1,359
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: closest enemie problem

    Nope. I cannot leave it this way. Bullets flies in circles around my enemies before they finally choose one enemie to hit. I need another solution it seems :/

  5. #5
    Clicker Multimedia Fusion 2 DeveloperSWF Export Module
    Tiles's Avatar
    Join Date
    Jun 2006
    Posts
    1,359
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: closest enemie problem

    Still not a perfect solution. But now the bullet doesn't flicker between two enemies anymore

    But it still chooses random between the enemies in reach. And not the closest. Never thought that this problem is this hard. I am lost here. I am simply not able to figure out a way that really chooses the closest enemie.

    Anyway. It is good enough for my needs. Maybe somebody else has a better solution. 12 kb
    Attached files Attached files

  6. #6
    No Products Registered

    Join Date
    Dec 2006
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: closest enemie problem

    You could try using this Line of sight code but change the distance that the object travels to limit what the person can hit. you can also add an event that limits your object to only firing at one thingat a time. Hope this works for you, but if not good luck on your project
    Attached files Attached files

  7. #7
    Clicker Multimedia Fusion 2 DeveloperSWF Export Module
    Tiles's Avatar
    Join Date
    Jun 2006
    Posts
    1,359
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: closest enemie problem

    Phew, i can't get my head giving me an idea how to use this example for my case here. I even don`t understand some pieces of your code. What`s this +Never Line good for? Never comments this event line out, doesn't it?

Similar Threads

  1. Lacewing & enemie..?
    By ptiseigneur in forum Lacewing
    Replies: 5
    Last Post: 20th April 2013, 08:22 PM
  2. Problem: Advanced Path Movement - Selecting the closest node?
    By GreenOnion in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 7th March 2013, 02:16 PM
  3. Number closest to 0
    By Skyhunter in forum Multimedia Fusion 2 - Technical Support
    Replies: 7
    Last Post: 27th October 2012, 02:27 AM
  4. Finding the closest value...
    By ChrisBurrows in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 7th June 2012, 06:27 PM
  5. which active is closest to?
    By StingRay in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 30th July 2010, 07:13 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
  •