Search Unity

  1. Unity 2018.3 is now released.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. We've updated our Terms of Service. Please read our blog post from Unity CTO and Co-Founder Joachim Ante here
    Dismiss Notice
  4. Want to provide direct feedback to the Unity team? Join the Unity Advisory Panel.
    Dismiss Notice
  5. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice

Movement - Help

Discussion in 'Documentation' started by Ph_Mari3, Oct 14, 2018.

  1. Ph_Mari3


    Oct 14, 2018
    Hy. I made a snake game, but I have an issue. For example, while moving right if I press left button my snake dies (because of colisions). How could I disable, while moving one direction, the input for the oposite direction? I tried several algorithms but none worked...
  2. Lurking-Ninja


    Jan 20, 2015
    Snake games usually utilize relative steering, which means
    - when the snake is moving to the right, pushing the left button, it will turn and move up
    - when the snake is moving to the left, pushing the left button it will turn and move down

    In this case you just do not use the "down button", because it points towards the snake body itself all the time. Otherwise you turn your snake 90 degree to the proper direction.