API Docs for: 0.1.0
Show:

CG.GameController Class

Extends CG.Stick
Module: CG

CG.GameController extends CG.Stick an represents an GameController with one Stick and multiple buttons


                        stick = new CG.GameController({
                                   maxLength: 60,
                                   buttons: [
                                       new CG.Button({
                                           //text: 'J',
                                           //font: heiti,
                                           image: Game.asset.getImageByName('jump'),
                                           position: new CG.Point(Game.width - 200, Game.height - 75),
                                           callbacks: {
                                               clicked: function () {
                                                   b2world.player.startJump()
                                               }
                                           }
                                       }),
                                       new CG.Button({
                                           //text: 'J',
                                           //font: heiti,
                                           image: Game.asset.getImageByName('shoot'),
                                           position: new CG.Point(Game.width - 100, Game.height - 175),
                                           callbacks: {
                                               clicked: function () {
                        
                                               }
                                           }
                                       })
                                   ]
                               })
                        

Methods

init

(
  • options
)

Inherited from CG.Stick but overwritten in cangaja/input/gamecontroller.js:44

Options: x {number} y {number}

Parameters:

Returns:

:

Example:

Properties

active

Boolean

atLimit

Boolean

handle

Number

Default: CG.LEFT_HAND

identifier

Number

input

Object

length

Number

limit

Object

maxLength

Number

normal

Object