Description

Properties and methods for game characters: event, player or other. This class inherits to EntityModel from CanvasEngine API

Methods

setProperties

Assigns the character properties

moveto

Moves the character to a location on the map

lastTypeMove

The type of movement being from executing

removeTypeMove

By calling `approachPlayer` method and after `randomMethod` method, only the latest movement type is executed. This method remove a type.

approachPlayer

The event is approaching the player.

moveAwayFromPlayer

the direction of the event relative to the player. For example, if the player is right for the event, direction of the event will be on the right

turn

Changes the direction of the event (without moving) and displayed on the map

moveRoute

Assigns a specific motion event

moveRandom

Random walk in 4 directions

moveTilePath

Movement per tile. The array gives a path

moveOneTile

Movement per tile.

moveDir

Displacement in the direction. The character is moved by `1 pixel * speed`. Returns the new position of the character : {x: Integer, y: Integer} - Sprites on the scene are automatically refreshed. - This method is not executed for player if the `freeze` property is `true`

detectionEvents

Detects events around this event. Events are refreshed to activate a page with the self switch trigger

serialize

Transforms useful properties to an object for display : - id - x - y - nbSequenceX - nbSequenceY - speedAnimation - graphic_pattern - graphic - graphic_params - direction - direction_fix - no_animation - stop_animation - frequence - speed - regX - regY - alwaysOnBottom - alwaysOnTop - exist

makeExpList

Experience points necessary for each level.

addExp

Adds experience points. Changes level according to the experience points given. makeExpList() must be called before addExp()

setExp

Fixed experience points. Changes level according to the experience points given. makeExpList() must be called before setExp(). Return difference between two levels gained or lost. For example, if the return is 2, this means that the event has gained 2 levels after changing its EXP

setLevel

Sets the level of the event. Fixed points depending on the level of experience assigned. Returns difference between two levels gained or lost.

nextExp

Returns the number of experience points the next level as the character must achieve to increase to a level

setParam

Sets a parameter for each level

getCurrentParam

Get the value of a parameter at the current level of the event

setParamLevel

Assigns a value to a parameter to a specific level

setParamLevel

Add a value to a parameter to a specific level

initParamPoints

Initializes a point type

getParamPoint

Retrieves the current points of a type. Call the `initParamPoints` before

getAllParamsPoint

Returns all the types of points

changeParamPoints

Change the number of points of type. Call the `initParamPoints` before. If the points beyond the maximum or minium, callback functions defined in the `initParamPoints` method are called

equipItem

Equipping the event of an object. Useful for calculations of fighting

itemIsEquiped

Whether an item is equipped

removeItemEquiped

Whether an item is equipped. Return false if the object does not exist

getItemsEquipedByType

Get all items equiped in a type

getIndexEquipedById

Returns the position of the item equiped in the array. Returns false if the position is not found

getItemsEquipedByAttr

Finds the identifier of an item according to an attribute value. Returns false if the position is not found

skillsToLearn

Skills mastered at level-up for event

setSkillToLearn

Change the skill to learn for a specific level

setClass

Change the class of the event

setElements

Fixed elements to the event. Assigns the value to the `elements` property

getElement

Retrieves the percentage affectation of an element

setDefStates

Fixed states to the event. Assigns the value to the `defstates` property

learnSkill

To learn a skill. If status are present, they are afflicted with the character

removeSkill

Remove a skill

getSkill

Get a skill

addState

Adds a state event that affects his ability to fight or his movement. Common events can be triggered

removeState

Remove this state of a character

stateInflicted

Whether a state is inflicted in the event

addItem

Adds an item in the player's inventory.

removeItem

Removes an item from the inventory

useItem

Using objects. After use, the object is deleted. Modification of the parameters are afflicted and in particular the points `hp` and `sp`

getItem

Get object properties. Return property of the item or false if the item does not exist

getItems

Retrieves the items of a type

Discussion