From 5c57f4b3181444c3999c3d8a3361a6cf4f5b3ff0 Mon Sep 17 00:00:00 2001 From: cemt1363 Date: Sat, 6 Jun 2026 00:32:10 +0200 Subject: [PATCH] trying to figure out how to jump --- Game/.vsconfig | 6 ++++++ Game/Assets/Scripts/DropletMovement.cs | 20 ++++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 Game/.vsconfig diff --git a/Game/.vsconfig b/Game/.vsconfig new file mode 100644 index 0000000..f019fd0 --- /dev/null +++ b/Game/.vsconfig @@ -0,0 +1,6 @@ +{ + "version": "1.0", + "components": [ + "Microsoft.VisualStudio.Workload.ManagedGame" + ] +} diff --git a/Game/Assets/Scripts/DropletMovement.cs b/Game/Assets/Scripts/DropletMovement.cs index 76b61a6..a1a0a27 100644 --- a/Game/Assets/Scripts/DropletMovement.cs +++ b/Game/Assets/Scripts/DropletMovement.cs @@ -2,11 +2,26 @@ using UnityEngine; public class DropletMovement : MonoBehaviour { +<<<<<<< Updated upstream public float moveSpeed = 5f; private Rigidbody2D rb; private Vector2 movement; +======= + private Rigidbody2D rb; + public float moveSpeed = 5f; + public float jumpingPower = 5f; + private Vector2 movement; + private Animator playerAnim; //for animation + private float xInput; + + //helper variables + private bool isGrounded = true; + [SerializeField] private float dashSpeed; + [SerializeField] private float dashDuration; + private float dashTime; +>>>>>>> Stashed changes // Start is called once before the first execution of Update after the MonoBehaviour is created void Start() @@ -19,10 +34,15 @@ public class DropletMovement : MonoBehaviour { movement.x = Input.GetAxisRaw("Horizontal"); movement.y = Input.GetAxisRaw("Vertical"); + if (isGrounded && Input.GetKeyDown(KeyCode.Space)) + { + rb.AddForce(Vector2.up * jumpingPower, ForceMode2D.Impulse); + } } private void FixedUpdate() { rb.linearVelocity = movement.normalized * moveSpeed; } + }