Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class movw : MonoBehaviour
- {
- Rigidbody2D rb;
- private float verticalMove;
- [SerializeField] private float speed;
- void Start()
- {
- rb = GetComponent<Rigidbody2D>();
- }
- private void Update()
- {
- }
- private void FixedUpdate()
- {
- transform.Translate(0, verticalMove, 0);
- }
- public void upButton()
- {
- verticalMove = speed;
- }
- public void downButton()
- {
- verticalMove = -speed;
- }
- public void Stop()
- {
- verticalMove = 0;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement