Question by
WeirdDeveloping · Nov 18, 2015 at 03:05 PM ·
beginner
Simple Movement Script Broken
Hi! I Have just got Unity and have experience of programming and starting to build a game i am working on a movement script but it dosent work Here is the script
using UnityEngine;
using System.Collections;
public class move : MonoBehaviour {
//Use this for initialization
void Start () {
}
//Update is called once per frame
void Update () {
if (Input.GetKey ("w")) {
transform.Translate((Vector3.forward) * 100 * Time.deltaTime)
}
}
Comment
Answer by Jessespike · Nov 18, 2015 at 05:06 PM
"it dosent work" isn't very helpful. What's not working? Are you getting an error? If so, copy-paste the error(s) here so we know what is wrong. By the looks of it, you're missing a semi-colon on the Translate line and a curly brace to close the class.
using UnityEngine;
using System.Collections;
public class move : MonoBehaviour {
//Update is called once per frame
void Update () {
if (Input.GetKey ("w")) {
transform.Translate((Vector3.forward) * 100 * Time.deltaTime); // add semi-colon
}
}
} // add a curly brace to close the class
Your answer
Follow this Question
Related Questions
Input System Not Recognized? 0 Answers
Help! On/off button 1 Answer
How do you make your player jump in the Roll-a-Ball tutorial series? 0 Answers
Character movement with click 1 Answer
all compilers have to be fixed befor entering game mode .. 3 Answers