1.0.11 • Published 8 years ago

horizon-joy v1.0.11

Weekly downloads
1
License
ISC
Repository
github
Last release
8 years ago

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.js into 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 joined
  • playerquit - someone quit game, seems you should remove a player using id from callback passed argument
  • keydown - key was pressed. Callback argument brings some data about keyCode and user who pressed
  • keyup - 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:

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

1.0.11

8 years ago

1.0.10

8 years ago

1.0.9

8 years ago

1.0.8

8 years ago

1.0.7

8 years ago

1.0.6

8 years ago

1.0.5

8 years ago

1.0.4

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago