b2dCreateAnimSubImage

Category: 2D Overlay

Syntax:

b2dCreateAnimSubImage:Int(imageHandle:Int, x:Int, y:Int, frameWidth:Int, frameHeight:Int, frameCount:Int)


Parameters

Returns

Int



Summary

Makes an animation from frames inside another image (a sprite sheet), sharing its texture.

View detailed documentation online



Example
Global sheet:Int = b2dLoadImage("Media/sprites.png")

; a 4-frame walk cycle somewhere in the middle of the sheet
Global walk:Int = b2dCreateAnimSubImage(sheet, 64, 32, 32, 32, 4)

b2dDrawAnimImage(walk, 200, 300, (frame / 8) Mod 4)

BambooBasic © 2026 Michael Denathorn