Category: 2D Overlay
Syntax:
b2dDrawAnimImageEx:Void(imageHandle:Int, x:Int, y:Int, frame:Int, shader:Int)
Void
Extended animation draw (per-draw custom shader with frame selection, combines animation + shader).
Takes imageHandle (animation image handle from b2dLoadAnimImage, positive integer), x (screen X position in pixels, integer), y (screen Y position in pixels, integer), frame (frame index 0-based, integer, 0=first frame), shader (shader handle from b2dLoadImageShader or 0 for default, integer).
Returns nothing.
View detailed documentation online
; Load animated tile image (8 frames, 32x32 each)
Local tileAnim:Int = b2dLoadAnimImage("gridTiles.png", 32, 32)
Local frameCount:Int = b2dGetAnimFrameAmount(tileAnim)
; Load glow shader for visual effects (designed for sprite sheets)
Local glowShader:Int = b2dLoadImageShader("AnimImageGlow.glsl")
b2dSetImageShaderFloat(glowShader, "0", 1.5) ; Glow intensity
b2dSetImageShaderFloat(glowShader, "2", 2.0) ; Pulse speed
; Animation state
Local currentFrame:Int = 0
Local animCounter:Double = 0.0
While running
; Update animation
animCounter = animCounter + 0.1
If animCounter >= 1.0 Then
animCounter = 0.0
currentFrame = (currentFrame + 1) Mod frameCount
EndIf
; Draw all frames without shader (for comparison)
For Local i:Int = 0 To frameCount - 1
b2dDrawAnimImage(tileAnim, i * 80, 100, i)
Next
; Draw animated frame WITH glow shader using DrawAnimImageEx
b2dDrawAnimImageEx(tileAnim, 400, 300, currentFrame, glowShader)
b2dFlip()
Wend
b2dFreeImageShader(glowShader)
BambooBasic © 2026 Michael Denathorn