public void CreateAnimations() { animator.CreateAnimation("IdleFront", new Animation(3, 90, 0, 45, 45, 3, Vector2.Zero)); animator.CreateAnimation("IdleBack", new Animation(3, 135, 0, 45, 45, 3, Vector2.Zero)); animator.CreateAnimation("IdleLeft", new Animation(3, 45, 0, 45, 45, 3, Vector2.Zero)); animator.CreateAnimation("IdleRight", new Animation(3, 0, 0, 45, 45, 3, Vector2.Zero)); //animator.CreateAnimation("WalkFront", new Animation(4, 150, 0, 90, 150, 6, Vector2.Zero)); //animator.CreateAnimation("WalkBack", new Animation(4, 150, 4, 90, 150, 6, Vector2.Zero)); //animator.CreateAnimation("WalkLeft", new Animation(4, 150, 8, 90, 150, 6, Vector2.Zero)); //animator.CreateAnimation("WalkRight", new Animation(4, 150, 12, 90, 150, 6, Vector2.Zero)); //animator.CreateAnimation("AttackFront", new Animation(4, 300, 0, 145, 160, 8, new Vector2(50, 0))); //animator.CreateAnimation("AttackBack", new Animation(4, 465, 0, 170, 155, 8, new Vector2(20, 0))); //animator.CreateAnimation("AttackRight", new Animation(4, 620, 0, 150, 150, 8, Vector2.Zero)); //animator.CreateAnimation("AttackLeft", new Animation(4, 770, 0, 150, 150, 8, new Vector2(60, 0))); //animator.CreateAnimation("DieFront", new Animation(3, 920, 0, 150, 150, 5, Vector2.Zero)); //animator.CreateAnimation("DieBack", new Animation(3, 920, 3, 150, 150, 5, Vector2.Zero)); //animator.CreateAnimation("DieLeft", new Animation(3, 1070, 0, 150, 150, 5, Vector2.Zero)); //animator.CreateAnimation("DieRight", new Animation(3, 1070, 3, 150, 150, 5, Vector2.Zero)); animator.PlayAnimation("IdleFront"); }
public void Update(ref Direction direction) { Vector2 translation = Vector2.Zero; if (direction == Direction.Back) { translation += new Vector2(0, -1); } if (direction == Direction.Front) { translation += new Vector2(0, 1); } if (direction == Direction.Left) { translation += new Vector2(-1, 0); } if (direction == Direction.Right) { translation += new Vector2(1, 0); } animator.PlayAnimation("Idle" + direction); transform.Translate(translation * GameWorld.DeltaTime * speed); }