From de902fa0a2c562d45e14e47d69c00d5a9cf53545 Mon Sep 17 00:00:00 2001 From: Christian Ohlsson Date: Wed, 16 Sep 2026 20:07:38 +0200 Subject: [PATCH] =?UTF-8?q?Anv=C3=A4nder=20nya=20Input-systemet?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Scripts/PlayerController.cs | 33 ++++-------------------------- 1 file changed, 4 insertions(+), 29 deletions(-) diff --git a/Assets/Scripts/PlayerController.cs b/Assets/Scripts/PlayerController.cs index 3491fac..46a2185 100644 --- a/Assets/Scripts/PlayerController.cs +++ b/Assets/Scripts/PlayerController.cs @@ -20,14 +20,14 @@ public class BallController : MonoBehaviour { private PlayerControls _controls; void Start() { - _ball = GetComponent(); - _ballSpeed = 3f; + _ballSpeed = 5f; _brakeForce = 0.3f; - _jumpForce = 14f; + _jumpForce = 300f; _pickupLeft = GameObject.FindGameObjectsWithTag("PickUp").Length; transform.position = new Vector3(0, 0.5f, 0); } private void Awake() { + _ball = GetComponent(); _controls = new PlayerControls(); } private void OnEnable() { @@ -40,8 +40,7 @@ public class BallController : MonoBehaviour { _moveInput = Vector2.zero; _controls.Player.Jump.performed += ctx => { - Debug.Log("SPACE TRYCKT"); - if (transform.position.y < 1) { + if (transform.position.y < 1.0f) { _ball.AddForce(Vector3.up * _jumpForce); } }; @@ -63,7 +62,6 @@ public class BallController : MonoBehaviour { } void Update() { - //KeyHandler(); CheckPlayerOut(); UpdateGUI(); } @@ -95,27 +93,4 @@ public class BallController : MonoBehaviour { transform.rotation = Quaternion.Euler(0, 0, 0); } } - - /* - void KeyHandler() { - if (Keyboard.current.wKey.isPressed) { - _ball.AddForce(Vector3.forward * _ballSpeed); - } - else if (Keyboard.current.sKey.isPressed) { - _ball.AddForce(Vector3.back * _ballSpeed); - } - else if (Keyboard.current.dKey.isPressed) { - _ball.AddForce(Vector3.right * _ballSpeed); - } - else if (Keyboard.current.aKey.isPressed) { - _ball.AddForce(Vector3.left * _ballSpeed); - } - if (Keyboard.current.spaceKey.isPressed && transform.position.y < 1) { - _ball.AddForce(Vector3.up * _jumpForce); - } - else { - _ball.AddForce(-_ball.linearVelocity * _brakeForce); - } - } - */ } \ No newline at end of file