1.0.11 • Published 9 years ago
horizon-joy v1.0.11
HorizonJoy
Adopt your game for TV by using mobiles as controllers
Usage
- Get HorizonJoy from NPM with
npm i horizon-joy --save - Include
dist/JoyGame.jsinto project - Now you have window.joyGame which is an events emitter and is your gate to the world of Horizon Joy
- You may listen to joystick events with
joyGame.addEventListener(eventName , callback); - You run the game on box or TV
- User opens http://horizonjoy.com on his phone (phone should be on same internet router to join the game)
- Now user is able to use gamepad which sends events to the game running on TV
Events
playerenter- someone opened http://horizonjoy.com from your router and entered game on your TV, seems you should spawn a new player, callback passed argument will give you some data about user joinedplayerquit- someone quit game, seems you should remove a player using id from callback passed argumentkeydown- key was pressed. Callback argument brings some data about keyCode and user who pressedkeyup- key was released. Callback argument brings some data about keyCode and user who pressed
Demo
Please, have a look at Bombergirl demo we have in demo folder.
This is a third aparty HTML5 game which was modified to use HorizonJoy.
You might be interested in GameEngine.js:321, GameEngine.js:327 and InputEngine.js:30
To run demo please do following:
- run
bower installin demo folder; - launch web server on this repository root;
- open http://yourwebserver/demo/ on desktop;
- open http://horizonjoy.com on mobile or Chrome using mobile debugging mode;
- enjoy playing bomberman alltogether
Bombergirl developed by Matouš Skála ( http://matousskala.cz ) and is distributed under Creative Commons license.
Issues
Feel free to drop your questions to hi@denisradin.com