FreshRSS

Normální zobrazení

Jsou dostupné nové články, klikněte pro obnovení stránky.
PředevčíremHlavní kanál
  • ✇Recent Questions - Game Development Stack Exchange
  • Spacebar not working consistently in UnitySailingWillem
    Sometimes it works but sometimes it just doesn't. Maybe it has something to do with gravity or drag? using System.Collections; using System.Collections.Generic; using UnityEngine; public class BirdScript : MonoBehaviour { public Rigidbody2D myRigidbody; public float flapStrenght; // Start is called before the first frame update (plays ony once) void Start() { gameObject.name = "Roger"; } // Update is called once per frame void Update() { if
     

Spacebar not working consistently in Unity

Sometimes it works but sometimes it just doesn't. Maybe it has something to do with gravity or drag?

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class BirdScript : MonoBehaviour
{
    public Rigidbody2D myRigidbody;
    public float flapStrenght;

    // Start is called before the first frame update (plays ony once)
    void Start()
    {
        gameObject.name = "Roger";
    }

    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Space) == true) 
        {
            myRigidbody.velocity = Vector2.up * flapStrenght;
        }
    }
}
❌
❌