making snake game
why this is not working, what is the issue?
void Update() { Vector2 SnakePos; SnakePos = new Vector2(0f, 0f); float movex, movey; movex = Input.GetAxisRaw("Horizontal"); while (!Input.anyKey) { SnakePos = transform.position; SnakePos.x = SnakePos.x + movex; transform.position = SnakePos; } movey = Input.GetAxisRaw("Vertical"); while (!Input.anyKey) { SnakePos = transform.position; SnakePos.y = SnakePos.y + movey; transform.position = SnakePos; }
}
}
Your answer
Follow this Question
Related Questions
C# cant find a class auto generated by unity 2 Answers
i need help making a dash ability for my endless runner game 2 Answers
XR Input: primary2DAxis always returns 0 1 Answer
What is the difference between Getkey and Getkeydown (C#) 1 Answer
Why is Input.GetMouseButtonUp(0) not returning true? 0 Answers