Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Luigi Script
- //name
- using UnityEngine;
- class LuigiScript : MonoBehaviour
- {
- // Start is called before the first frame update
- protected void Start()
- {
- // Vectors are variables that mean positions.
- Vector3 localWhichPosition;
- // Luigi is in the middle.
- localWhichPosition = Vector3.zero;
- if (Input.GetKey(KeyCode.LeftArrow))
- {
- localWhichPosition = 10 * Vector3.left;
- }
- else
- if (Input.GetKey(KeyCode.RightArrow))
- {
- localWhichPosition = 10 * Vector3.right;
- }
- localWhichPosition = Vector3.zero;
- if (Input.GetKey(KeyCode.UpArrow))
- {
- localWhichPosition = 10 * Vector3.up;
- }
- else
- if (Input.GetKey(KeyCode.DownArrow))
- {
- localWhichPosition = 10 * Vector3.down;
- }
- // You have to set the transform position
- // to actually change Luigi's position.
- this.transform.position = localWhichPosition;
- }
- // Update is called once per frame
- void Update()
- {
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement