-
Notifications
You must be signed in to change notification settings - Fork 12
4. Static Functions
Registers a sprite asset from the room to play its animation in accordance with the game loop.
Arguments:
- spriteid -
Asset.GMSprite
- The identifier of the sprite to be registered.- duration -
Real
- The duration for which each frame of the animation is displayed, in game steps.
Plays the animation for the object without using the Animator module, directly updating the object's image_index
based on the current timer value and the frame duration.
Arguments:
- timer -
Real
- The timer value.- duration -
Real
- The duration of one frame of the animation, in game steps.
Returns the duration of the current animation frame of the object, in game steps.
Scope:
c_object
Returns:
Real
Checks if the object's animation has finished playing.
Scope:
c_object
Returns:
Bool
Returns the index of the current animation frame of the object. The index may differ from the built-in image_index
if a custom frame sequence has been set.
Scope:
c_object
Returns:
Real
Checks if the frame of the object's current animation has changed.
Scope:
c_object
Returns:
Bool
Checks if the playback of the object's current animation has been manually stopped.
Scope:
c_object
Returns:
Bool
Returns the current frame timer of the object's animation, indicating how many game steps remain until the frame changes.
Scope:
c_object
Returns:
Real
Resumes playback of the object's current animation from the current frame, resetting the frame timer to its default value.
Scope:
c_object
Registers a new animation for the object and immediately starts playing it.
Arguments:
- spriteid -
Asset.GMSprite
- The sprite asset.- duration -
Real or Array<Real>
- The duration of the frames in the object's current animation (optional, defaults to 0). Refer toani_update_duration()
function for more information.- start_frame -
Real
- The index of the starting frame of the animation. If a custom sequence is provided, this will be the index of the frame in that sequence (optional, defaults to 0).- loop_frame -
Real
- The index of the frame to which the animation will loop back after playing the last frame in the sequence. If a custom sequence is provided, this will be the index of the frame in that sequence (optional, defaults to 0).- order -
Array<Real>
- The custom frame playback sequence (optional, defaults to []).
Scope:
c_object
Stops the playback of the object's current animation.
Scope:
c_object
Updates several parameters of the object's current animation.
Arguments:
- frame -
Real or Undefined
- Refer toani_update_frame()
function. Passundefined
if no changes are required.- reset_timer -
Bool
- Refer toani_update_frame()
function.- order -
Array<Real> or Undefined
- Refer toani_update_order()
function. Passundefined
if no changes are required.- duration -
Real or Array<Real> or Undefined
- Refer toani_update_duration()
function. Passundefined
if no changes are required.- loop_frame -
Real or Undefined
- Refer toani_update_loopframe()
function. Passundefined
if no changes are required.
Scope:
c_object
Updates the duration of the frames in the object's current animation. This can be provided as a single value for all frames or as an array of values representing the duration of each frame. If provided as an array, its length should match the number of frames in the asset or the number of frames in the custom playback sequence.
Arguments:
- duration -
Real or Array<Real>
- The duration of one frame of the animation in game steps.
Scope:
c_object
Updates the current frame index of the object's animation.
Arguments:
- frame -
Real
- The new frame index of the animation. If the animation is a custom sequence, this will be the index of the frame in that sequence.- reset_timer -
Bool
- Iftrue
, resets the current frame timer to its default value (optional, defaults totrue
).
Scope:
c_object
Updates the index of the frame to which the object's current animation will loop back after playing the last frame in the sequence.
Arguments:
- loop_frame -
Real
- The index of the frame to which the animation will return after playing the last frame. If a custom sequence is used, this will be the index of the frame in that sequence.
Scope:
c_object
Updates the animation frame order for the current object.
Arguments:
- order -
Array<Real>
- An array specifying the order of frames.
Scope:
c_object
Checks if BGM is playing on the specified channel.
Arguments:
- channel_index -
Real
- The index of the channel (optional, defaults to 0).
Mutes the BGM on the specified channel.
Arguments:
- time -
Real
- The duration over which the volume will decrease to 0, in seconds.- channel_index -
Real
- The index of the channel (optional, defaults to 0).
Starts playing BGM on the specified channel. If the same BGM is already playing on the channel, no action is taken.
Arguments:
- sound_id -
Asset.GMSound
- The sound asset to be played as BGM.- channel_index -
Real
- The index of the channel (optional).
Returns:
Id.Sound
Plays a sound effect, stopping any currently playing instance of the same sound asset.
Arguments:
- soundid -
Asset.GMSound
- The sound asset to be played as SFX.- loop -
Array<Real>
- An array of two values specifying the loop points of the sound, in seconds; if empty, the sound will not loop (optional, defaults to []).
Returns:
Id.Sound
Resets the background music (BGM) based on the state of the specified player or plays the default BGM if no player is provided.
Arguments:
- default_bgm -
Asset.GMSound
- The default BGM sound asset to be played if no special conditions are met.- player -
Id.Instance
- The player instance whose state determines which BGM to play (optional, defaults to noone).
Stops the BGM on the specified channel, fading out the volume over a given duration.
Arguments:
- time -
Real
- The duration over which the volume will decrease to 0, in seconds.- channel_index -
Real
- The index of the channel (optional, defaults to 0).
Unmutes the BGM on the specified channel, gradually increasing the volume back to the standard level.
Arguments:
- time -
Real
- The duration over which the volume will be increased to the standard level, in seconds.- channel_index -
Real
- The index of the channel (optional, defaults to 0).
Sets the loop points for the specified BGM sound asset.
Arguments:
- soundid -
Asset.GMSound
- The sound asset for which the loop points are being set.- loopstart -
Real
- The start point of the loop, in seconds.- loopend -
Real
- The end point of the loop, in seconds.
Adds a parallax layer to the background of the current room.
Arguments:
- sprite_id -
Asset.GMSprite
- The sprite asset to be used for the layer.- draw_node -
Real
- The y position on the sprite of the top edge of the area to draw.- draw_height -
Real
- The height of the area to draw.- pos_offset -
Real
- The vertical offset of the layer.- ani_duration -
Real
- The duration of each frame of the layer’s animation, in game steps.- scroll_vel_x -
Real
- The horizontal scroll speed of the layer’s content.- scroll_vel_y -
Real
- The vertical scroll speed of the layer’s content.- factor_x -
Real
- The horizontal parallax factor. Lower values make the layer appear further from the camera.- factor_y -
Real
- The vertical parallax factor. Lower values make the layer appear further from the camera.
Clears all current background layers along with their distortion effects and optionally fills the background with a new solid colour.
Arguments:
- colour -
Real
- The colour to fill the background with. Passundefined
to retain the current colour (optional, defaults toundefined
).
Fills the background with a new solid colour.
Arguments:
- _colour -
Real
- The new background colour.
Applies a horizontal perspective effect to the most recently added background layer.
Arguments:
- target_x -
Real
- The target horizontal parallax factor for the bottom edge of the layer.- line_height -
Real
- The height of one line of the perspective.
Applies a vertical perspective effect to the most recently added background layer. Only one layer with a vertical perspective is supported.
Arguments:
- target_y -
Real
- The y position within the room from which the layer will be scaled.
Creates a new camera and assigns it to a new surface, returning a struct containing its data. It will delete any existing camera assigned to the same index.
Arguments:
- index -
Real
- The index to assign the new camera to.- width -
Real
- The horizontal resolution of the camera.- height -
Real
- The vertical resolution of the camera.- canvas_width -
Real
- The horizontal size of the canvas (surface).- canvas_height -
Real
- The vertical size of the canvas (surface).- pos_x -
Real
- The initial x position of the camera in the room (optional, defaults to 0).- pos_y -
Real
- The initial y position of the camera in the room (optional, defaults to 0).- canvas_x -
Real
- The horizontal offset of the surface on the screen (optional, defaults to 0).- canvas_y -
Real
- The vertical offset of the surface on the screen (optional, defaults to 0).
Returns:
Struct
Updates the size of the camera associated with the specified viewport index. The current size is maintained if no new size is provided.
Arguments:
- index -
Real
- The index of the viewport.- width -
Real or Undefined
- The new width of the camera. Passundefined
to retain the current width.- height -
Real or Undefined
- The new height of the camera. Passundefined
to retain the current height.- pos_x -
Real or Undefined
- The new x position of the camera in the room. Passundefined
to retain the current position.- pos_y -
Real or Undefined
- The new y position of the camera in the room. Passundefined
to retain the current position.
Updates the surface associated with the specified viewport index. The current resolution is maintained if no new resolution is provided.
Arguments:
- index -
Real
- The index of the viewport.- canvas_width -
Real or Undefined
- The new horizontal resolution of the surface. Passundefined
to retain the current width.- canvas_height -
Real or Undefined
- The new vertical resolution of the surface. Passundefined
to retain the current height.- x -
Real or Undefined
- The horizontal offset of the surface. Passundefined
to retain the current offset (optional, defaults to 0).- y -
Real or Undefined
- The vertical offset of the surface. Passundefined
to retain the current offset (optional, defaults to 0).
Deletes the camera and the surface associated with the specified viewport index.
Arguments:
- index -
Real
- The index of the viewport.
Returns the camera associated with the specified viewport index.
Arguments:
- index -
Real
- The index of the viewport.
Returns:
Id.Camera
Returns the data of the camera associated with the specified viewport index.
Arguments:
- index -
Real
- The index of the viewport.
Returns:
Struct or Id.Instance
Returns the horizontal resolution of the camera associated with the specified viewport index.
Arguments:
- index -
Real
- The index of the viewport.
Returns:
Real
Returns the vertical resolution of the camera associated with the specified viewport index.
Arguments:
- index -
Real
- The index of the viewport.
Returns:
Real
Returns the adjusted x position of the camera associated with the specified viewport index.
Arguments:
- index -
Real
- The index of the viewport.
Returns:
Real
Returns the y position of the camera associated with the specified viewport index.
Arguments:
- index -
Real
- The index of the viewport.
Returns:
Real
If
global.tools_binary_collision
flag is set, this function will not store the generated collision in the game memory but instead save it into the Save Location folder (see Game Options for your specific platform).
Generates collision data for the tilemap associated with the specified sprite.
Arguments:
- sprite_id -
Asset.GMSprite
- The sprite used in the tilemap.- angle_data -
Array<Real>
- An array of values representing the angles for each tile.- off_x -
Real
- The horizontal offset of the sprite on the tilemap.- off_y -
Real
- The vertical offset of the sprite on the tilemap.- sep_x -
Real
- The horizontal spacing between tiles on the tilemap.- sep_y -
Real
- The vertical spacing between tiles on the tilemap.
Scope:
scr_fw_collision_setup
Loads the generated collision data for the tilemap associated with the specified sprite.
Arguments:
- spriteid -
Asset.GMSprite
- The sprite used in the tilemap for which the collision data was generated.- layer_a -
String
- The name of the primary layer in the room.- layer_b -
String
- The name of the secondary layer in the room.
Loads collision data from binary files located in in /datafiles/collision
. This function does not associate the data with any specific tilemap, so ensure you are loading data for the tilemap you are using.
Arguments:
- width_data -
String
- The filename (without extension) containing width data.- height_data -
String
- The filename (without extension) containing height data.- angle_data -
String
- The filename (without extension) containing angle data.- layer_a -
String
- The name of the primary layer in the room.- layer_b -
String
- The name of the secondary layer in the room.
Finds a tile along a vertical axis at the given position within a specified tile layer and returns an array containing two values: the distance to the tile's edge and its angle.
Arguments:
- x -
Real
- The x-coordinate of the position.- y -
Real
- The y-coordinate of the position.- dir -
Enum.DIRECTION
- The direction in which to perform the search.- layer -
Enum.TILELAYER
- The index of the tile layer to search within.- behaviour -
Enum.TILEBEHAVIOUR
- The behaviour type of the tile (optional, defaults toDEFAULT
).
Returns:
Array<Real>
- An array containing the distance to the tile's edge at position 0 and and its angle at position 1.
Finds a tile along a horizontal axis at the given position within a specified tile layer and returns an array containing two values: the distance to the tile's edge and its angle.
Arguments:
- x -
Real
- The x-coordinate of the position.- y -
Real
- The y-coordinate of the position.- dir -
Enum.DIRECTION
- The direction in which to perform the search.- layer -
Enum.TILELAYER
- The index of the tile layer to search within.- behaviour -
Enum.TILEBEHAVIOUR
- The behaviour type of the tile (optional, defaults toDEFAULT
).
Returns:
Array<Real>
- An array containing the distance to the tile's edge at position 0 and and its angle at position 1.
Identifies the nearest tile along a vertical axis between two given points and returns an array containing two values: the distance to the found tile's edge and its angle.
Arguments:
- x1 -
Real
- The x-coordinate of the first point.- y1 -
Real
- The y-coordinate of the first point.- x2 -
Real
- The x-coordinate of the second point.- y2 -
Real
- The y-coordinate of the second point.- dir -
Enum.DIRECTION
- The direction in which to perform the search.- layer -
Enum.TILELAYER
- The index of the tile layer to search within.- behaviour -
Enum.TILEBEHAVIOUR
- The behaviour type of the tile (optional, defaults toDEFAULT
).
Returns:
Array<Real>
- An array containing the distance to the closest tile's edge at position 0 and and its angle at position 1.
Identifies the nearest tile along a horizontal axis between two given points and returns an array containing two values: the distance to the found tile's edge and its angle.
Arguments:
- x1 -
Real
- The x-coordinate of the first point.- y1 -
Real
- The y-coordinate of the first point.- x2 -
Real
- The x-coordinate of the second point.- y2 -
Real
- The y-coordinate of the second point.- dir -
Enum.DIRECTION
- The direction in which to perform the search.- layer -
Enum.TILELAYER
- The index of the tile layer to search within.- behaviour -
Enum.TILEBEHAVIOUR
- The behaviour type of the tile (optional, defaults toDEFAULT
).
Returns:
Array<Real>
- An array containing the distance to the closest tile's edge at position 0 and and its angle at position 1.
Retrieves the angle of a tile based on its index. Returns ANGLE_EMPTY
if the tile of the given index is non-existent.
Arguments:
- tiledata -
Real
- The tile data.
Returns:
Real or Constant
Retrieves the height of a specific tile in the room at a given x-coordinate within itself. Returns 0 if the tile index is invalid.
Arguments:
- tiledata -
Real
- The tile data.- x -
Real
- The x-coordinate within the tile.
Returns:
Real
Retrieves the width of a specific tile in the room at a given y-coordinate within itself. Returns 0 if the tile index is invalid.
Arguments:
- tiledata -
Real
- The tile data.- y -
Real
- The y-coordinate within the tile.
Returns:
Real
Evaluates the validity of a tile along a vertical axis based on the specified direction and tile behaviour.
Arguments:
- tiledata -
Real
- The tile data.- dir -
Enum.DIRECTION
- The direction to check the tile's validity.- behaviour -
Enum.TILEBEHAVIOUR
- The behaviour of the tile to consider when evaluating validity.
Returns:
Bool
Evaluates the validity of a tile along a horizontal axis based on the specified direction and tile behaviour.
Arguments:
- tiledata -
Real
- The tile data.- dir -
Enum.DIRECTION
- The direction to check the tile's validity.- behaviour -
Enum.TILEBEHAVIOUR
- The behaviour of the tile to consider when evaluating validity.
Returns:
Bool
Applies distortion to multiple foreground layers using two sets of distortion data. Distortion is not applied to object instance layers.
Arguments:
- data1 -
Array<Real>
- The first set of distortion data.- data2 -
Array<Real>
- The second set of distortion data.- spd -
Real
- The speed of distortion.- range_start -
Real
- The upper boundary of the distortion area, in room space.- range_end -
Real
- The lower boundary of the distortion area, in room space.- layers -
Array<String>
- An array of layer names to which the distortion will be applied.
Applies distortion to the background layer using two sets of distortion data.
Arguments:
- data1 -
Array<Real>
- The first set of distortion data.- data2 -
Array<Real>
- The second set of distortion data.- spd -
Real
- The speed of distortion.- range_start -
Real
- The upper boundary of the distortion area, in background space.- range_end -
Real
- The lower boundary of the distortion area, in background space.
Clears all active distortion effects from the foreground.
Clears all active distortion effects from the background.
Returns data representing the distortion pattern (shape).
Arguments:
- effect_data -
Enum.EFFECTDATA
- An enum representing the type of distortion data.
Returns:
Array<Integer>
Draws a line with coordinates rounded down to the nearest integer.
Arguments:
- x1 -
Real
- The x-coordinate of the line's starting point.- y1 -
Real
- The y-coordinate of the line's starting point.- x2 -
Real
- The x-coordinate of the line's ending point.- y2 -
Real
- The y-coordinate of the line's ending point.- col1 -
Constant.Color
- The colour of the line at the starting point (optional, defaults toc_white
).- col2 -
Constant.Color
- The colour of the line at the ending point (optional, defaults tocol1
).
Draws a point with coordinates rounded down to the nearest integer.
Arguments:
- x1 -
Real
- The x-coordinate of the point.- y1 -
Real
- The y-coordinate of the point.- col -
Constant.Color
- The colour of the point (optional, defaults toc_white
).
Draws a rectangle with coordinates rounded down to the nearest integer.
Arguments:
- x1 -
Real
- The x-coordinate of the top-left corner.- y1 -
Real
- The y-coordinate of the top-left corner.- x2 -
Real
- The x-coordinate of the bottom-right corner.- y2 -
Real
- The y-coordinate of the bottom-right corner.- is_outlined -
Bool
- Specifies whether the rectangle should be outlined (true
) or filled (false
).- col -
Constant.Color
- The colour of the rectangle (optional, defaults toc_white
).
Toggles the fade effect for all subsequent drawing calls.
Arguments:
- enabled -
Bool
- A boolean flag to enable or disable the fade effect.
Toggles colour palette replacement for all subsequent drawing calls.
Arguments:
- enabled -
Bool
- A boolean flag to enable or disable the colour palette replacement.
Configures and triggers a screen fade effect. If unsure, use the pre-configured functions.
Arguments:
- routine -
Enum.FADEROUTINE
- The type of fade action to perform (e.g., fade-in or fade-out).- type -
Enum.FADETYPE
- The colour blending type used during the fade effect.- speed -
Real
- The speed at which the fade effect occurs.- freq -
Real
- The number of game steps between each update of the effect, affecting the smoothness of the transition (optional, defaults to 1).- game_control -
Bool
- Whether to pause game updates during the fade effect or not (optional, defaults totrue
).
Performs a black fade effect.
Arguments:
- routine -
Enum.FADEROUTINE
- The type of fade action to perform (e.g., fade-in or fade-out).- step_duration -
Real
- The duration of the effect update in game steps, affecting both speed and smoothness.- game_control -
Bool
- Whether to pause game updates during the fade effect (optional, defaults totrue
).
Performs a dull fade effect.
Arguments:
- routine -
Enum.FADEROUTINE
- The type of fade action to perform (e.g., fade-in or fade-out).- step_duration -
Real
- The duration of the effect update in game steps, affecting both speed and smoothness.- game_control -
Bool
- Whether to pause game updates during the fade effect (optional, defaults totrue
).
Performs a flash fade effect.
Arguments:
- routine -
Enum.FADEROUTINE
- The type of fade action to perform (e.g., fade-in or fade-out).- step_duration -
Real
- The duration of the effect update in game steps, affecting both speed and smoothness.- game_control -
Bool
- Whether to pause game updates during the fade effect (optional, defaults totrue
).
Performs a white fade effect.
Arguments:
- routine -
Enum.FADEROUTINE
- The type of fade action to perform (e.g., fade-in or fade-out).- step_duration -
Real
- The duration of the effect update in game steps, affecting both speed and smoothness.- game_control -
Bool
- Whether to pause game updates during the fade effect (optional, defaults totrue
).
Creates a new input structure.
Returns:
Struct
Retrieves the input data for the specified slot, which includes the held-down status of inputs.
Arguments:
- slot -
Real
- The input slot number.
Returns:
Struct
Retrieves the input data for the specified slot, which includes the pressed status of inputs.
Arguments:
- slot -
Real
- The input slot number.
Returns:
Struct
Resets the input data contained within the given structure.
Arguments:
- struct -
Struct
- The structure containing the input data to be reset.
Sets a rumble effect on the specified gamepad slot.
Arguments:
- input_id -
Real
- The ID of the gamepad slot to apply the rumble effect to.- time -
Real
- The duration of the rumble effect in seconds.- left_motor -
Real
- The intensity of the rumble effect for the left motor, ranging from 0 to 1.- right_motor -
Real
- The intensity of the rumble effect for the right motor, ranging from 0 to 1.
Converts a raw angle to its equivalent angle in degrees.
Arguments:
- raw -
Real
- The raw angle to convert.
Returns:
Real
Converts an angle in degrees to its equivalent raw angle.
Arguments:
- decimal -
Real
- The angle in degrees to convert.
Returns:
Real
Converts an angle in degrees to its corresponding quadrant from 0 to 3.
Arguments:
- angle -
Real
- The angle in degrees.
Returns:
Real
Calculates a degree angle of a vector rounded to the nearest value in the raw angle system.
Arguments:
- x_dist -
Real
- The x-component of the vector.- y_dist -
Real
- The y-component of the vector.
Returns:
Real
Calculates a degree angle of a vector.
Arguments:
- x_dist -
Real
- The x-component of the vector.- y_dist -
Real
- The y-component of the vector.
Returns:
Real
Rounds an angle in degrees to the nearest value in the raw angle system.
Arguments:
- angle -
Real
- The angle in degrees to be rounded.
Returns:
Real
Sets the culling behaviour for the specified object.
Arguments:
- type -
Enum.CULLING
- The new culling behaviour type to be set.
Configures the object's hitbox by setting its size and offset from the object's centre.
Arguments:
- radius_x -
Real
- The horizontal radius of the hitbox.- radius_y -
Real
- The vertical radius of the hitbox.- offset_x -
Real
- The horizontal offset for the hitbox from the object's centre (optional, defaults to 0).- offset_y -
Real
- The vertical offset for the hitbox from the object's centre (optional, defaults to 0).
Configures the object's extended hitbox by setting its size and offset from the object's centre.
Arguments:
- radius_x -
Real
- The horizontal radius of the extended hitbox.- radius_y -
Real
- The vertical radius of the extended hitbox.- offset_x -
Real
- The horizontal offset for the extended hitbox from the object's centre (optional, defaults to 0).- offset_y -
Real
- The vertical offset for the extended hitbox from the object's centre (optional, defaults to 0).
Adjusts the object's drawing priority based on the specified priority value from 0 to 8, inclusive.
Arguments:
- priority -
Real
- The desired priority level.
Configures the object's solid collision area by setting its size and offset relative to the object's centre.
Arguments:
- radius_x -
Real
- The horizontal radius of the solid collision area.- radius_y -
Real
- The vertical radius of the solid collision area.- offset_x -
Real
- The horizontal offset of the collision area from the object's centre (optional, defaults to 0).- offset_y -
Real
- The vertical offset of the collision area from the object's centre (optional, defaults to 0).
Configures the collision properties for a sloped object using a heightmap.
Arguments:
- heightmap -
Array<Real>
- An array of numbers representing the height at various points.- offset_x -
Real
- The horizontal offset of the collision area from the object's centre (optional, defaults to 0).- offset_y -
Real
- The vertical offset of the collision area from the object's centre (optional, defaults to 0).
Resets the specified object's depth (drawing priority) to its initial value.
Checks if the specified object is visible within any of the current view boundaries. Note that this function refers to the any GameMaker camera, not specifically the one created with the camera_new()
function.
Arguments:
- id -
Id.Instance
- The object instance (optional, defaults to the current instance).
Returns:
Bool
Defines the behaviour and logic for an enemy object. Returns true
if the enemy was not destroyed, false
otherwise.
Arguments:
- type -
Enum.ENEMYTYPE
- The type of enemy (optional, defaults toENEMYTYPE.BADNIK
).
Returns:
Bool
Handles collision detection and response between the player and a solid object.
Arguments:
- player -
Id.Instance
- The player object instance.- type -
Enum.SOLIDOBJECT
- The type of solid object.- attach_type -
Enum.SOLIDATTACH
- Whether the player is allowed to land on this object or should they be reset (optional, defaults toDEFAULT
).
Determines whether the calling object collides with the specified target object's hitbox.
Arguments:
- target -
Id.Instance
- The object instance to check.- use_target_ext -
Bool
- Iftrue
, checks the target's extended hitbox; iffalse
, checks the standard hitbox (optional, defaults tofalse
).
Returns:
Bool
Checks for solid collision between the calling object and a player object.
Arguments:
- player -
Id.Instance
- The player object instance.- type -
Enum.SOLIDCOLLISION
- The type of collision.
Returns:
Bool
Clears the flag that forces a push animation on the specified player object, reverting to the default move animation.
Arguments:
- player -
Id.Instance
- The player object instance.
Oscillates an object's x position based on the specified parameters.
Arguments:
- start_x -
Real
- The initial x position for the oscillation.- angle -
Real
- The angle or timer value used for the oscillation.- dist -
Real
- The amplitude of the oscillation, determining how far the object moves from its starting position.- spd -
Real
- The speed at which the oscillation occurs (optional, defaults to 1).- offset -
Real
- A value that shifts the angle of the oscillation (optional, defaults to 0).
Returns:
Real
Oscillates an object's y position based on the specified parameters.
Arguments:
- start_y -
Real
- The initial y position for the oscillation.- angle -
Real
- The angle or timer value used for the oscillation.- dist -
Real
- The amplitude of the oscillation, determining how far the object moves from its starting position.- spd -
Real
- The speed at which the oscillation occurs (optional, defaults to 1).- offset -
Real
- A value that shifts the angle of the oscillation (optional, defaults to 0).
Returns:
Real
Loads palette information from two sprite textures.
Arguments:
- primary -
Asset.GMSprite
- The sprite data for the primary palette.- secondary -
Asset.GMSprite
- The sprite data for the secondary palette.
Sets the palette index for one or more colour IDs, and optionally stops their colour rotation.
Arguments:
- col_ids -
Array<Real>
- An array of colour ID(s) for which to set the palette index.- index -
Real
- The palette index.- stop_rotation -
Bool
- Iftrue
, stops the rotation (optional, defaults tofalse
).
Retrieves the palette index corresponding to a given colour ID.
Arguments:
- col_id -
Real
- The colour ID.
Returns:
Real
Sets the rotation parameters for one or more colour IDs, enabling them to cycle through the palette over a specified duration.
Arguments:
- col_ids -
Array<Real>
- An array of colour IDs for which the rotation parameters are to be set.- loop_index -
Real
- The index within the palette to which the rotation will loop back after it ends.- end_index -
Real
- The ending index within the palette loop where the rotation ends.- duration -
Real
- The duration of each frame in the colour rotation sequence, in game steps.
Spawns a player object of the given type (character) at the specified location. Returns the instance ID of the created player, or noone
if the maximum player count is exceeded.
Arguments:
- x -
Real
- The x-coordinate of the spawn location.- y -
Real
- The y-coordinate of the spawn location.- player_type -
Constant
- The character to spawn.- layer -
String
- The name of the layer where the player object will be placed.
Returns:
Id.Instance
Retrieves the instance ID of a player object corresponding to the specified player index. Returns noone
if no matching player object is found.
Arguments:
- player_index -
Real
- The index of the player.
Returns:
Id.Instance
Sets the data displayed in Discord Rich Presence. Requires a configured Application ID for your game, see scr_fw_game_setup()
script.
Arguments:
- upper_text -
String or Undefined
- The main (upper) line of text to display. Passundefined
if no changes are required.- lower_text -
String or Undefined
- The secondary (lower) line of text to display. Passundefined
if no changes are required.- large_image_key -
String or Undefined
- The key for the main (large) image. Passundefined
if no changes are required.- small_image_key -
String or Undefined
- The key for the secondary (small) image. Passundefined
if no changes are required.
Registers a sprite as a font. This acts as a wrapper for the font_add_sprite_ext()
function.
Arguments:
- sprite_id -
Asset.GMSprite
- The sprite asset containing the font characters.- mapstring -
String
- A string defining the arrangement of characters within the sprite.- cut_empty_space -
Real
- Whether to trim empty space around characters (requires "Automatically Crop" enabled in Texture Group Settings).- separation -
Real
- The spacing between individual characters in the font.
Returns:
Asset.GMFont
Creates a duplicate of a given struct, preserving its properties.
Arguments:
- struct -
Struct
- The struct object to copy.
Returns:
Struct
Creates a new instance of the specified object at the current depth, with optional variable definitions and parent object assignment.
Arguments:
- x -
Real
- The x-coordinate for the new instance.- y -
Real
- The y-coordinate for the new instance.- obj -
Asset.GMObject
- The object to create an instance of.- var_struct -
Struct
- A structure to initialise instance variables (optional, defaults to {}).- parent -
Id.Instance
- An instance to set as the parent for culling purposes (optional, defaults to noone).
Returns:
Id.Instance