User Tag List

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

Thread: Is there a way to make enemies only attack when they’re facing the player object?

  1. #1
    Clicker Fusion 2.5

    Join Date
    Dec 2019
    Posts
    48
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Is there a way to make enemies only attack when they’re facing the player object?

    Something I was wondering. I made enemies in my app shoot when the player character overlaps an invisible active object, but it’ll only shoot in the direction it’s facing. Any way to only make it shoot at the player object when it’s facing it?

  2. #2
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleSWF Export Module

    Join Date
    Jul 2006
    Location
    Norway
    Posts
    329
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you are using the built in "Launch an object" then you can select "Launch in direction of..." and then pick the player object. It will then always shoot towards the player.

  3. #3
    Clicker Fusion 2.5 DeveloperAndroid Export Module
    Janette5's Avatar
    Join Date
    Dec 2014
    Location
    Western Cape, SA
    Posts
    663
    Mentioned
    29 Post(s)
    Tagged
    0 Thread(s)
    Test the position of the enemy relative to the player & its direction. Something like this:

    y position of Enemy <= y position of player + 5 (They're on the same platform)
    y.position of Enemy >= y position of player - 5 (They're on the same platform)
    +
    x position of Enemy >= x position of player - 100 (Enemy is to the left of the player and within range)
    x position of Enemy <= x position of player (Enemy is to the left of the player)
    +
    Enemy direction = Right (Enemy can see the player)
    = Then Shoot

  4. #4
    Clicker Fusion 2.5

    Join Date
    Dec 2019
    Posts
    48
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    For clarification, I insert all the X and Y statements in the same event where the player overlaps the trigger, right?

  5. #5
    Clicker Fusion 2.5 DeveloperAndroid Export Module
    Janette5's Avatar
    Join Date
    Dec 2014
    Location
    Western Cape, SA
    Posts
    663
    Mentioned
    29 Post(s)
    Tagged
    0 Thread(s)
    If the player overlaps the trigger - turn a flag on for the player - let's say flag 1

    Then start a new event

    If flag 1 of player is on
    + all the x, y & direction stuff
    = then shoot

  6. #6
    Clicker Fusion 2.5

    Join Date
    Dec 2019
    Posts
    48
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I tried that and it's not working. It's in the global events.
    Attached files Attached files

  7. #7
    Clicker Fusion 2.5 DeveloperAndroid Export Module
    Janette5's Avatar
    Join Date
    Dec 2014
    Location
    Western Cape, SA
    Posts
    663
    Mentioned
    29 Post(s)
    Tagged
    0 Thread(s)
    You just have the enemy direction set wrong - yours is opposite to what it should be.

    Change it so the enemy is looking right.

  8. #8
    Clicker Fusion 2.5

    Join Date
    Dec 2019
    Posts
    48
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I tried that. It doesn't work. I even added one so that there's one for looking both directions. That didn't work.
    Attached files Attached files

  9. #9
    Clicker Fusion 2.5 DeveloperAndroid Export Module
    Janette5's Avatar
    Join Date
    Dec 2014
    Location
    Western Cape, SA
    Posts
    663
    Mentioned
    29 Post(s)
    Tagged
    0 Thread(s)
    Attached is an example of how it would work - from both sides

    Frame 1 - the enemy will shoot if the player is in range.
    Frame 2 - the enemy will only shoot if the player is in range and the player is overlapping a trigger object.
    Attached files Attached files

  10. #10
    Clicker Fusion 2.5

    Join Date
    Dec 2019
    Posts
    48
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I followed the example for the one without the trigger, and it works on the pink enemies, but for some reason, it won't work on the black ones despite me doing the same thing.
    Attached files Attached files

Page 1 of 2 1 2 LastLast

Similar Threads

  1. Replies: 2
    Last Post: 29th June 2017, 02:49 AM
  2. How can I make an object go the direction it is facing?
    By yemibox51 in forum Developer Services
    Replies: 2
    Last Post: 29th June 2017, 02:49 AM
  3. How to make enemies attack randomly like age of empires?
    By denis6555 in forum Multimedia Fusion 2 - Technical Support
    Replies: 0
    Last Post: 27th May 2014, 01:09 AM
  4. I'm trying to make enemies react "accurately" when I attack them (like Terraria).
    By edman3d in forum Multimedia Fusion 2 - Technical Support
    Replies: 6
    Last Post: 2nd March 2013, 06:41 AM
  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
  •