Client API. The Codename One framework your app is built on: this runs on the device, not in a backend.
package com.codename1.gaming.platformer
A deterministic 2D platformer engine: the character controller, abilities and level model behind the Ledge template, in the spirit of Unity’s Corgi Engine.
The simulation is integer only (Fx fixed point, 60 ticks a second) and shared
with the backend, so a run recorded as an InputLog replays identically on the
server (Replay) – leaderboards, ghosts and speedruns can be verified rather
than trusted.
TileGridandTile: the collision map, written as rows of characters.Body: a kinematic box with slopes, one-way platforms, steps and riding.MovingPlatform: waypoint platforms that carry riders.ActorandAbility: a body driven by an ordered list of abilities –MoveAbility,JumpAbility(coyote time, buffering, variable height, multi-jump, drop-through),CrouchAbility,LadderAbility,WallJumpAbilityandDashAbility.PlatformWorld: steps everything one tick fromInputbits.LevelDataandLevelJson: the JSON level format.
LevelData is not a com.codename1.gaming.level.GameLevel, and
PlatformWorld is not a com.codename1.gaming.level.GameWorld. Those
are authoring data for any game – layers, elements placed in doubles,
regions streamed in and out – turned into sprites and models. This package
is a deterministic simulation the server replays, so it holds only whole
tiles and 16.16 fixed point and touches no image. A GameLevel drawn in the
game builder becomes a LevelData through
com.codename1.gaming.platformer.view.GameLevelImport.
InputLogandReplay: recording and verifying runs.
Types
class AIBrain shared | Enemy behaviour as a small state machine of actions and decisions, after Corgi Engine’s AI Brain. |
class Abilities shared | Creates the stock abilities by name, as level files, power-ups and the editor refer to them. |
class Ability shared | One thing a Actor can do – walk, jump, dash, climb – as a small, separately tunable unit, in the manner of Corgi Engine’s character abilities. |
class Actor shared | A player or an enemy: a Body driven by an ordered list of Abilitys. |
class BlockEntity shared | Base for entities that are made of solid tiles which come and go: doors, gates and crumbling blocks. |
class Body shared | A kinematic box that moves through a TileGrid: the platformer’s collision controller. |
class Checkpoint shared | A checkpoint: touching it moves the player’s respawn point here. |
class CrouchAbility shared | Crouching and crawling: holding down on the ground shrinks the body to crouchHeight, keeping its feet in place. |
class CrumbleBlock shared | A floor that gives way: delayTicks after the player first stands on it, its cells vanish, and they come back respawnTicks later (never, if 0). |
class DashAbility shared | A horizontal dash on Input#DASH: dashTicks at dashSpeed in the facing direction with gravity off, then a cooldownTicks wait. |
class Door shared | A locked door: solid until the player touches it holding the key it names, which is used up. |
interface EntityFactory shared | Creates a game’s own entity types from level JSON, for types LevelData does not know. |
class FlyAbility shared | Free flight with no gravity, steered on both axes, for bats, ghosts and drones (and a debug camera hero). |
class Fx shared | 16.16 fixed-point arithmetic for the platformer simulation. |
class GameRules shared | A game’s own rules over a PlatformWorld: when it is won, when it is lost, what happens when an actor dies and what is checked every tick. |
class Gate shared | A gate wired to a channel: open while the channel is on (or off, when inverted). |
class GlideAbility shared | Gliding: holding Input#ALT (or jump, when holdJump) while falling caps the fall at glideFall. |
class GripAbility shared | Ledge grab: falling past the top corner of a solid tile while holding toward it, the actor catches the edge and hangs (MovementState.GRIPPING). |
class HitPoints shared | Hit points, invulnerability frames and knock-back for a Actor. |
class Input shared | The buttons an actor reads, as bits of one int per tick. |
class InputLog shared | A recorded run: one Input value per tick, run-length encoded. |
class JetpackAbility shared | A jetpack: holding Input#ALT in the air thrusts upward while fuel lasts; fuel refills on the ground. |
class JumpAbility shared | Jumping, with the forgiveness that makes a platformer feel right: |
class LadderAbility shared | Climbing Tile#LADDER cells. |
class LevelData shared | A platformer level as data, read from JSON and turned into a PlatformWorld. |
class LevelEntity shared | Something in a level that is not an actor: a coin, a spring, a door, a projectile, a crumbling block. |
class LevelJson shared | A small JSON reader and writer for level files, shared by the app and the server. |
class LookAbility shared | Looking up and down: holding up, or down, while standing still for delayTicks sets a look direction that a camera pans by (see getLook()). |
class MoveAbility shared | Horizontal movement: walking, running while Input#RUN is held, crawling while crouched, with separate acceleration on the ground and in the air. |
enum MovementState shared | What a Actor is doing this tick, which a renderer maps to an animation clip (see ActorAnimator) and abilities read to stay out of each other’s way. |
class MovingPlatform shared | A platform that travels back and forth along a path of waypoints and carries whatever stands on it. |
class Pickup shared | A collectible: a coin or gem that scores, a heart that heals, a key, an extra life, or a power-up that switches an ability on. |
class PlatformWorld shared | The whole platformer simulation: a TileGrid, its MovingPlatforms, the Actors and LevelEntitys in it, advanced one fixed tick (1/60 s) at a time. |
class Projectile shared | A bullet, arrow or fireball: flies at a fixed velocity, optionally falls, and damages the first actor of another team it touches. |
class PushBlock shared | A crate a player pushes one tile at a time by walking into it, the piece puzzle platformers are built from. |
class Replay shared | Plays a recorded run against a level and reports what happened, which is how a server verifies a score instead of trusting it. |
class Rng shared | SplitMix64, the simulation’s only source of randomness. |
class Solver shared | Proves a level can be finished by finding a run that finishes it. |
class Spring shared | A spring pad that launches whoever lands on it upward at power, restoring their air jumps. |
class SwimAbility shared | Swimming in Tile#WATER: weak gravity, a slow sink, and a stroke upward on each jump press. |
class Switch shared | A lever or a pressure plate on a channel. |
class Tile shared | The collision kinds a TileGrid cell can hold, and the actors a level file writes them with. |
class TileGrid shared | The collision map of a level: a grid of Tile kinds. |
class TiledImport | Turns a map drawn in the Tiled editor into a level, so levels can be made in the tool most 2D games already use. |
class WallJumpAbility shared | Wall clinging and wall jumping. |
class WeaponAbility shared | Firing on Input#FIRE: projectiles (a blaster, a bow) or a melee swing, with a cooldown, optional ammunition and eight-way aiming from the held directions. |
class WorldEvent shared | Something that happened in a tick that a view should show or play: a jump, a coin, a hit. |