Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- public class BasicConditionals : MonoBehaviour {
- //make new public bool and GameObjects
- //remember that public means they can be edited in the Unity editor and by other scripts
- public bool goToWork;
- public GameObject mover;
- // Use this for initialization, similar to void setup() in Processing
- void Start () {
- }
- // Update is called once per frame, similar to void draw() in Processing
- void Update () {
- Debug.Log("game object is at ... " + mover.transform.position);
- //check if the GetKeyDown function of Input returns true for "space" (the space bar)
- if (Input.GetKeyDown("w")){
- //if true ... move the position of mover by (0,1,0)
- mover.transform.position += new Vector3(0,0,1);
- }
- if (Input.GetKeyDown("d")){
- mover.transform.position += new Vector3(1,0,0);
- }
- if (Input.GetKeyDown("a")){
- mover.transform.position += new Vector3(-1,0,0);
- }
- if (mover.transform.position == new Vector3(11,0,0)){
- mover.transform.position += new Vector3(0,0,0);
- }
- if (mover.transform.position == new Vector3(0,11,0)){
- mover.transform.position += new Vector3(0,0,0);
- }
- if (mover.transform.position == new Vector3(0,0,11)){
- mover.transform.position += new Vector3(0,0,0);
- }
- //Tried to reset the player's original position after hitting off of the box
- //check it the mover's position is equal to (0,5,0)
- //if (mover.transform.position == new Vector3(0,5,0)){
- //if it is, add on this additional position (5,-5,0)
- // mover.transform.position += new Vector3(0,1,0);
- //}
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement