AutumnSnaky 1.0


I created this game in 4 days, although it took me a long time to come up with the idea for the game itself before that. But this is a simple classic snake, what’s so complicated about it? The classic snake uses a network, that is, each part of the snake, after a short delay, moves into a slot behind the other part. I haven't used this method. The game was made in Unity and the snake class is contained in the head, in it, in the Update method, each part of the snake moves after the next part in the list.

In addition to the movement in Update, the rotation also changes. This part of the game took me the longest to complete. The problem was that rotation in Unity is measured not in degrees, but in Quaternion. Quaternions are easily converted to degrees using one .Euler method. Also, I didn’t need an instant turn of part of the snake to the next part, but a gradual one. For this, I first used Vector3.Lerp, but it did not work correctly, changing degrees abruptly from positive to negative, causing parts of the snake to rotate incorrectly. After that, I tried other methods in Unity for a long time to change the rotation, but none worked, and after a few hours I found the right method that works perfectly - Quaternion.Slerp. The funny thing is that although the names are very similar, it works differently than Lerp, it changes the rotation more smoothly without sudden changes in degrees.

The music I used was the same as in my game CheezyGame, it's free, very fun and simple background music. I really liked her.

I made the movement of the mice quite quickly. When the distance is less than 5, they calculate the vector of movement of the snake's head and begin to move in the opposite direction.

Spawning mice and apples was done using IEnumerator. Also, I did not use Instantiate and Destroy even once in the game, as it leaves a lot of garbage, considering that there are more than 400 objects in the game. So I created them all in advance on the stage and used a pool, turning them on or off as the snake grew smaller or larger. Although the scene takes much longer to load because of this, now the game’s performance will not suffer due to garbage. 

What would you do, use Instantiate or a pool of pre-made objects?

Files

AutumnSneaky.zip Play in browser
Oct 08, 2023

Leave a comment

Log in with itch.io to leave a comment.