Constructors
- Animation
- IsoCharacter
- Path
- PhysicsObject
- SceneObject
- SceneObjectGroup
- Sprite
- TextSprite
- TilemapCharacter
- wade
- wade.drawFunctions
- wade.iso
- wade.physics
- wade.tilemap
- wade.vec2
Fields Summary
TilemapCharacter._gamepadStates
Current state of the gamepad to base movement off
TilemapCharacter._keyStates
Current state of the keys to base movement off
TilemapCharacter.allowDiagonal
Whether or not to allow diagonal movement, true by default
TilemapCharacter.allowInput
A flag that specifies if the character can be controlled by player input
TilemapCharacter.animations
Specify the animation names to use for various walking and idle states
TilemapCharacter.automaticRotations
Automatically rotates object to match movement
TilemapCharacter.controls
Keyboard keys to control the character. By default arrow keys are used
TilemapCharacter.gamePadControls
Axis and direction of gamepad controls
TilemapCharacter.gamePadIndex
The game pad to use
TilemapCharacter.movementSpeed
The movement speed of the character (in world units per second). Note that changing this won't affect any movement that is currently in progress, only future movements. Default is 160.
TilemapCharacter.name
The name of the behavior. This is set to 'TilemapCharacter'.
TilemapCharacter.rotationOffset
Used for automatic rotations. A sprite can have any orientation
TilemapCharacter.velocity
Current velocity of the object
Functions Summary
TilemapCharacter._inputState (direction)
Looks at both keyboard and gamepad state data to determine movement
TilemapCharacter.boxInGrid (box)
TilemapCharacter.calcFutureCoords (pos, vel)
Applies one tick of velocity to the position, and returns the final cell co-ordinates
TilemapCharacter.clearDestinations ()
Remove any destinations that were added with setDestination()
TilemapCharacter.generateCollisionBox ()
Constructs a collision box based on the bounding boxes of all sprites belonging to the scene object.
TilemapCharacter.getNextDestination ()
Get the next destination
TilemapCharacter.handleTileTransition (futureCoords)
Tests and handles moving into a new tile
TilemapCharacter.illegalTile (dest, exception)
Returns true if either the tile is off the grid, or the tile contains a collidable object
TilemapCharacter.inGrid (x, y)
Helper Function - Returns whether the co-ordinates are inside the tilemap boundary
TilemapCharacter.onAddToScene (params)
Initialises the collision box and sets the local rotation value from the parent
TilemapCharacter.onKeyDown (data)
Updates keyboard state
TilemapCharacter.onKeyUp (data)
Updates keyboard state
TilemapCharacter.onUpdate ()
Update character state based on user input
TilemapCharacter.overlappingTerrainTiles (displace)
Returns tile co-ordinates of all terrain tiles overlapping the character
TilemapCharacter.setDestination (gridCoords)
Set a destination (a tile to move to) for the character.
TilemapCharacter.setRotationOffset (offset)
Calculates the rotations needed for the character
TilemapCharacter.updateAnimation (direction, noMove)
Plays the correct animation depending on the control input state
TilemapCharacter.updateGamepadState ()
Samples the gamepad to get the current states of the buttons and axis
TilemapCharacter.updateVelComponent (noMove, vel, direction)
Adds a direction velocity, taking into account diagonal motion
TilemapCharacter.updateVelocity ()
Updates the velocity and calculates the closest direction for the animation system
TilemapCharacter.velocityToDirection (vel)
Returns the closest movement direction given a provided velocity