Castagne Engine

Documentation (Dev Branch)

Castagne Engine

Getting Started

Editor

Gametypes

Intermediate

Making a Game

Pushing Castagne

Advanced

Modules

Graphics 2.5D Reference

Model

Functions relating to models. A model is a .tscn scene, which may come with an AnimationPlayer node. Model functions affect the whole graphics side, so even sprites are affected here.

Functions

CreateModel[1, 2][Init, Action, Manual]Intermediate
Creates a model for the current entity. An AnimationPlayer may be set to enable Anim functions.
  • Arg 1: Model path
  • Arg 2: (Optional) Animation player path
ModelScale[1][Init, Action, Manual]Intermediate
Changes the model's scale uniformly.
  • Arg 1: The scale in permil.
ModelRotation[1][Init, Action, Manual]Intermediate
Changes the model's rotation on the Z axis.
  • Arg 1: The rotation in tenth of degrees.
ModelMove[1, 2][Init, Action, Manual]Advanced
Moves the model depending on facing. You'll want to activate the ModelLockRelativePosition flag.
  • Arg 1: Horizontal Move
  • Arg 2: (Optional) Vertical Move
ModelMoveAbsolute[1, 2][Init, Action, Manual]Advanced
Moves the model independant of facing. You'll want to activate the ModelLockRelativePosition flag.
  • Arg 1: Horizontal Move
  • Arg 2: (Optional) Vertical Move
ModelSwitchFacing[0][Init, Action, Manual]Advanced
Changes the model's facing. You'll want to activate the ModelLockFacing flag.

Variables

_ModelPositionX0[]
_ModelPositionY0[]
_ModelRotation0[]
_ModelScale1000[]
_GraphicsCamPos(0, 0, 0)[]

Flags

ModelLockWorldPosition
ModelLockRelativePosition
ModelLockFacing

Sprites

Config

PositionScale0.0001[]

Functions

Sprite[1, 2][Init, Action, Manual]Basic
Display a previously set sprite frame. Will use the previously set animation if not specified.
  • Arg 1: (Optional) Anim/Spritesheet Name
  • Arg 2: Frame ID
SpriteProgress[0, 1][Init, Action, Manual]Intermediate
Advance on the spritesheet. Will use the current animation.
  • Arg 1: (Optional) Number of frames to advance
CreateSprite[0, 1][Init, Manual]Intermediate
Creates a sprite. Can either be empty, to use spritesheets, or have a link to a SpriteFrames ressource, depending on the interface you want to have.

Using spritesheets will require you to use RegisterSpritesheet later, ideally by overwriting the InitRegisterSpritesheets call in Base.casp. This will allow you to manage spritesheets from the Castagne Editor.

On the other end, using SpriteFrames will require you to set up every animation using Godot's editor. Please refer to the module documentation for more details.

  • Arg 1: (Optional) Spriteframes path
RegisterSpritesheet[2, 3, 4, 5, 6, 7][Init, Manual]Intermediate
Registers a new spritesheet to be used later and selects it. If not specified, the optional parameters are inherited from the currently selected spritesheet.
  • Arg 1: Spritesheet Name
  • Arg 2: Spritesheet Path
  • Arg 3: (Optional) Sprites X
  • Arg 4: (Optional) Sprites Y
  • Arg 5: (Optional) Origin X
  • Arg 6: (Optional) Origin Y
  • Arg 7: (Optional) Pixel Size
SpritesheetFrames[2][Init, Manual]Advanced
Sets the number of frames for the currently selected spritesheet.
  • Arg 1: Sprites X
  • Arg 2: Sprites Y
SpriteOrigin[2][Init, Manual]Advanced
Sets a sprite's origin in pixels for the currently selected spritesheet.
  • Arg 1: Pos X
  • Arg 2: Pos Y
SpritePixelSize[1][Init, Manual]Advanced
Sets the size of a pixel in units for the currently selected spritesheet. 3D graphics only.
  • Arg 1: PixelSize
SpriteOrder[1, 2][Init, Action, Manual]Advanced
Sets the draw order for sprites, higher being drawn on top of others. The final value must be between -4096 and 4096. The offset may be used to have more flexibility in its use, for instance by using it to put one character behind another without affecting the local sprite order changes. Still in progress, 2D graphics only for now.
  • Arg 1: Sprite Order
  • Arg 2: (Optional) Sprite Order Offset
SpriteOrderOffset[1][Init, Action, Manual]Advanced
Set the sprite order offset directly. See SpriteOrder for more information.
  • Arg 1: Sprite Order Offset

Variables

_SpriteFrame0[]
_SpriteAnimNull[]
_SpriteUseSpritesheets0[]
_SpriteOrder0[]
_SpriteOrderOffset0[]

Camera

Config

CameraOffsetX0[]
CameraOffsetY20000[]
CameraOffsetZ62000[]
CameraYBuffer30000[]
CameraPosMinX-105000[]
CameraPosMaxX105000[]
CameraPosMinY-1000000[]
CameraPosMaxY1000000[]