EPOK RUNTIME
epok::CharacterBody2DComponent
Class
Declarations are extracted from the pinned headers. Examples and general guidance are generated sketches, not verified complete programs; consult the linked source and guides for the actual contract.
Class
The move_and_slide contract on the bounded World2D solver: `velocity` is in pixels per second, `up_direction` defaults to screen up (0, -1), and the body moves through its actor's first solid Collider2D.
Basic usage
This generated sketch illustrates syntax for reaching the type; adapt it to the actual API contract. Open a member below for an operation-specific example.
C++ example
#include "world2d_components.hpp"
epok::CharacterBody2DComponent& value = /* obtain a valid instance from your game */;Fields and constants
blocked_velocityThe velocity the last move_and_slide lost against what it hit, and the actor of the wall it hit (characters push rigid bodies with them).Fieldcollision_maskExposes `collision_mask` on `epok::CharacterBody2DComponent` for the world2d components module.FieldfloatingFloating bodies (top-down games) treat every collision as a wall.Fieldfloor_max_angleExposes `floor_max_angle` on `epok::CharacterBody2DComponent` for the world2d components module.Fieldfloor_snap_lengthExposes `floor_snap_length` on `epok::CharacterBody2DComponent` for the world2d components module.Fieldlast_colliderExposes `last_collider` on `epok::CharacterBody2DComponent` for the world2d components module.Fieldlast_hit_tileExposes `last_hit_tile` on `epok::CharacterBody2DComponent` for the world2d components module.Fieldlast_motionExposes `last_motion` on `epok::CharacterBody2DComponent` for the world2d components module.Fieldlast_tileCell of the last tile hit, when the last collision was a TileMapLayer.Fieldlink2dExposes `link2d` on `epok::CharacterBody2DComponent` for the world2d components module.Fieldon_ceilingExposes `on_ceiling` on `epok::CharacterBody2DComponent` for the world2d components module.Fieldon_floorExposes `on_floor` on `epok::CharacterBody2DComponent` for the world2d components module.Fieldon_wallExposes `on_wall` on `epok::CharacterBody2DComponent` for the world2d components module.Fieldstatic_class_idExposes `static_class_id` on `epok::CharacterBody2DComponent` for the world2d components module.Variableup_directionExposes `up_direction` on `epok::CharacterBody2DComponent` for the world2d components module.FieldvelocityExposes `velocity` on `epok::CharacterBody2DComponent` for the world2d components module.Fieldwall_colliderExposes `wall_collider` on `epok::CharacterBody2DComponent` for the world2d components module.FieldPublic methods
~CharacterBody2DComponentReleases the resources owned by `epok::CharacterBody2DComponent`.destructorclass_idPerforms `class id` as part of the world2d components module.Methodis_on_ceilingReports whether on ceiling as part of the world2d components module.Methodis_on_floorReports whether on floor as part of the world2d components module.Methodis_on_wallReports whether on wall as part of the world2d components module.Methodlast_collision_actorPerforms `last collision actor` as part of the world2d components module.Methodlast_collision_is_tileWhether the last collision was a tile of a TileMapLayer (last_collision_actor is its actor).Methodlast_motion_xPerforms `last motion x` as part of the world2d components module.Methodlast_motion_yPerforms `last motion y` as part of the world2d components module.Methodlast_tile_xCell column / row of that tile.Methodlast_tile_yPerforms `last tile y` as part of the world2d components module.Methodlevel_attachedPerforms `level attached` as part of the world2d components module.Methodmove_and_collideMoves by an explicit displacement (pixels) and stops at the first obstacle.Methodmove_and_slideMoves by velocity * step, slides along what it hits, zeroes the velocity components pushing into the obstacle and refreshes the floor/wall/ceiling state.Methodmove_and_slide_stepExplicit-step adapter over the same solver, snap and classification path.Methodset_velocitySets velocity as part of the world2d components module.Methodvelocity_xPerforms `velocity x` as part of the world2d components module.Methodvelocity_yPerforms `velocity y` as part of the world2d components module.Method