GameMaker (2.3)
Icon

Circular Array

BenStigsen

You must be logged in to obtain assets

Description

This is a circular array, which is useful for having a fixed amount of elements, then writing over them later.

Say you want to have footprints in your game, but you only want a max of 1000 to be active. You can achieve this with the following:

/// Create Event
footprints = new CircularArray(1000);

/// Step Event
var decal = instance_create_layer(player.x, player.y, "Instances", obj_footstep);
var prev = footsteps.Push(decal);

// Remove old footprint
if (instance_exists(prev)) {
    instance_destroy(prev); 
}

The functionality provided can be found in the screenshot and example object.

End User Licence Agreement (EULA).

Age Rating: 4+

Version

GMS2.3 - Version 1.0.1. Published November 27, 2022

Renamed .yyp file

Loading, please wait

Package contents

Loading, please wait

What is the issue?

Loading, please wait