Private _custom_Private _dynamic_Private _hero_Private _interactable_Private _map_Private _npc_Private dataPrivate gamePrivate max_Static Private Readonly MINIMAL_Static Private Readonly ROTATION_This variable converts from normal_angle region (floor((angle-15)/30)) to in-game rotation.
Static Private Readonly SPEED_Static Private Readonly SPEED_Changes the map body according to a given collision layer index.
Target collision layer.
if true, it will also sort the sprites in the map after reordering the layers.
This function checks whether is necessary to stop when colliding or change the char direction in order to adapt its movement to the collision slope.
Creates npcs and interactable objects collision groups.
the current map.
Private config_Creates a custom body on interactable objects collision group. It can be a box, circle or polygon.
the custom body unique label name.
the x position of the body.
the y position of the body.
some properties regarding the type of the body.
Optional collision_The target collision layer for the body to be.
Optional height?: numberThe height of the box.
Optional points?: number[][]The array of polygon points.
Optional radius?: numberThe radius of the circle.
Optional width?: numberThe width of the box.
returns the created body.
Static get_Given a surface range, loop over the tiles in this range and find the intersection polygons for each tile.
the current map object.
the min x range in px.
the max x range in px.
the min y range in px.
the max y range in px.
Optional polygon: number[][]The polygon. The first and last positions are equivalent, and they MUST contain identical values.
Returns a JS Map where its key is a location key and its value is the list of polygons for this location key.
This class manages collision between the main concepts of the engine: map, hero, npcs and interactable objects.