Skip to content
jancastek edited this page Oct 3, 2018 · 26 revisions

You can use only one of the following controllers:


https://github.com/EntityB/gamee-doc-dev/blob/master/assets/controllers-selection-1.jpg?raw=true

OneButton

Controller with only one button. Binded to the spacebar on web.

TwoActionButtons

Controller with two action buttons (without symbol). Binded to the left and right arrow on web.

TwoButtons

Controller with two arrow buttons (arrow symbol). Binded to the left and right arrow on web.


https://github.com/EntityB/gamee-doc-dev/blob/master/assets/controllers-selection-2.jpg?raw=true

FullScreen

Full screen controller is different from others. It doesn't show any controll elements and game runs in full screen mode instead of 640x640 window. Controller doesn't provide any events.

gamee.gameInit("FullScreen", {}, capabilities, function(error, data) {
    if(error !== null)
        throw error;
        
    console.log(data.controller); // null

});

TwoArrowsOneButton (DEPRECATED)

Controller with two arrows and one action button.

TwoArrowsTwoButtons (DEPRECATED)

Controller with two arrows and two action buttons.

FourButtons (DEPRECATED)

Controller with three arrows and one action button. Binded to the up, left and right arrow and spacebar on web.


https://github.com/EntityB/gamee-doc-dev/blob/master/assets/controllers-selection-3.jpg?raw=true

FourArrows (DEPRECATED)

Controller with four arrows. Binded to the arrows on web.

FiveButtons (DEPRECATED)

Controller with four arrows and one action button. Binded to the arrows and spacebar on web.

SixButtons (DEPRECATED)

Controller with four arrows and two action buttons. Binded to the arrows, spacebar and ctrl on web.


https://github.com/EntityB/gamee-doc-dev/blob/master/assets/controllers-selection-4.jpg?raw=true

Joystick (DEPRECATED)

JoystickController emits change event, after the position of the joystick is changed.

The position of the joystick is in the property x and y. The position on axis is between <-1, 1> (for x -1 is max left position, 1 max right position). [0.0, 0.0] is the center.

gamee.gameInit("Joystick", {}, capabilities, function(error, data) {
    if(error !== null)
        throw error;

    var myController = data.controller;

    myController.on('touchstart', function(data) {
        myController.on('change', function() {
        new_x = myController.x;
        nex_y = myController.y;
    });

... // your code that should make game ready
});

JoystickWithButton (DEPRECATED)

JoystickButtonController is a JoystickController with one button.

gamee.gameInit("JoystickWithButton", {}, capabilities, function(error, data) {
    if(error !== null)
        throw error;

    var myController = data.controller;

    myController.on('touchstart', function(data) {
        myController.on('change', function() {
        new_x = myController.x;
        nex_y = myController.y;
    });

    joystickmyController.on('keydown', callback)

... // your code that should make game ready
});

Slider

gamee.gameInit("Slider", {}, capabilities, function(error, data) {
    if(error !== null)
        throw error;

    var myController = data.controller;

... // your code that should make game ready
});

https://github.com/EntityB/gamee-doc-dev/blob/master/assets/controllers-selection-5.jpg?raw=true

Touch (DEPRECATED)

Touch is deprecated, use Fullscreen controller instead.

This controller has no buttons. Instead it has a touchpad which triggers touchstart, touchend, touchmove, touchcancel, touchend events (similar to Touch event types)

The position of the touch is in the data.position argument as a x and y with the values between [0, 0] for the left top corner and [1, 1] for the bottom right corner ([0.5, 0.5] is the center).

gamee.gameInit("Touch", {}, capabilities, function(error, data) {
    if(error !== null)
        throw error;

    var myController = data.controller;

    myController.on('touchstart', function(data) {
        if (data.position.x < 0.5 && data.position.y < 0.5) {
            console.log('touch in the top left quadrant');
        }
    });

... // your code that should make game ready
});