GithubHelp home page GithubHelp logo

snake's Introduction

Snake

This is my first snake game. In this post, I will introduce some of my ideas and how I implemented them.

Figure 1 shows the main page of the game:

My Image(Figure 1)

Figure 2 shows a single dialog that displays the game's playing guide when the user clicks on a button in the menu bar. The user can read it to understand the game's rules and get some hints on how to achieve higher scores.

My Image(Figure 2)

These five buttons and text fields are user-oriented, making it easy for users to control them when playing the game (see Figure 3).

My Image (Figure 3)

Figure 4 shows the main page that users see when they open or restart the game. They can start the game by clicking the 'Start' button, which will display the window shown in Figure 1.

My Image(Figure 4)

If users want to temporarily stop playing the game, they can click the 'Suspend' button, which will pause the game. To resume the game, they simply click the button again. When the game is suspended, a message will be displayed on the screen, as shown in Figure 5.

My Image(Figure 5)

If users need some help playing the game, they can click the 'Help' button, which will display some short messages that introduce them to the basic rules and functions of the game (see Figure 6). To close the game, users can click the 'Quit' button.

My Image(Figure 6)

The score field records the current score earned by the player, while the life field shows the number of lives remaining for the snake. The highest score field displays the highest score achieved in the player's history of playing the game.

During the game, I implemented three types of apples with different properties:

My ImageRed apples: they provide one score and grant an extra life to the snake every time ten scores are achieved. They also increase the snake's speed.

My ImageYellow apples: they grant an extra life to the snake and increase its speed.

My ImageBlue apples: they decrease the snake's life but also reduce its speed.

The program draws the snake with red and green dots, where the red dot represents the head and the green dots represent the body. (See Figure 7).

My Image(Figure 7)

snake's People

Contributors

sunnywoka avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.