Cycling through images

I have created a sprite_class but it only shows one bitmap. I based it to something like this:

Spoiler
function Sprite_SampleImage() { this.initialize.apply(this, arguments);}Sprite_SampleImage.prototype = Object.create(Sprite_Base.prototype);Sprite_SampleImage.prototype.constructor = Sprite_SampleImage;Sprite_SampleImage.prototype.initialize = function() { Sprite_Base.prototype.initialize.call(this); this.setCoordinates(); this.setBitmap()};Sprite_SampleImage.prototype.setCoordinates = function() { this.x = Graphics.width / 2 + 100; this.y = Graphics.height / 2 - 100};Sprite_SampleImage.prototype.setBitmap = function() { this.bitmap = ImageManager.loadPicture('Sample_Box');};Sprite_SampleImage.prototype.update = function() {}; 
This is where I need help. In the update part, I wonder if there's a way to cycle through other images. By cycle, what I mean is that within a few seconds / value, the image sprite's bitmap changes into another. I use suffixes to it, such as box_1, box_2, box_3, etc. Is there a way to do this? If so, I would like to see the workaround and an explanation.

Thanks.
This is the basis of animation: drawing a new image when a certain amount of time has passed.

You can refer to Sprite_Base to see an example.

The general idea is that you will keep a counter that keeps track of "frames elapsed", and depending on what the frame is, you would display a different picture.

For example, you can make it so that on every update, you would just increase a variable by 1.

Then, depending on what the variable is, you would either do nothing (just wait), or load a new picture.

Code:
frames += 1if frames == 5  load new pictureelse  do nothingend
The actual loading process could involve a number of other animation processes, like fade in/fade out, but the main point is keeping track of time.

Original thread: https://forums.rpgmakerweb.com/threads/cycling-through-images.54901/