Draw image with a solid color

BlitzMax Forums/BlitzMax Beginners Area/Draw image with a solid color

not so much an optimization, but if you change Img to be a function parameter and return the result of the LoadImage function rather than assigning it directly, you have yourself a reusable function

CreateShapeFromMask:TImage(img:TImage)()
End Function

myPlayer.DamageImage = CreateShapeFromMask(playerImage)
Monster1.DamageImage = CreateShapeFromMask(monsterImage1)

(actually code may vary)