Optional
Beta
charSets the
character layer
of the character. If omitted the lowest character layer of the tilemap is
taken. If there are no character layers in the tilemap, it will get the
char layer undefined
.
Optional
collidesSet to false, if character should not collide (neither with the tilemap, nor with other characters). For more control, pass a CollisionConfig object.
true
Optional
containerA container that holds the character’s sprite. This can be used in order to move more game objects along with the sprite (for example a character’s name or health bar). In order to position the container correctly on the tiles, it is necessary that you position the character’s sprite on position (0, 0) in the container.
If you pass both, a container and a sprite, only the container's pixel position will be changed on movement. That is only relevant if you pass a sprite that is not included in the container.
The height of the container is needed for depth sorting. Because calculating the container height is an expensive operation, it will be cached in Grid Engine. If you change the height of the container, make sure to set it to for character again to refresh the cached height.
For more details see the container example.
Optional
facingSets the direction the character is initially facing.
{@link Direction.DOWN}
A unique identifier for the character on the map. If you provice two characters with the same id, the last one will override the previous one.
Optional
labelsSets labels for the character. They can be used to filter and logically group characters.
[]
Optional
numberThe possible number of directions for moving a character. This setting can be used to override the global setting in the GridEngine configuration for specific characters.
Optional
offsetXA custom x-offset for the sprite/container.
0
Optional
offsetYA custom y-offset for the sprite/container.
0
Optional
speedThe speed of a player in tiles per second.
4
Optional
spriteThe character’s sprite.
Optional
startStart tile position of the player.
{x: 0, y:0}
Optional
tileHeight of the character in tiles. This allows to specify character that span more than just one tile.
1
Optional
tileWith of the character in tiles. This allows to specify character that span more than just one tile.
1
Optional
walkingIf not set, automatic walking animation will be disabed. Do this if you want to use a custom animation. In case of number: The 0-based index of the character on the spritesheet. Here is an example image showing the character indices. In case of WalkingAnimationMapping: Alternatively to providing a characterIndex you can also provide a custom frame mapping. This is especially handy if your spritesheet has a different arrangement of frames than you can see in the example image (4 rows with 3 columns). You can provide the frame number for every state of the character.
For more details see the custom walking animation mapping example.
Configuration object used to initialize a new character in GridEngine.