Nearsighted Paramecium Multiverse

    horizon-joy

    1.0.11 • Public • Published

    HorizonJoy

    Adopt your game for TV by using mobiles as controllers

    joystick

    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

    Keywords

    none

    Install

    npm i horizon-joy

    DownloadsWeekly Downloads

    0

    Version

    1.0.11

    License

    ISC

    Last publish

    Collaborators

    • pixelscommander