User Tag List

Results 1 to 5 of 5

Thread: Advice in changing enemy direction

  1. #1
    Clicker Fusion 2.5
    Warmachine's Avatar
    Join Date
    Nov 2009
    Location
    Charleston, WV
    Posts
    663
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Advice in changing enemy direction

    Hi guys, im having a hard time making this work...does anyone know of a way to change enemy movement based on player position? like for instance, an enemy is coming at you, you jump over the enemy, how would you make it to where the enemy would chase you?

  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,364
    Mentioned
    13 Post(s)
    Tagged
    0 Thread(s)

    Re: Advice in changing enemy direction

    Not knowing what kind of movement you are using for the enemy, I can only give you general advice.

    Pseudocode:

    * Enemy is at the right of player
    - Enemy: Move left

    * Enemy is at the left of player
    - Enemy: Move right

    Then it is up to you to decide HOW the enemy will move right and left. If the enemy is using bouncing ball movement, just change direction from right to left, and vice versa. If you're moving it by fastloops pixel by pixel, you probably have a flag or alterable value on the enemy telling it which direction it is moving, then just switch this value when the player is on the other side of the enemy.

  3. #3
    Clicker Fusion 2.5
    Warmachine's Avatar
    Join Date
    Nov 2009
    Location
    Charleston, WV
    Posts
    663
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Re: Advice in changing enemy direction

    My bad on the vagueness lol. i have this particular enemy setup using the PMO. I want him to chase the player.

  4. #4
    Clicker

    Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleSWF Export Module
    Konidias's Avatar
    Join Date
    Aug 2009
    Posts
    1,546
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)

    Re: Advice in changing enemy direction

    Usually it is done by having conditions check the position of the player compared to the enemy position. So in a side scroller, if the player's x position is less than the enemy's x position, that usually means the player is to the screen left of the enemy... so you would have the enemy face screen left. Inversely, if the player's x position is greater than the enemy's x position, have the enemy face screen right.

    I'm not sure how this works via the PMO object, as I have little experience using that, but I would imagine it is somewhat similar?

  5. #5
    Clicker Fusion 2.5
    Warmachine's Avatar
    Join Date
    Nov 2009
    Location
    Charleston, WV
    Posts
    663
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Re: Advice in changing enemy direction

    I got it figured out guys! Here's how i got it:

    X Position (player)>=(enemy)+30 = internal flag 1 is on

    that controls the enemy chasing the player when you are on the right side of the enemy. The +30 is there to put him closer to the character.

    then

    X Position (player)<=(enemy)+30 = internal flag 1 is off

    which does the opposite of the above. the internal flag's control the animation, direction and user input pressing either left or right on the enemy PMO. thanks for the tips guys, hope this could help someone in my situation! lol

Similar Threads

  1. Changing direction when far away good for performance?
    By Outcast in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 17th October 2012, 11:54 AM
  2. How to get an enemy to face its direction of movement.
    By Narfafian in forum Multimedia Fusion 2 - Technical Support
    Replies: 12
    Last Post: 20th July 2012, 12:27 AM
  3. changing animation on enemy
    By colin in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 17th October 2009, 04:31 PM
  4. Direction Changing + movement
    By Wingzero354 in forum Multimedia Fusion 2 - Technical Support
    Replies: 17
    Last Post: 29th March 2008, 08:06 AM
  5. Changing active object direction (???)
    By JohnC in forum Multimedia Fusion 2 - Technical Support
    Replies: 5
    Last Post: 19th January 2008, 11:58 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
  •