![]() Our game thread for the main game loop Call the Activity SnakeActivity and amend its code to be the same as this. Leave the rest of the settings at their defaults. If you want a more in-depth discussion of the interaction between the Activity and the main class then take a look at the Breakout tutorial.Ĭreate a new project in Android Studio, use the Empty Activity template, and call it Snake. Coding the Snake ActivityĪs usual, we will start with an Activity which will control a thread in a class which controls the game and handles input from the player. As the game continues and many Bobs are eaten the snake grows in length making it more likely that the player will trap or eat himself. ![]() Before anyone complains that snakes don’t eat Bobs, they don’t eat apples either. One dot for the snake and one dot for Bob waiting to be eaten. Take a look at this image to see the game at the start. The reason for this is we can recreate a authentic blocky/jumpy animation. ![]() This game will use a different engine to the other games on this site as it will make a pre-determined number of “moves” each second, rather than playing as many frames of animation as possible and then timing each frame for maximum smoothness. ![]()
0 Comments
Leave a Reply. |