![]() |
Gondwana Game Engine
Gondwana is a cross-platform 2.5D game and rendering engine written in C#/.NET 8. It provides fine-grained control over rendering, timing, and scene composition, with built-in support for parallax, z-ordering, pixel overhang, collision detection, and particle effects. Gondwana targets desktop, mobile, and web platforms using SkiaSharp for graphics and NAudio for sound.
|
Central controller responsible for managing all movement modes for a single IMovable object. Combines three systems:
The controller automatically selects the correct behavior each frame internally through AdvanceMovement(float). More...
Public Member Functions | |
| void | StopAllMovement () |
| Immediately stops all forms of movement — follow, scripted, and integrated. Cancels active tweens, clears velocity and acceleration, and halts motion this frame. | |
| void | Dispose () |
| Releases resources and detaches all event handlers. | |
| void | FollowPixelSoft (Func< Vector2 > getPixelPos, float speed, float snap=0.5f, Vector2 offsetPx=default) |
Start following a pixel-space target at a constant speed. The speed and snap units are interpreted in the follower's position space:
| |
| void | FollowPixelSoft (Func< Vector2 > getPixelPos, float durationSec, Func< float, float >? easing=null, float snap=0.5f, Vector2 offsetPx=default) |
Start following a pixel-space target using a duration-based tween (easing). When easing is active, speed fields are ignored. The snap value is interpreted in the follower's space at runtime:
| |
| void | FollowPixelSoft (Func< Vector2 > getPixelPos, float durationSec, EasingKind easingKind, float snap=0.5f, Vector2 offsetPx=default) |
Start following a pixel-space target using a duration-based tween (easing). When easing is active, speed fields are ignored. The snap value is interpreted in the follower's space at runtime:
| |
| void | FollowPixelHard (Func< Vector2 > getPixelPos, Vector2 offsetPx=default) |
| Hard-follow a pixel-space target. The follower snaps directly to the target every update (no tweening, no speed). An optional pixel offset is applied only for pixel-space followers. | |
| void | FollowTileSoft (IMovableOnSceneLayer tileTarget, float speedTilesPerSec, float snapTiles=0.25f, Vector2 gridOffset=default, Vector2 pixelOffset=default) |
| Start following a grid (tile) target at a constant speed (tiles/sec). If the follower is pixel-space, an additional pixel offset can be applied after the grid→pixel conversion. | |
| void | FollowTileSoft (IMovableOnSceneLayer tileTarget, float durationSec, Func< float, float >? easing=null, float snap=0.5f, Vector2 gridOffset=default, Vector2 pixelOffset=default) |
| Start following a grid (tile) target using a duration-based tween (easing). When easing is active, speed fields are ignored. Snap tolerance is stored for both pixel and tile spaces; the runtime branch uses the follower's space. | |
| void | FollowTileSoft (IMovableOnSceneLayer tileTarget, float durationSec, EasingKind easingKind, float snap=0.5f, Vector2 gridOffset=default, Vector2 pixelOffset=default) |
| Convenience overload of FollowTileSoft(IMovableOnSceneLayer, float, Func<float, float>?, float, Vector2, Vector2) that specifies the easing curve via EasingKind. | |
| void | FollowTileHard (IMovableOnSceneLayer tileTarget, Vector2 gridOffset=default, Vector2 pixelOffset=default) |
| Hard-follow a grid (tile) target. The follower snaps directly to the target grid coordinate each update (no tweening, no speed). If the follower is pixel-space, pixelOffset is applied after grid→pixel conversion. | |
| void | Unfollow () |
| Stop following any target and clear all follow/tween state (targets, speeds, offsets, easing, hard mode). Any in-flight scripted/tweened movement is cancelled immediately. | |
| void | SetVelocity (Vector2 velocity) |
| Sets the velocity of the object. | |
| void | SetAcceleration (Vector2 acceleration) |
| Sets the acceleration of the object. | |
| void | SetMaxSpeed (float? maxSpeed) |
| Sets the maximum speed for the current state. Only applies to integrated movement. | |
| void | SetLinearDamping (float dampingPerSec) |
| Sets the linear damping value, which determines the rate at which linear motion is reduced over time. | |
| void | MoveTo (Vector2 target, float durationSec, Func< float, float >? easing=null, float snapEpsilon=0.5f) |
| Begins a scripted tween toward the specified target position over a fixed duration. This method interpolates linearly or with an optional easing function from the mover’s current position to the target, automatically cancelling any existing scripted or physics-based movement. | |
| void | MoveTo (Vector2 target, float seconds, EasingKind easingKind, float snapEpsilon=0.5f) |
| Begins a scripted tween toward the specified target position over a fixed duration, using a predefined EasingKind curve. This overload is a convenience wrapper around MoveTo(Vector2, float, Func<float, float>?, float). | |
| void | MoveBy (Vector2 delta, float durationSec, Func< float, float >? easing=null, float snapEpsilon=0.5f) |
| Scripted relative motion by a delta over a fixed duration (with optional easing). Interprets delta in the mover's PositionSpace (Grid or Pixel). | |
| void | MoveBy (Vector2 delta, float durationSec, EasingKind easingKind, float snapEpsilon=0.5f) |
| Scripted relative motion by a delta over a fixed duration using an easing preset. | |
| void | MoveBy (Vector2 delta, float speedPerSec, float snapEpsilon=0.5f) |
| Scripted relative motion by a delta at a constant speed (units/sec in the mover's PositionSpace). | |
| void | MoveToward (Vector2 target, float speedPerSec, float snapEpsilon=0.5f) |
| Begins a scripted motion toward the target position at a constant speed. Unlike MoveTo(Vector2, float, Func<float, float>?, float), this motion continues each frame until the target is reached or cancelled, rather than running for a fixed duration. | |
| void | CancelScript () |
| Cancels any active scripted movement (tween or constant-speed) and clears the current script state. Raises ScriptedMovementStopped if a script was active. | |
Properties | |
| MovementState | MovementState [get] |
| Gets the current MovementState containing velocity, acceleration, and motion flags for the controlled object. | |
| bool | IsFollowing [get] |
Indicates whether the controller is currently engaged in a follow behavior. Returns true if a pixel or grid target is set, or if hard follow is active. | |
| bool | IsScripted [get] |
| Indicates whether a scripted movement (tween or MoveToward) is currently active. | |
| bool | IsIntegratedActive [get] |
Indicates whether physics-style integration is currently active. Returns true when the controller is not following or scripted, and MovementState.HasMotion is true. | |
| bool | WrapX = false [get, set] |
| Enables or disables horizontal world wrapping. When enabled, movement crossing the left/right edges wraps the IMovable to the opposite side. Only meaningful for Grid space; ignored for Pixel space. | |
| bool | WrapY = false [get, set] |
| Enables or disables vertical world wrapping. When enabled, movement crossing the top/bottom edges wraps the IMovable to the opposite side. Only meaningful for Grid space; ignored for Pixel space. | |
Events | |
| Action< ScriptedMovement >? | ScriptedMovementStarted |
| Raised when a scripted movement (tween or MoveToward) begins. Subscribers are notified exactly once per script initialization. | |
| Action< ScriptedMovement >? | ScriptedMovementStopped |
| Raised when a scripted movement (tween or MoveToward) completes or is explicitly cancelled. Subscribers are notified exactly once per script termination. | |
Central controller responsible for managing all movement modes for a single IMovable object. Combines three systems:
The controller automatically selects the correct behavior each frame internally through AdvanceMovement(float).
| void Gondwana.Movement.MovementController.CancelScript | ( | ) |
Cancels any active scripted movement (tween or constant-speed) and clears the current script state. Raises ScriptedMovementStopped if a script was active.
| void Gondwana.Movement.MovementController.Dispose | ( | ) |
Releases resources and detaches all event handlers.
| void Gondwana.Movement.MovementController.FollowPixelHard | ( | Func< Vector2 > | getPixelPos, |
| Vector2 | offsetPx = default ) |
Hard-follow a pixel-space target. The follower snaps directly to the target every update (no tweening, no speed). An optional pixel offset is applied only for pixel-space followers.
| getPixelPos | Delegate that returns the current target position in pixels each frame. |
| offsetPx | Optional additional pixel offset applied only when the follower is in pixel space. |
| ArgumentNullException | Thrown when getPixelPos is null. |
| void Gondwana.Movement.MovementController.FollowPixelSoft | ( | Func< Vector2 > | getPixelPos, |
| float | durationSec, | ||
| EasingKind | easingKind, | ||
| float | snap = 0::5f, | ||
| Vector2 | offsetPx = default ) |
Start following a pixel-space target using a duration-based tween (easing). When easing is active, speed fields are ignored. The snap value is interpreted in the follower's space at runtime:
| getPixelPos | Delegate that returns the current target position in pixels each frame. |
| durationSec | Tween duration in seconds. Must be > 0. |
| easingKind | Named easing preset. |
| snap | Arrival tolerance; interpreted in the follower's space at runtime. |
| offsetPx | Optional additional pixel offset for pixel-space followers. |
| ArgumentNullException | Thrown when getPixelPos is null. |
| ArgumentOutOfRangeException | Thrown when durationSec ≤ 0. |
| void Gondwana.Movement.MovementController.FollowPixelSoft | ( | Func< Vector2 > | getPixelPos, |
| float | durationSec, | ||
| Func< float, float >? | easing = null, | ||
| float | snap = 0::5f, | ||
| Vector2 | offsetPx = default ) |
Start following a pixel-space target using a duration-based tween (easing). When easing is active, speed fields are ignored. The snap value is interpreted in the follower's space at runtime:
| getPixelPos | Delegate that returns the current target position in pixels each frame. |
| durationSec | Tween duration in seconds. Must be > 0. |
| easing | Optional easing function in the range [0,1]→[0,1]. If null, linear easing is used. |
| snap | Arrival tolerance; interpreted in the follower's space at runtime (pixels for pixel followers, tiles for grid followers). |
| offsetPx | Optional additional pixel offset when the follower is pixel-space (ignored for grid followers). |
| ArgumentNullException | Thrown when getPixelPos is null. |
| ArgumentOutOfRangeException | Thrown when durationSec ≤ 0. |
| void Gondwana.Movement.MovementController.FollowPixelSoft | ( | Func< Vector2 > | getPixelPos, |
| float | speed, | ||
| float | snap = 0::5f, | ||
| Vector2 | offsetPx = default ) |
Start following a pixel-space target at a constant speed. The speed and snap units are interpreted in the follower's position space:
| getPixelPos | Delegate that returns the current target position in pixels (screen/world pixels) each frame. |
| speed | Follow speed (pixels/sec for pixel followers; tiles/sec for grid followers). Must be > 0. |
| snap | Snap/arrival tolerance (pixels for pixel followers; tiles for grid followers). Values < 0 are clamped to 0. |
| offsetPx | Optional additional pixel offset applied only when the follower is in pixel space (ignored for grid followers). |
| ArgumentNullException | Thrown when getPixelPos is null. |
| ArgumentOutOfRangeException | Thrown when speed ≤ 0. |
| void Gondwana.Movement.MovementController.FollowTileHard | ( | IMovableOnSceneLayer | tileTarget, |
| Vector2 | gridOffset = default, | ||
| Vector2 | pixelOffset = default ) |
Hard-follow a grid (tile) target. The follower snaps directly to the target grid coordinate each update (no tweening, no speed). If the follower is pixel-space, pixelOffset is applied after grid→pixel conversion.
| tileTarget | The grid-anchored target to follow. |
| gridOffset | Optional tile offset applied to the target's grid coordinate. |
| pixelOffset | Optional pixel offset applied only when the follower is pixel-space. |
| ArgumentNullException | Thrown when tileTarget is null. |
| void Gondwana.Movement.MovementController.FollowTileSoft | ( | IMovableOnSceneLayer | tileTarget, |
| float | durationSec, | ||
| EasingKind | easingKind, | ||
| float | snap = 0::5f, | ||
| Vector2 | gridOffset = default, | ||
| Vector2 | pixelOffset = default ) |
Convenience overload of FollowTileSoft(IMovableOnSceneLayer, float, Func<float, float>?, float, Vector2, Vector2) that specifies the easing curve via EasingKind.
| tileTarget | The grid-anchored target to follow. |
| durationSec | Tween duration in seconds. Must be > 0. |
| easingKind | Named easing preset. |
| snap | Arrival tolerance; applied in the follower's space at runtime. |
| gridOffset | Optional tile offset added to the target's grid coordinate. |
| pixelOffset | Optional pixel offset applied only when the follower is pixel-space. |
| ArgumentNullException | Thrown when tileTarget is null. |
| ArgumentOutOfRangeException | Thrown when durationSec ≤ 0. |
| void Gondwana.Movement.MovementController.FollowTileSoft | ( | IMovableOnSceneLayer | tileTarget, |
| float | durationSec, | ||
| Func< float, float >? | easing = null, | ||
| float | snap = 0::5f, | ||
| Vector2 | gridOffset = default, | ||
| Vector2 | pixelOffset = default ) |
Start following a grid (tile) target using a duration-based tween (easing). When easing is active, speed fields are ignored. Snap tolerance is stored for both pixel and tile spaces; the runtime branch uses the follower's space.
| tileTarget | The grid-anchored target to follow. |
| durationSec | Tween duration in seconds. Must be > 0. |
| easing | Optional easing function in the range [0,1]→[0,1]. If null, linear easing is used. |
| snap | Arrival tolerance; applied in the follower's space at runtime. |
| gridOffset | Optional tile offset added to the target's grid coordinate. |
| pixelOffset | Optional pixel offset applied only when the follower is pixel-space. |
| ArgumentNullException | Thrown when tileTarget is null. |
| ArgumentOutOfRangeException | Thrown when durationSec ≤ 0. |
| void Gondwana.Movement.MovementController.FollowTileSoft | ( | IMovableOnSceneLayer | tileTarget, |
| float | speedTilesPerSec, | ||
| float | snapTiles = 0::25f, | ||
| Vector2 | gridOffset = default, | ||
| Vector2 | pixelOffset = default ) |
Start following a grid (tile) target at a constant speed (tiles/sec). If the follower is pixel-space, an additional pixel offset can be applied after the grid→pixel conversion.
| tileTarget | The grid-anchored target to follow (must expose SceneLayer and grid position). |
| speedTilesPerSec | Follow speed in tiles per second. Must be > 0. |
| snapTiles | Tile-space arrival tolerance; values < 0 are clamped to 0. |
| gridOffset | Optional tile offset applied to the target's grid coordinate before conversion. |
| pixelOffset | Optional pixel offset applied only when the follower is pixel-space. |
| ArgumentNullException | Thrown when tileTarget is null. |
| ArgumentOutOfRangeException | Thrown when speedTilesPerSec ≤ 0. |
| void Gondwana.Movement.MovementController.MoveBy | ( | Vector2 | delta, |
| float | durationSec, | ||
| EasingKind | easingKind, | ||
| float | snapEpsilon = 0::5f ) |
Scripted relative motion by a delta over a fixed duration using an easing preset.
| delta | The offset by which to move, relative to the mover’s current position. Units are in the mover’s PositionSpace (grid cells or pixels). |
| durationSec | The total duration of the motion in seconds. |
| easingKind | The predefined easing curve (e.g., EaseInOutQuad, EaseOutCubic) to apply during the motion. |
| snapEpsilon | The distance threshold (in PositionSpace units) at which the motion will snap to the goal and stop. |
| void Gondwana.Movement.MovementController.MoveBy | ( | Vector2 | delta, |
| float | durationSec, | ||
| Func< float, float >? | easing = null, | ||
| float | snapEpsilon = 0::5f ) |
Scripted relative motion by a delta over a fixed duration (with optional easing). Interprets delta in the mover's PositionSpace (Grid or Pixel).
| delta | The offset by which to move, relative to the mover’s current position. Units are in the mover’s PositionSpace (grid cells or pixels). |
| durationSec | The total duration of the motion in seconds. |
| easing | Optional easing function that determines interpolation over time. If null, the motion is linear. |
| snapEpsilon | The distance threshold (in PositionSpace units) at which the motion will snap to the goal and stop. |
| void Gondwana.Movement.MovementController.MoveBy | ( | Vector2 | delta, |
| float | speedPerSec, | ||
| float | snapEpsilon = 0::5f ) |
Scripted relative motion by a delta at a constant speed (units/sec in the mover's PositionSpace).
| delta | The offset by which to move, relative to the mover’s current position. Units are in the mover’s PositionSpace (grid cells or pixels). |
| speedPerSec | The speed of movement in PositionSpace units per second (e.g., pixels/sec or tiles/sec). |
| snapEpsilon | The distance threshold (in PositionSpace units) at which the motion will snap to the goal and stop. |
| void Gondwana.Movement.MovementController.MoveTo | ( | Vector2 | target, |
| float | durationSec, | ||
| Func< float, float >? | easing = null, | ||
| float | snapEpsilon = 0::5f ) |
Begins a scripted tween toward the specified target position over a fixed duration. This method interpolates linearly or with an optional easing function from the mover’s current position to the target, automatically cancelling any existing scripted or physics-based movement.
| target | The absolute destination position. |
| durationSec | The total tween duration in seconds. Values less than 0 are clamped to 0. |
| easing | Optional easing function mapping normalized time [0,1] → [0,1]. If null, linear easing is used. |
| snapEpsilon | The arrival tolerance. When the mover is within this distance of the target, the tween completes early. Values less than 0 are clamped to 0. |
| void Gondwana.Movement.MovementController.MoveTo | ( | Vector2 | target, |
| float | seconds, | ||
| EasingKind | easingKind, | ||
| float | snapEpsilon = 0::5f ) |
Begins a scripted tween toward the specified target position over a fixed duration, using a predefined EasingKind curve. This overload is a convenience wrapper around MoveTo(Vector2, float, Func<float, float>?, float).
| target | The absolute destination position. |
| seconds | The tween duration in seconds. Values less than 0 are clamped to 0. |
| easingKind | The built-in easing preset to apply. |
| snapEpsilon | The arrival tolerance. When the mover is within this distance of the target, the tween completes early. |
| void Gondwana.Movement.MovementController.MoveToward | ( | Vector2 | target, |
| float | speedPerSec, | ||
| float | snapEpsilon = 0::5f ) |
Begins a scripted motion toward the target position at a constant speed. Unlike MoveTo(Vector2, float, Func<float, float>?, float), this motion continues each frame until the target is reached or cancelled, rather than running for a fixed duration.
| target | The absolute destination position. |
| speedPerSec | The movement speed per second. Values less than 0 are clamped to 0. |
| snapEpsilon | The arrival tolerance. When the mover is within this distance of the target, motion completes early. Values less than 0 are clamped to 0. |
| void Gondwana.Movement.MovementController.SetAcceleration | ( | Vector2 | acceleration | ) |
Sets the acceleration of the object.
This method cancels any ongoing scripts before updating the acceleration.
| acceleration | The new acceleration to apply, represented as a Vector2 |
| void Gondwana.Movement.MovementController.SetLinearDamping | ( | float | dampingPerSec | ) |
Sets the linear damping value, which determines the rate at which linear motion is reduced over time.
Linear damping is used to simulate the gradual reduction of velocity in a system, such as due to friction or drag. If the specified value is negative, it will be clamped to zero.
| dampingPerSec | The damping value per second. Must be a non-negative value. |
| void Gondwana.Movement.MovementController.SetMaxSpeed | ( | float? | maxSpeed | ) |
Sets the maximum speed for the current state. Only applies to integrated movement.
| maxSpeed | The maximum speed to set, in units appropriate to the context. Specify null to remove the speed limit. |
| void Gondwana.Movement.MovementController.SetVelocity | ( | Vector2 | velocity | ) |
Sets the velocity of the object.
This method cancels any ongoing scripts before applying the new velocity.
| velocity | The new velocity to apply, represented as a Vector2. |
| void Gondwana.Movement.MovementController.StopAllMovement | ( | ) |
Immediately stops all forms of movement — follow, scripted, and integrated. Cancels active tweens, clears velocity and acceleration, and halts motion this frame.
| void Gondwana.Movement.MovementController.Unfollow | ( | ) |
Stop following any target and clear all follow/tween state (targets, speeds, offsets, easing, hard mode). Any in-flight scripted/tweened movement is cancelled immediately.
|
get |
Indicates whether the controller is currently engaged in a follow behavior. Returns true if a pixel or grid target is set, or if hard follow is active.
|
get |
Indicates whether physics-style integration is currently active. Returns true when the controller is not following or scripted, and MovementState.HasMotion is true.
|
get |
Indicates whether a scripted movement (tween or MoveToward) is currently active.
|
get |
Gets the current MovementState containing velocity, acceleration, and motion flags for the controlled object.
|
getset |
Enables or disables horizontal world wrapping. When enabled, movement crossing the left/right edges wraps the IMovable to the opposite side. Only meaningful for Grid space; ignored for Pixel space.
|
getset |
Enables or disables vertical world wrapping. When enabled, movement crossing the top/bottom edges wraps the IMovable to the opposite side. Only meaningful for Grid space; ignored for Pixel space.
| Action<ScriptedMovement>? Gondwana.Movement.MovementController.ScriptedMovementStarted |
Raised when a scripted movement (tween or MoveToward) begins. Subscribers are notified exactly once per script initialization.
| Action<ScriptedMovement>? Gondwana.Movement.MovementController.ScriptedMovementStopped |
Raised when a scripted movement (tween or MoveToward) completes or is explicitly cancelled. Subscribers are notified exactly once per script termination.