Giter VIP home page Giter VIP logo

snakeapp's Introduction

#Snake!

##Goal The goal is to create an interface to the snake game. The clients connect to a server which allows to play snake against other players. At the end of the workshop everyone should atleast have implemented the basic controls needed for the game: navigate up, down, left and right. Also the user should be able to pick a name and a color for the snake. Of coarse its possible to show more information in the app, like the current ranking and even a live screen with the current position of the snakes.

##Servers There are 2 servers running:

##Clone the project git clone [email protected]:manmetplok/snakeapp.git

##Add a platform cordova platform add android

##Run the app (connect a phone first!) cordova run android

##File locations:

  • www/index.html -> The html page thats loaded by cordova.
  • www/js/index.js -> The javascript file that contains the logic.

##Available javascript calls:

  • app.start(name, color) -> Start the game with a username and color for the snake. (Now called automaticly when the app is started)
  • up() -> Move up
  • down() -> Move down
  • left() -> Move left
  • right() -> Move right

##Available websocket messages ( not need for a working app ) Events from server:

  • snakes -> Send to all clients every few milleseconds with detailed information about each snake. Use with care
{"name":"snakes","args":[{"type":"snakes","value":[{"name":"henk","color":"#ff0000","id":3,"deaths":0,"length":8,"direction":"right","elements":[[39,22],[40,22],[41,22],[42,22],[43,22],[44,22],[45,22],[46,22]],"kills":0}]}]}
  • snakeAdded -> Send to all clients when a new snake enters the game.
{"name":"snakeAdded","args":[{"id":1,"name":"henk"}]}
  • snakeRemoved -> Send to all clients when a snake leaves the game.
{"id": 1}
  • id -> Send when the client connects, contains the id for the current client.
{"name":"id","args":[{"id":1}]}

snakeapp's People

Watchers

Jorrit Everts avatar James Cloos 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.