GithubHelp home page GithubHelp logo

mrsnake's Introduction

Mr Snake

Mr. Snake is a clone of the Snake game that in the 90s was released with Nokia phones. The game provides a playing field consists of a grid 10 × 12 in which moves a snake, initially consists of a head, a tail and a body piece. The aim of the game is to acquire the most points by eating apples, cherries and oranges without the snake eat itself. For each fruit eaten the snake gets longer a piece making it harder to not eat himself.

This game has been created only for educational purpose, it has no claim to be a complete game distributable through the Android market. It's my belief that you can get inspiration from this source code to implement your own video games.

Screenshots

Main Menu Game

Video Demo

Video Demo

Limitations

Currently the game has only one level where the snake has an infinite theoretical life.

Credits

The author of the framework code, later modified by me, is Mario Zachner (@badlogic) that released the code with GPL3 license as a resource of the Beginning Android Games book. The framework is a very simplified version of the open source library Libgdx released under GPL3 license. The code of the video game is an evolution of the Mr Nom project released by Mario Zachner with GPL3 license as a resource of the same book.

License

GPL3

Related Projects

Droids, Alien Invaders

Installation & Run

Enable USB Debugging mode that on many devices from 3.2 up to 4.0 (excluded) is in Settings>Applications>Development. On devices from Android 4.0 and later, you’ll find them in Settings>Developer Options. On Android 4.2 and later the option is hidden by default. To make it reappear, go to Setting->Info on the device and tap Version Build 7 times, the option will become visible.

Enable installation from Unknown Sources clicking on Settings->Security.

Download the application clicking here and install it.

Installation & Run from source code

Download and install Android Studio. To do that accept all the default settings the installation procedure show you. If you already have Android Studio installed, make sure it is at the latest level. Once Android Studio is up and running make sure all projects are closed (if a project is open do File->Close Project), the "Welcome to Android Studio" Panel appears. Select the option "Check out project from version control" and then GitHub.

Fill the following fields:

Git Repository URL: https://github.com/sasadangelo/MrSnake.git
Parent Directory: <an empty directory previously created>
Directory Name: MrSnake

The source code will be downloaded and the MrSnake project will be created. Now you can run the code doing Run->Run. You can execute the code on Physical or Virtual device. For more details you can read the last section of the following article.

Troubleshooting

Sometime could happen that there is incompatibility between the level of gradle declared in the source code with the one installed in the development environment. When this occurs Android Studio will show also a link to fix it. Click the link to solve the issue.

mrsnake's People

Contributors

sasadangelo avatar sasadangeloibm avatar

Stargazers

Rodrigo Torres Peña avatar

Watchers

James Cloos avatar  avatar  avatar

mrsnake's Issues

Add an help screen

Snake is a well known game but there could be someone that do not know it. Add an help screen that explain briefly how it works.

Remove warnings from source code

When from Android Studio we commit a change set, the ide automatically perform a code analysis. From this code analysis we found the following warnings that must be removed.

C:\workspace.snakoid\Snakoid\app\src\main\AndroidManifest.xml
Warning:(4, 7) This versionCode value (1) is not used; it is always overridden by the value specified in the Gradle build script (1)
Warning:(5, 7) This versionName value (1.0) is not used; it is always overridden by the value specified in the Gradle build script (1.0)
Warning:(6, 6) App is not indexable by Google Search; consider adding at least one Activity with an ACTION-VIEW intent-filler. See issue explanation for more details.
Warning:(6, 6) Should explicitly set android:allowBackup to true or false (it's true by default, and that can have some security implications for the application's data)
Warning:(17, 6) <uses-permission> tag appears after <application> tag
Warning:(19, 15) This minSdkVersion value (3) is not used; it is always overridden by the value specified in the Gradle build script (8)
Warning:(19, 41) This targetSdkVersion value (8) is not used; it is always overridden by the value specified in the Gradle build script (22)
Warning:(19, 41) Not targeting the latest versions of Android; compatibility modes apply. Consider testing and updating this version. Consult the android.os.Build.VERSION_CODES javadoc for details.
C:\workspace.snakoid\Snakoid\app\src\main\java\org\androidforfun\snakoid\framework\impl\AndroidFastRenderView.java
Warning:(9, 14) Custom view AndroidFastRenderView is missing constructor used by tools: (Context) or (Context,AttributeSet) or (Context,AttributeSet,int)
C:\workspace.snakoid\Snakoid\app\src\main\java\org\androidforfun\snakoid\framework\impl\AndroidInput.java
Warning:(19, 37) 'SDK' is deprecated
C:\workspace.snakoid\Snakoid\app\src\main\java\org\androidforfun\snakoid\framework\impl\AndroidAudio.java
Warning:(22, 30) 'SoundPool(int, int, int)' is deprecated
C:\workspace.snakoid\Snakoid\app\src\main\java\org\androidforfun\snakoid\view\GameScreen.java
Warning:(27, 65) Explicit type argument SnakoidWorld.GameState, GameState can be replaced with <>
C:\workspace.snakoid\Snakoid\app\src\main\java\org\androidforfun\snakoid\framework\impl\MultiTouchHandler.java
Warning:(41, 65) 'ACTION_POINTER_ID_MASK' is deprecated
Warning:(41, 104) 'ACTION_POINTER_ID_SHIFT' is deprecated
C:\workspace.snakoid\Snakoid\app\src\main\java\org\androidforfun\snakoid\framework\impl\AndroidGame.java
Warning:(45, 58) 'getWidth()' is deprecated
Warning:(47, 58) 'getHeight()' is deprecated
Warning:(58, 58) 'FULL_WAKE_LOCK' is deprecated
C:\workspace.snakoid\Snakoid\app\src\main\java\org\androidforfun\snakoid\model\Settings.java
Warning:(60, 17) Manual array copy

Move snake using only touch

Currently the snake is moved using two buttons that turn it clockwise or the opposite.
This mechanism is not intuitive and a better approach is to move it only using touch and move the snake in the direction of the slide.

Graphics of Snakoid must be improved

Graphics of Snakoid must be improved:

  1. snake parts seems buttons. Give to the snake a more resemblance with the original animal.
  2. reduce the size of snake part. Currently it is 32x32 pixels.
  3. improve the field
  4. improve the logo

Avoid snake eat himself when double click

Currently if you double click left/right button the snake turn on himself and eat himself and the game is over. This should be avoided and the head of the snake must be always turned of a next cell on the grid.

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.