mirror of
https://github.com/frizbee19/FebGameJam.git
synced 2026-10-11 18:19:11 +00:00
Fix animations + jumping animation
This commit is contained in:
5 files changed
+93
-8
No files matched your search
@@ -5,7 +5,7 @@ using UnityEngine;
|
||||
public class PlayerMovement : MonoBehaviour
|
||||
{
|
||||
public Movement controller;
|
||||
//public Animator animator;
|
||||
public Animator animator;
|
||||
public float runSpeed = 40f;
|
||||
float horizontalMove = 0f;
|
||||
bool jump = false;
|
||||
@@ -13,9 +13,6 @@ public class PlayerMovement : MonoBehaviour
|
||||
|
||||
// Update is called once per frame
|
||||
void Update() {
|
||||
// Horizontal value is for the animation state machine. No code required, wow!
|
||||
//animator.SetFloat("Horizontal", Input.GetAxis("Horizontal"));
|
||||
|
||||
horizontalMove = Input.GetAxisRaw("Horizontal") * runSpeed;
|
||||
|
||||
if (Input.GetButtonDown("Jump")) {
|
||||
@@ -27,8 +24,12 @@ public class PlayerMovement : MonoBehaviour
|
||||
} else if (Input.GetKeyUp(KeyCode.LeftShift)) {
|
||||
crouch = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (animator != null) {
|
||||
animator.SetFloat("Horizontal", Input.GetAxis("Horizontal"));
|
||||
animator.SetBool("Airborne", !controller.m_Grounded);
|
||||
}
|
||||
}
|
||||
void FixedUpdate()
|
||||
{
|
||||
controller.Move(horizontalMove * Time.fixedDeltaTime, crouch, jump);
|
||||
|
||||
Reference in new issue
Block a user