![]() The window size will not usually be an even multiple of 42 points, the cells are Window, the game is reset back to the starting state. Starting window size is 700 x 700 interior pixels. Of the screen as a topmost layer at 30% opacity, centered in 28 pt black text, for Snake grows and shrinks, the current size and high score is reported at the top Player can do WEST - SOUTH - EAST to perform a 180 degree turn in 3 consecutive To permit fast maneuvers the direction inputs are queued, so that the A command to move in the direction already in motion So if the snake is traveling east, any attempted Snake, however, to prevent frustration the player is not allowed to move the The arrow keys change the direction of the Then the radii and border thickness are reduced accordingly. If the snake cells had to be reduced from 42 pt due to window size limitations, Remaining cells of the snake are drawn as a rounded rectangle with 2 pt corner radius. The head of the snake is drawn as a rounded rectangle with aĬorner radius of 8 pt and a border of 2 pt dark green. The snakeĬells are drawn in alternating colors lime green and lawn Squares with 2pts on the right and bottom to create a separation. Snake only is considered to have eaten the apple if the head moves onto theĪpple. TheĪpple may end up on occasion placed inside the body of the snake, however, the The apple is eaten, it is immediately respawned into a random new cell. If the snake moves into the Apple, the snake's length grows by 1. Initially the trail is limited to 5 cells As soon as an arrow key is pressed, the snake begins to move in thatĭirection, and leaves a trail behind. Which is the goal of the snake to eat, is one cell drawn as a circle in HTMLĬolor crimson, and is placed at a random location on the Start, the snake is set to length 1 and positioned at cell (4,4). Since the window size will not be an even number of cells, the cellsĪre stretched slightly so that all screen space is used by the grid. The snake wraps around the board inīoard, drawn solid black, is subdivided into square cells of 42 points at the screen The snake from that cell onward is erased. ![]() If the snake crosses over itself, then a beep is emitted and the part of Is increased by one, a crunch sound is emitted, and the apple is moved to a newĬell. If the snake moves into the apple the length Runs at 6 frames per second, and the snake moves one cell per frame. Specification by Edward de Jong, version 1 PROGRAMMING CHALLENGE A Snake Game / basic version
0 Comments
Leave a Reply. |