O'Reilly logo

Developing Mobile Games with Moai SDK by Francisco Tufro

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Blend modes

A nice feature that you'll be playing with for sure is blend modes.

Moai SDK gives you the ability to define the blending mode for a certain Prop using the setBlendMode() method. This will allow you to modify the way its pixels are rendered on the screen.

You can choose between MOAIProp2D.BLEND_NORMAL, MOAIProp2D.BLEND_ADD, and MOAIProp2D.BLEND_MULTIPLY.

MOAIProp2D.BLEND_NORMAL is the default behavior and basically paints over pixels, covering whatever is underneath.

MOAIProp2D.BLEND_ADD does additive blending. It adds the value for the pixel you're trying to draw to the previous value of the pixel on the screen. This is really useful for particle systems and to obtain that popular glowing effect used to create Tron-like lights. It can ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required