ig.

Player

new Player()

Base player entity. IMPORTANT: this is an abstract entity that should be extended. Tip: input is used to control the player character through the ig.GameExtended#playerManager.

Author:
  • Collin Hover - collinhover.com
Source:
Example
// normally, you'll want to extend the player abstract
// to create your own player character
myPlayerClass = ig.Player.extend({...});
// but it is not necessary, as all you really need
// is to give your player entity a name of "player"
// and extend the ig.Character abstract
// so the game can easily find and manage it
myPlayerClass = ig.Character.extend({
     name: "player"
});
// in fact, you don't even need to do that
// as long as you override the game's getPlayer method
// with a way to find your game's player so the player manager can find it
// because the only notable things the player abstract adds are
// a unique name, zIndex, performance, collides, persistent, and ability to interact

collides

Default Value:
  • lite
Source:

damageDelay

Player has a slight delay when taking damage.

Default Value:
  • 1
Source:

name

Player has player name by default for easier searches.

Default Value:
  • player
Source:

performance

Player performance is dynamic.

Default Value:
  • dynamic
Source:

persistent

Player entity should be persistent across levels.

Source:

zIndex

Player should be rendered above most other entities.

Source:
See:

checkAutomaticUtilities()

Hook into auto follow and auto manage so camera and manager don't need to constantly search for player (which is slow).

Source:

handleInput()

Handles input and translates it into actions. IMPORTANT: general movement input is now handled by ig.PlayerManager!

Source:

initProperties()

Initializes Player properties.

Source:

initTypes()

Initializes Player types.
- adds ig.EntityExtended.TYPE.PLAYER to ig.EntityExtended#type
- adds ig.EntityExtended.TYPE.DAMAGEABLE to ig.EntityExtended#type
- adds ig.EntityExtended.TYPE.MIMICABLE to {@link ig.EntityExtended#type}
- adds ig.EntityExtended.TYPE.PLAYER to {@link ig.EntityExtended#group}
- adds ig.EntityExtended.TYPE.FRIEND to {@link ig.EntityExtended#group}

Source:

spawn()

When player spawns, it ig.Player#checkAutomaticUtilities.

Source: