User Tag List

Results 1 to 5 of 5

Thread: Little Help. Picking invisible object and use to Enemy Attack

  1. #1
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform Export ModuleSWF Export Module
    paobrasil's Avatar
    Join Date
    Apr 2012
    Location
    Rio de Janeiro, Brazil
    Posts
    1,149
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Cool Little Help. Picking invisible object and use to Enemy Attack

    Hello again friends!

    I need a little help with my game, I want to compare the distance of each enemy to the player, then when this distance it's less a X value, the enemy will attack.

    I dont know why, but just one enemy attack even if I'm close of BOTH enemies. The strange thing it's BOTH enemy change it animation to attacking, but just one really pick the object invisble and use it.


    The strange thing is: I have used the same code to another enemy and it's working 100%....


    Just move the green Player close the enemies using keyboard 8 directions....

    NotAttacking.mfa

    PS: I'm avoiding to uses loops and foreach loops because performance issues in android.


    Can you help me out?
    Best regards

  2. #2
    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)
    Not sure there's a clean way of doing that without a foreach.

    Picking one fireball, will make only one fireball reposition.
    Not picking one fireball, will pick all of them and split between enemies.

    But I think a foreach won't hurt in this situation,
    you only launch it at time intervals (when the animation is over)
    and only for few items (you can further scope them depending on need, like those in the play area etc.)

    See example:

    NotAttacking_1.mfa

  3. #3
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform Export ModuleSWF Export Module
    paobrasil's Avatar
    Join Date
    Apr 2012
    Location
    Rio de Janeiro, Brazil
    Posts
    1,149
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thank you very much friend. That is a perfect solution! But there is a problem...Both enemies are attacking........the event only fire when the player is closer of BOTH enemies....then both enemies attack..

    I need this more specific...like if I'm closer of one enemy, only this enemy will attack..

    best regards

  4. #4
    Clicker

    Join Date
    Jul 2011
    Posts
    95
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

  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)
    Yeah, both are attacking because you are calculating distances as Xenemy-Xplayer
    so they will always have the same distance from player (since they are both same
    you should use "Distance" function as in klikhappy's example

Similar Threads

  1. Trigger Enemy Attack at......
    By Warmachine in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 5th June 2017, 03:26 AM
  2. Replies: 2
    Last Post: 18th January 2016, 01:25 AM
  3. Best way to go for enemy distance to attack
    By paobrasil in forum Fusion 2.5
    Replies: 12
    Last Post: 30th December 2015, 09:04 PM
  4. Player attack nearest enemy
    By SwabiDude446 in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 13th December 2010, 10:54 PM
  5. attack when facing enemy only
    By ionside in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 25th November 2008, 07:38 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
  •