Quantcast
Channel: Latest Questions by ryno9788
Viewing all articles
Browse latest Browse all 91

Collision for a block maze script C#

$
0
0
I'm building a game for a project for school. I had the idea for a maze game with a couple twist and turns. The Idea for the script is to press one of the WASD keys down and you would move one space forwards. I got this but it has no collision. I need to know how to move a set amount with one press of a key. The script using UnityEngine; using System.Collections; public class MazeController : MonoBehaviour { void Update () { if(Input.GetKeyDown("d")) transform.position += Vector3.right; if(Input.GetKeyDown("a")) transform.position -= Vector3.right; if(Input.GetKeyDown("w")) transform.position += Vector3.forward; if(Input.GetKeyDown("s")) transform.position -= Vector3.forward; } }

Viewing all articles
Browse latest Browse all 91

Trending Articles