Quantcast
Channel: Questions in topic: "enemy"
Viewing all articles
Browse latest Browse all 1488

How would I animate a 2D enemy with AI made with A*?

$
0
0
So recently I decided to get started on a pixel art top down RPG. It's the first game I've actually had the proper motivation to create but I recently hit a roadblock. I had followed a tutorial on how to create 2D enemy AI by Brackeys and ran into no problems in setting up A*. The problem arose when I was trying to animate my enemy. I had created the animation files and made an animation tree, when I realised I had no clue how to link my enemy with its animations. I tried to solve the issue myself. I thought about but could see no other way for this to work other than the following script. using System.Collections; using System.Collections.Generic; using UnityEngine; public class GoblinAnim : MonoBehaviour { Vector2 movement; public Animator anim; // Update is called once per frame void Update() { anim.SetFloat("Horizontal", movement.x); anim.SetFloat("Vertical", movement.y); anim.SetFloat("Speed", movement.sqrMagnitude); } } However, this did not work. Though I did not encounter any errors in console, my goblin was still as rigid as ever. My surface level understanding of Unity could not find any solution to this problem other than posting on here. If any of you have any clue at all about this, I'd appreciate your input.

Viewing all articles
Browse latest Browse all 1488

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>