- Home /
How can I code an enemy attack? (Top Down Melee Attack)
So i already have code that makes it so when a player gets in range, the enemy aggros and moves towards the player, if the player touches the enemy they take damage, however I want to code it so that when a player enters another range that is closer, the enemy will swing at the player. I also want it so the enemy is locked in place when swinging and the swing has a cooldown. I also want to know how I can make it so when a player enters aggro range, the enemy will do the run animation, because as of now he just moves towards him while doing the idle animation. Im very new to both coding and unity and I don't know how to do these things, this is my first time doing any sort of game development. I watched a simple tutorial and it only explained how to code the idle animation and the death animation. Any help is appreciated.
Answer by valarken · Apr 15 at 02:07 PM
Hi, i recommend you to check out this tutorial
https://www.youtube.com/watch?v=AiCfq0RFVfQ&list=PL4vbr3u7UKWp0iM1WIfRjCDTI03u43Zfu∈dex=54
(It's part 51 tho, so maybe u need to check out the other parts as well)
Your answer
Follow this Question
Related Questions
Animation not at correct position W/Video 0 Answers
Animation Not Playing - VideoExplanation 2 Answers
Animation or programming? 2 Answers
Trouble with Animation Code 0 Answers
Keep boolean true whilst playing animation, then false 1 Answer