Pardon the mess, Play My Code is in beta!

READY TO PLAY?
CLICK TO LOG IN!

sign up - lost password

Image Class

The image class is for using your images. All images must be first uploaded using the asset manager, and then you can use them using this.

ship = new Image( 'my_ship.png' )
drawImage( ship, x, y )

Images are affected by the current draw colour when they are drawn. This allows you to tint them.

// draw the ship with a pink tint
setColor( :pink )
drawImage( ship, x, y )

You can also draw to images using the various drawing commands. These are the same as those found in the graphics functions section.

Many of the drawing functions can also be chained, allowing you to apply several drawing operations on the same Image object.

image = new Image( 100, 100 )

// fill image with white,
// then draw a pink rectangle to it
image.fill( :white ).setColor( :pink ).fillRect( 10, 10, 50, 50 )

new

clone

getWidth

getHeight

size

getPixel

getPixelAlpha

getPixelRed

getPixelGreen

getPixelBlue

setPixel

isOverlap

isPixelOverlap

rotate

scale

translate

transform

setTransform

undoTransform

clearTransforms

setAlpha

multAlpha

setColor

setFont

setBlend

clear

getAlpha

getColors

getRed

getGreen

getBlue

drawImage

drawRotatedImage

drawLine

drawPixel

drawCircle

drawEllipse

drawPolygon

drawRect

drawRoundedRect

drawSegment

drawInnerSegment

drawText

fill

fillCircle

fillEllipse

fillPolygon

fillRect

fillRoundedRect

fillSegment

fillInnerSegment

fillText

See Also