Giter Site home page Giter Site logo

mk.js's Introduction

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.

The Network mode with Web RTC Data Channel Demo here.

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.js

The 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.

mk.js's People

Contributors

codekonami avatar kongaraju avatar martinvd avatar mgechev avatar odahcam avatar sbley avatar xat avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mk.js's Issues

Reset functionality

Reset functionality should be added to the game.
The game should have reset method which responsibility will be to clean references and delegate the reset action to lower levels of abstraction (such as the current game controller, arena, moves and fighters).
If the corresponding game controller implements its own reset method (for whatever purpose, for example reset the network connection), the reset method of the global object mk should call it.

File not cloning

$ git clone [email protected]:mgechev/mk.js
Cloning into 'mk.js'...
[email protected]: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
Showing this error☝

error occured

/Users/yasarsalim/Desktop/apps/html5games/mk.js/server/node_modules/socket.io/lib/store.js:35
Store.prototype.proto = EventEmitter.prototype;
^

TypeError: Cannot read property 'prototype' of undefined
at Object. (/Users/yasarsalim/Desktop/apps/html5games/mk.js/server/node_modules/socket.io/lib/store.js:35:41)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at Object. (/Users/yasarsalim/Desktop/apps/html5games/mk.js/server/node_modules/socket.io/lib/manager.js:16:13)
at Module._compile (module.js:571:32)

New Characters

Hey @mgechev !!!

Your work is so cool. and I really enjoyed it. as a mortal kombat fan, if you can, please add more characters like Scorpian, Jax, Kung lao or Liu kang. btw your work is cool. thank you for creating it.

Deduplicate Left and Right images

Hiu There? Wouldnt it make sense to deduplicate the left and right images and just flip the images by code? That would mke the sourcecode even smaller... and potentially even faster since your reusing the images (although that would be noticable on a fast computer with a fast connection).

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.