Question by
InsaneYosh · Jun 01, 2017 at 09:34 PM ·
topdownmovment
Error Assets/MoveFoward.cs(4,17): error CS8025: Parsing error
Hello, i have been trying to make a top-down game a bit like Hyper light drifter. I'm very new to code but this is what I made
Error : Assets/MoveFoward.cs(4,17): error CS8025: Parsing error
Code ;
pragma strict
//Inspector Variables var playerSpeed : float = 10; //speed player moves
function Update () {
MoveForward(); // Player Movement
}
function MoveForward() {
if(Input.GetKey("up"))//Press up arrow key to move forward on the Y AXIS
{
transform.Translate(0,playerSpeed * Time.deltaTime,0);
}
if(Input.GetKey("down"))//Press up arrow key to move forward on the Y AXIS
{
transform.Translate(0,-playerSpeed * Time.deltaTime,0);
}
if(Input.GetKey("left"))//Press up arrow key to move forward on the Y AXIS
{
transform.Translate(-playerSpeed * Time.deltaTime,0 ,0);
}
if(Input.GetKey("right"))//Press up arrow key to move forward on the Y AXIS
{
transform.Translate(playerSpeed * Time.deltaTime,0 ,0);
}
}
Comment
Answer by InsaneYosh · Jun 01, 2017 at 09:47 PM
pragma strict
//Inspector Variables var playerSpeed : float = 10;
function Update () {
MoveForward(); // Player Movement
}
function MoveForward() {
if(Input.GetKey("up"))//Press up arrow key to move forward on the Y AXIS
{
transform.Translate(0,playerSpeed * Time.deltaTime,0);
}
if(Input.GetKey("down"))//Press up arrow key to move forward on the Y AXIS
{
transform.Translate(0,-playerSpeed * Time.deltaTime,0);
}
if(Input.GetKey("left"))//Press up arrow key to move forward on the Y AXIS
{
transform.Translate(-playerSpeed * Time.deltaTime,0 ,0);
}
if(Input.GetKey("right"))//Press up arrow key to move forward on the Y AXIS
{
transform.Translate(playerSpeed * Time.deltaTime,0 ,0);
}
}
this is the code
Your answer

Follow this Question
Related Questions
Detect direction of enemy with MoveTowards 1 Answer
How to simply make this kind of movement? 0 Answers
Dividing my game into rooms 1 Answer
Rotating an object with controller 0 Answers
Top Down Animation/flipping 0 Answers