opacity(o?: number): OpacityComp

Sets the opacity of a Game Object (0.0 - 1.0).
const bean = add([
    sprite("bean"),
    opacity(0.5) // Make bean 50% transparent
])

// Make bean invisible
bean.opacity = 0

// Make bean fully visible
bean.opacity = 1
kaplay logo

Misc