Week 8
This is the game frame constructor that calls the game panel and makes my window so i can play the game.
We got the game panel variables and constructor, where we set the screen size, where the "apple" will be, timers, etc. We also see the start game methods that will start the game and determines how long it will go.
we got paint method that makes it so we see the trail of the snake. draw method which draws it out, sets colors of the apple and the snake. Has the head brighter than the body. We see the new apple method that summons a new apple at a random place each time it is eaten.we have the movement method. where if you decide to go up, down, left, or right, it will. then we have check apples eaten so that it will summon a new one once eaten and add body parts to the snake.
We see if the body parts collide into each other or corners of the map.
the game over method that decides how the game ends, "game over" text, and showing the score. action performer runs the important methods to play the game.
and finally mykeyadapter method sees what keys you're pressing and acts accordingly
Java Snake Game 🐍 - YouTube. https://www.youtube.com/watch?v=bI6e6qjJ8JQ.







Comments
Post a Comment