Developer   API   Game Development   Game

  •  Config(0)
  •  Properties(3)
  •  Methods(11)
  •  Events(9)

Game : BaseClass

Example

include "lib://core/log.ms" // log stuff include "lib://game2d/game.ms" // transition class var game = new Game(); // main game object game.onStart = function() { } game.onDraw = function(sender, canvas) { canvas.clear(0xffff0000); } game.run(); // push another scene with animation game.push(this.level1, new SlideToLeft({duration:2000, transition:Animator.Transition.strongEaseOut}));

Properties

  • defaults : Object
    Sets default controls options.
  • options : Object
    Position of navigation bar.
  • this
    Construct of the object calls following method in order.

Methods

  • add(obj)
    Add sprite to the scene.
  • afterInitControls
    Method is executed after init controls.
  • beforeInit
    Sanity check before init of game object instance.
  • beforeInitControls
    Method is executed before init controls.
  • init
    Init game object instance.
  • invalidate()
    Redraw application window.
  • pop()
    Return to previous scene.
  • push(scene)
    Push new scane to the game.
  • quit()
    Quit application.
  • run(allowFPS = false)
    Start application.
  • undefined(k,v)
    Special property executed when priperty is undefined. It can be that JSON format is in format "key" : "value". Key is an string, so if this is the case methot return "value". Ass well as k is a regular property of the class it returns getter of this property.

Events

  • onChar(sender, charCode)
    This event is raised by release an UNICODE character key.
  • onDraw(sender)
    OnDraw event appears every time, when it is needed to redraw application window.
  • onKeyPressed(sender, key)
    This event is raised by press the key.
  • onKeyReleased(sender, key)
    This event is raised by release the key.
  • onPointerDragged(sender,x,y) : Function
    Called when touch (click) is moved.
  • onPointerPressed(sender, x, y)
    Called when touch (click) is stared.
  • onPointerReleased(sender,x,y) : Function
    Called when touch (click) is finished.
  • onProcess(sender)
  • onStart(sender)
    OnStart event appears, when application starts. It is called only once after start of application.