assg1 - EE3206 Assignment One Hyper Snake (Due Date: 16...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
1 EE3206 Assignment One Hyper Snake (Due Date: 16 Oct. 23:59) Objectives: Learn to program simple game logic with Java Learn to model entities in a program with Java class and object Introduction Snake is a video game that originated during the late 1970s in arcades and has maintained popularity since then, becoming something of a classic. The player controls a long and thin snake which roams around on a bordered plane, picks up apples, and tries to avoid hitting its own tail or the walls that surround the playing area. Each time that the snake eats an apple, its tail grows longer, making the game increasingly difficult. The user controls the direction of the snake's head (up, down, left, or right), and the snake's body follows. The player cannot stop the snake from moving while the game is in progress, and cannot make the snake go in reverse. In this assignment, you are asked to implement the classic Snake game described above (Figure 3 to 6). In order to help you work out the graphical frontend, a handy graphical library is provide for you with a few simple methods that allow you to paint the snake game on screen and interact with user inputs. The library contains one single class, GameConsole under the package game . It has the following eight public methods: GameConsole() // constructor void showGameBoard() GameConsole drawIcon(int x, int y, int icon) GameConsole drawText(int x, int y, String text) void update() void idle(int ms) void gameOver() int getPressedKey() The method names and argument names are pretty self-explained. Here are some code snippets to demonstrate the usage:
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
2 The very first thing you need to do is to create a GameConsole object and make it visible to the screen. GameConsole gc = new GameConsole();
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 01/10/2012 for the course EE 3206 taught by Professor Cwting during the Spring '07 term at City University of Hong Kong.

Page1 / 6

assg1 - EE3206 Assignment One Hyper Snake (Due Date: 16...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online