using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class NWQ : MonoBehaviour
{
public Rigidbody2D myrigidbody;
public float flapstrength;
public float movespeed;
public int playerscore;
public text scoreText;
// Start is called before the first frame update
void Start()
{
playerscore = 0;
}
// Update is called once per frame
void Update()
{
if (Input.GetKeyDown(KeyCode.Space) == true)
{
myrigidbody.velocity = Vector2.up * flapstrength;
playerscore = playerscore + 1;
}
if (Input.GetKeyDown(KeyCode.D) == true)
{
myrigidbody.velocity = new Vector3(5,0,0);
}
if (Input.GetKeyDown(KeyCode.A) == true)
{
myrigidbody.velocity = new Vector3(-5,0,0);
}
}
}
,Here is my code so far:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class NWQ : MonoBehaviour
{
public Rigidbody2D myrigidbody;
public float flapstrength;
public float movespeed;
public int playerscore;
public text scoreText;
// Start is called before the first frame update
void Start()
{
playerscore = 0;
}
// Update is called once per frame
void Update()
{
if (Input.GetKeyDown(KeyCode.Space) == true)
{
myrigidbody.velocity = Vector2.up * flapstrength;
playerscore = playerscore + 1;
}
if (Input.GetKeyDown(KeyCode.D) == true)
{
myrigidbody.velocity = new Vector3(5,0,0);
}
if (Input.GetKeyDown(KeyCode.A) == true)
{
myrigidbody.velocity = new Vector3(-5,0,0);
}
}
}