Breaking

Tuesday, August 1, 2023

button Move in game

 using System.Collections;

using System.Collections.Generic;
using UnityEngine;

public class Move : MonoBehaviour
{
    public float speed = 10f;
    public float jump = 3f;
    // Start is called before the first frame update
    void Start()
    {
       
    }

    // Update is called once per frame
    void Update()
    {
         
    }
    public void MoveLeft()
    {
        transform.position = transform.position - new Vector3(speed,0);
    }
    public void MoveRight()
    {
        transform.position = transform.position + new Vector3(speed,0);
    }
    public void MoveUp()
    {
        transform.position = transform.position + new Vector3(0,jump);
    }
}

No comments:

Post a Comment