Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mgechev/mk.js
Canvas implementation of basic fighting game which allows multiplayer over the network.
https://github.com/mgechev/mk.js
Last synced: about 1 month ago
JSON representation
Canvas implementation of basic fighting game which allows multiplayer over the network.
- Host: GitHub
- URL: https://github.com/mgechev/mk.js
- Owner: mgechev
- Created: 2013-02-25T16:08:50.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2022-02-23T03:30:38.000Z (over 2 years ago)
- Last Synced: 2024-05-09T13:08:50.386Z (6 months ago)
- Language: JavaScript
- Homepage: http://mk.mgechev.com/
- Size: 5.21 MB
- Stars: 1,520
- Watchers: 73
- Forks: 435
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# mk.js
This is simple fighting game created with HTML5 canvas and JavaScript. It has three game modes:
* `Basic` - with one active and on inactive player.
* `Multiplayer` - with two active players on one computer.
* `Network` - with two active players, playing over the network.Each mode can be easily chosen by picking a `gameType` when specifying the game options.
The `multiplayer` mode can be tested [here](http://mk.mgechev.com/).
The `Network` mode with `Web RTC Data Channel Demo` [here](http://ptpgamedemo.appspot.com).
For the network game you need to install the server:
git clone [email protected]:mgechev/mk.js
cd mk.js/server
npm install
node server.jsThe server will be started on port `55555`. Open your browser and go to `http://localhost:55555`. Both players must enter the same game name to play together.
# Configuration
In this section I'll describe in short how you can configure mk.js.
* `arena` - object which contains different properties for the arena.
* `arena` - type of the arena. The different arenas are listed at: `mk.arenas.types`
* `container` - parent container of the canvas which is the actual arena.
* `fighters` - array of two objects which are the two players.
* `name` - player's name. It's case insensitive string without any special characters and white space.
* ` callbacks` - callbacks which will be invoked when some events happens.
* `attack`- callback which will be invoked on successful attack
* `game-end` - callback which will be invoked on game end
* `player-connected` - callback which will be invoked in `network` game when the second player is connected.
* `game-type` - specifies the game controller which will be used. Possible values are: `network`, `basic` and `multiplayer`.
* `gameName` - used in `network` game.
* `isHost` - used in `network` game, tells the game controller whether the current user have created the game.
* `reset` - a method which reset the game. It clean some references and call the reset methods of lower level components. Calling it will lead to removal of the game canvas.# License
This software is distributed under the terms of the MIT license.