]> git.lizzy.rs Git - SuperMouseAdventure.git/blob - 2DGame/Assets/Scripts/Mouse/Stamping.cs
Stampfen v0.1
[SuperMouseAdventure.git] / 2DGame / Assets / Scripts / Mouse / Stamping.cs
1 using System;
2 using System.Collections;
3 using System.Collections.Generic;
4 using UnityEngine;
5 using UnityEngine.Tilemaps;
6
7 public class Stamping : MonoBehaviour
8 {
9     MouseController mouseController;
10     Rigidbody2D rb;
11
12     [SerializeField]
13     private float stampingSpeed = 40;
14
15     private bool isStamping = false;
16
17     // Start is called before the first frame update
18     void Start()
19     {
20         mouseController = GetComponent<MouseController>();
21         rb = GetComponent<Rigidbody2D>();
22     }
23
24     // Update is called once per frame
25     void Update()
26     {
27         if (!mouseController.isGrounded)
28         {
29             if (Input.GetKeyDown(KeyCode.S) || Input.GetKeyDown(KeyCode.DownArrow))
30             {
31                 isStamping = true;
32                 rb.velocity = Vector2.down * stampingSpeed;
33             }
34         }
35         else
36         {
37             isStamping = false;
38         }
39     }
40 }