setBlend()
Purpose
Set the blend mode
Description
Sets the function used to combine drawn pixels with the background
Syntax
setBlend( mode )
Arguments
mode blend mode : none (0), mix (1), add (2), subtract (3) or multiply (4)
Example
palette = [
red,
green,
blue,
yellow,
purple,
lime,
orange,
bisque,
turquoise,
teal,
cyan
]
pos = { 120, 120 }
img = loadImage( "Finalbossblues/monster_elk", false )
blendTypes = [
"None",
"Mix",
"Add",
"Subtract",
"Multiply"
]
type = 0
press = false
loop
clear()
c = controls( 0 )
pos.x += c.lx * 4
pos.y -= c.ly * 4
if c.right and !press then
type += 1
press = true
endIf
if !c.right then
press = false
endIf
if type > 4 then
type = 0
endIf
setBlend( 0 )
w = gWidth() / len( palette )
for i = 0 to len( palette ) loop
box( i * w, gHeight() / 10, w, gHeight(), palette[i], false )
repeat
setBlend( type )
drawImage( img, pos.x, pos.y, 2 )
setBlend( 1 )
printAt( 0, 0, "Use Joy-Con Left Control Stick to move the image" )
printAt( 0, 1, "Press Right Directional Button to adjust blend type" )
printAt( 0, 2, "Blend Type: " + blendTypes[type] )
update()
repeat
Associated Commands