Enemy Follow Player Node

Discussion in 'How Can I...?' started by alexsafayan, Feb 23, 2020.

  1. alexsafayan

    alexsafayan Boxer

    Joined:
    Oct 14, 2016
    Messages:
    73
    Likes Received:
    14
    Hey Buildbox community,

    Has anyone figured out a way to make an enemy go towards the player? I'm sure this would take some coding, so if anyone has created the node and would like to share it with the community I'm sure it would be appreciated.
     
  2. AFStudios

    AFStudios Boxer

    Joined:
    Jan 11, 2020
    Messages:
    27
    Likes Received:
    10
    I can create a node for this. Probably not a whole lot different than unity (other than the scripting language). The methods should be about the same. Let me know if its resolved before i get done
     
    andre_sprs likes this.
  3. AFStudios

    AFStudios Boxer

    Joined:
    Jan 11, 2020
    Messages:
    27
    Likes Received:
    10
    Here you go you should be able edit the fields too
     

    Attached Files:

    Last edited: Mar 12, 2020
  4. beshoy soliman

    beshoy soliman Boxer

    Joined:
    Apr 18, 2020
    Messages:
    2
    Likes Received:
    0
    hey can you help me, I downloaded your asses but I don't know how to make it work
     
  5. AFStudios

    AFStudios Boxer

    Joined:
    Jan 11, 2020
    Messages:
    27
    Likes Received:
    10
    Yes i can are you on discord?
     
  6. Jackazoid

    Jackazoid Avid Boxer

    Joined:
    Sep 7, 2017
    Messages:
    176
    Likes Received:
    72
    Works better than the "Attract" node but its not dynamic. :(
     
  7. AFStudios

    AFStudios Boxer

    Joined:
    Jan 11, 2020
    Messages:
    27
    Likes Received:
    10
    I can work on it some more and see if i can make more dynamic
     
    Jackazoid likes this.
  8. visionarymonkey

    visionarymonkey Boxer

    Joined:
    Apr 16, 2018
    Messages:
    96
    Likes Received:
    32
    Does this node still work in 3.2? Ive tried using it and can't get it to work. Wouldn't be surprised if its user error though.
     
  9. AFStudios

    AFStudios Boxer

    Joined:
    Jan 11, 2020
    Messages:
    27
    Likes Received:
    10
    I havent tested in in the latest version, but I will and I will make the necessary changes if need be. Thank you for the update.
     
  10. beshoy soliman

    beshoy soliman Boxer

    Joined:
    Apr 18, 2020
    Messages:
    2
    Likes Received:
    0
    Thank you, I got it to work
     
  11. visionarymonkey

    visionarymonkey Boxer

    Joined:
    Apr 16, 2018
    Messages:
    96
    Likes Received:
    32
    what did you have to do to get it to work?
     
  12. visionarymonkey

    visionarymonkey Boxer

    Joined:
    Apr 16, 2018
    Messages:
    96
    Likes Received:
    32
    Do you mind giving me some direction on how to implement this node?

    Thanks
     
  13. AFStudios

    AFStudios Boxer

    Joined:
    Jan 11, 2020
    Messages:
    27
    Likes Received:
    10
    It should be an asset as itself. You would set the entity to follow your character from within the node editor. You can always change the 3d model of the asset to whatever you want as well. Make sure if you cahnge it though, you adjust the collision shapes as well.
     
  14. 5petersonzachary

    5petersonzachary Serious Boxer

    Joined:
    Jan 23, 2016
    Messages:
    569
    Likes Received:
    169
    Screen Shot 2020-04-27 at 8.11.58 PM.png Their is a node in bb called rotate towards. In your enemy add a timer and set it to 0.1 for time and connect it to the rotate towards node. Click on the rotate towards node and select which asset you want it to follow (if you use a move node make sure to set it to follow rotation)
    The rotate towards node is nice because it allows you to change how fast the enemy will rotate towards the character.
     
    Jaro, visionarymonkey and AFStudios like this.
  15. Azim Shaikh

    Azim Shaikh Boxer

    Joined:
    May 2, 2020
    Messages:
    4
    Likes Received:
    1
    Need help, I cannot get it to work
     
  16. AFStudios

    AFStudios Boxer

    Joined:
    Jan 11, 2020
    Messages:
    27
    Likes Received:
    10
    Give me some time on this it may be a version compatibility issue. Waiting on a new pc so I can get started again.
     
  17. Azim Shaikh

    Azim Shaikh Boxer

    Joined:
    May 2, 2020
    Messages:
    4
    Likes Received:
    1
    okay no problem, currently i am using advanced move and then made 2 copies of the enemy and flipped them and inverted the x directions and crashing the enemy into the wall, but stuck with awake node as the enemy moves before the character enters the scene :(
     
    AFStudios likes this.
  18. Mystogan

    Mystogan Boxer

    Joined:
    Apr 11, 2020
    Messages:
    13
    Likes Received:
    1
    Thanks, this is exactly what i was looking for!
     
  19. Mystogan

    Mystogan Boxer

    Joined:
    Apr 11, 2020
    Messages:
    13
    Likes Received:
    1
    Has anyone had any issue when using in 2D?

    The image keeps flipping over when moving left or right, turning off Follow rotation stopes the node from working, it just goes off to the side.
     
  20. visionarymonkey

    visionarymonkey Boxer

    Joined:
    Apr 16, 2018
    Messages:
    96
    Likes Received:
    32
    Thats awesome!

    Worked great for my purposes.
     

Share This Page