Skip to content

Commit

Permalink
Dead stop controls
Browse files Browse the repository at this point in the history
  • Loading branch information
LarsZauberer committed Feb 25, 2021
1 parent 199011b commit 2563420
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 38 deletions.
3 changes: 3 additions & 0 deletions Assets/Scripts/Objects/LevelLoading.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ public class LevelLoading : MonoBehaviour
private void OnTriggerEnter2D(Collider2D other) {
// Fading
if (other.gameObject.tag == "Player") {
Player p = other.gameObject.GetComponent<Player>();
p.dead = true;

GameObject fadeObj = GameObject.Find("Fade");
Fade fading = fadeObj.GetComponent<Fade>();
fading.isFading = true;
Expand Down
19 changes: 10 additions & 9 deletions Assets/Scripts/Player/Player.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ public class Player : MonoBehaviour
Vector2 camStartPos;
float horizontalMove = 0f;
bool jump = false;
public bool dead = false;

void Start() {
camStartPos = camObj.transform.position;
Expand All @@ -26,16 +27,16 @@ void Update()
}

void FixedUpdate() {
controller.Move(horizontalMove * Time.fixedDeltaTime, false, jump);
jump = false;

if (horizontalMove != 0) {
GetComponent<Animator>().SetBool("isWalking", true);
} else {
GetComponent<Animator>().SetBool("isWalking", false);
if (!dead) {
controller.Move(horizontalMove * Time.fixedDeltaTime, false, jump);
jump = false;

if (horizontalMove != 0) {
GetComponent<Animator>().SetBool("isWalking", true);
} else {
GetComponent<Animator>().SetBool("isWalking", false);
}
}

// camFollow();
}

void camFollow() {
Expand Down
18 changes: 0 additions & 18 deletions Assets/Scripts/Player/PlayerControls.cs

This file was deleted.

11 changes: 0 additions & 11 deletions Assets/Scripts/Player/PlayerControls.cs.meta

This file was deleted.

0 comments on commit 2563420

Please sign in to comment.