|
Hi, I was trying to make a Snake game, but I stumbled upon a little thing. I'm not certain of what kind of Input I have to use. What I want to do is to move the "Head" in the direction I pressed the key (whichever: up, down, left, right) until whether another key is pressed, or the snake crashes something. I tried Input.GetKey and Input.GetKeyDown, but the GameObject just moves randomly and it kinda shifts between old and new positions. this is my motion code (which is located on the "Head" GameObject):
I know it's kind of a silly question but it's really troubling me. The rest of the movements would be made based on that one. If you have any questions related to the code itself, feel free to ask.
(comments are locked)
|
|
OK, I just figured it out. I'll leave the result here so as to give this question some closure. :) Here's how it went out:
I just tweaked a few things and added all the other directions. Hope it helps future programmers.
(comments are locked)
|
