Skip to content

image[n]

Sixty-four pictures: logos, stage art, sprite sheets, Psych sprites with their animations, videos, plain coloured boxes. Everything you need to dress up a song.

How to use it

image[0] to image[63] - set file and it shows, "" hides it. Positions and sizes are shares of the screen. A picture is loaded the first time it's drawn; preload(file) in onStart loads it before, so it's there on the right frame.

  • Files: a .png in the song folder or its events/ folder (up to 8192 pixels a side, 128 pictures and 512 MB at a time - a picture that hasn't been shown for a while makes room for a new one and loads again when it's needed). "solid" = a plain white box to colour with color.
  • Animated: a grid sprite sheet (columns, rows, fps), a Psych sprite (.png + Sparrow .xml, anim), or a video as a folder of numbered frames ("videos/intro/").
  • In a fight: the "stage" layer paints it onto the world behind the fighters, follow keeps it on the world while the camera turns.

Texts and pictures share the layers. More: Stages and sprites.

Psych: makeLuaSprite, makeAnimatedLuaSprite, addAnimationByPrefix, setBlendMode, setScrollFactor · Kade: —

Example code

-- The song's logo in the top left corner, a pulsing glow behind it.
function onStart()
    image[0].file = "logo.png"
    image[0].x = 0.16
    image[0].y = 0.14
    image[0].width = 0.24
    image[1].file = "glow.png"
    image[1].x = 0.16
    image[1].y = 0.14
    image[1].width = 0.3
    image[1].blend = "add"
    image[1].order = -1
end

function onBeat(b)
    image[1].alpha = 1
    tween(image[1].alpha, 0.3, beats(1))
end

Properties

Property Kind Default
image[n].file text "" The picture: a .png in the song folder or its events/ folder, "solid" (a white …
image[n].x number 0.5 Where its middle sits from left to right: 0 = the left edge, 1 = the right edge.
image[n].y number 0.5 Where its middle sits from top to bottom: 0 = the top, 1 = the bottom.
image[n].width number 0.3 Its width as a share of the screen width. The height follows the picture's shape unless …
image[n].height number 0 Its height as a share of the screen height. 0 = follows the picture's shape; anything …
image[n].alpha number 1 Its opacity.
image[n].angle number 0 Turned clockwise around its middle, in degrees.
image[n].color colour #FFFFFF Multiplied onto the picture (#FFFFFF = its own colours). Colours a "solid" box.
image[n].layer choice "front" Which layer it's drawn on. "stage" paints it onto the world in a …
image[n].order number 0 Its place within the layer: higher = on top. Texts and pictures sort together.
image[n].columns number 1 A sprite sheet: the picture is a grid of equal frames this many across, read left to …
image[n].rows number 1 A sprite sheet: this many frames down.
image[n].frames number 0 How many of the grid's cells are frames (0 = all of them).
image[n].frame number 0 The frame shown, from 0. Set it to 0 to play an animation again; a tween on it plays it …
image[n].fps number 0 Frames a second it plays at by itself (0 = it stays on frame).
image[n].loop switch true Starts over after the last frame (true) or stops on it (false).
image[n].follow number 0 How much it moves with the fight camera: 1 = like the world, so the fighters never slide …
image[n].flipX switch false Mirrored left to right.
image[n].flipY switch false Mirrored upside down.
image[n].anim text "" A Psych sprite (the .png with a Sparrow .xml of the same name next to it): plays the …
image[n].blend choice "normal" How it's laid over what's under it: "normal", "add" (glows), "multiply" (darkens - …
image[n].smooth switch false false (default) = drawn with sharp pixels, like the game. true = smoothed - for big, …
image[n].shader text "" A shader on this picture alone: a .frag or .fsh from the song folder, its events/ …

image[n].file

text image[n].file = ""

The picture: a .png in the song folder or its events/ folder, "solid" (a white box), or a folder of video frames ending in / ("videos/intro/" = intro/0001.jpg, 0002.jpg, ... played like a sprite sheet). "" = hidden.

image[n].x

number image[n].x = 0.5

kept at the song's end

Where its middle sits from left to right: 0 = the left edge, 1 = the right edge.

image[n].y

number image[n].y = 0.5

kept at the song's end

Where its middle sits from top to bottom: 0 = the top, 1 = the bottom.

image[n].width

number image[n].width = 0.3

kept at the song's end

Its width as a share of the screen width. The height follows the picture's shape unless height is set.

image[n].height

number image[n].height = 0

Its height as a share of the screen height. 0 = follows the picture's shape; anything else stretches it.

image[n].alpha

number image[n].alpha = 1

0 – 1share of the screenkept at the song's end

Its opacity.

image[n].angle

number image[n].angle = 0

degreeskept at the song's end

Turned clockwise around its middle, in degrees.

image[n].color

colour image[n].color = #FFFFFF

kept at the song's end

Multiplied onto the picture (#FFFFFF = its own colours). Colours a "solid" box.

image[n].layer

choice image[n].layer = "front"

kept at the song's end

Which layer it's drawn on. "stage" paints it onto the world in a fight.

One of: "front", "back", "lanes", "top", "stage" (what they do).

image[n].order

number image[n].order = 0

kept at the song's end

Its place within the layer: higher = on top. Texts and pictures sort together.

image[n].columns

number image[n].columns = 1

1 – 64kept at the song's end

A sprite sheet: the picture is a grid of equal frames this many across, read left to right, top to bottom.

image[n].rows

number image[n].rows = 1

1 – 64kept at the song's end

A sprite sheet: this many frames down.

image[n].frames

number image[n].frames = 0

0 – 4096kept at the song's end

How many of the grid's cells are frames (0 = all of them).

image[n].frame

number image[n].frame = 0

kept at the song's end

The frame shown, from 0. Set it to 0 to play an animation again; a tween on it plays it at your speed.

image[n].fps

number image[n].fps = 0

0 – 240kept at the song's end

Frames a second it plays at by itself (0 = it stays on frame).

image[n].loop

switch image[n].loop = true

kept at the song's end

Starts over after the last frame (true) or stops on it (false).

image[n].follow

number image[n].follow = 0

0 – 1share of the screenkept at the song's endfights only

How much it moves with the fight camera: 1 = like the world, so the fighters never slide over it while the camera turns, nudges and bumps; 0 = it stays on the screen. x / y / width / height are where it sits while the camera rests.

image[n].flipX

switch image[n].flipX = false

kept at the song's end

Mirrored left to right.

image[n].flipY

switch image[n].flipY = false

kept at the song's end

Mirrored upside down.

image[n].anim

text image[n].anim = ""

kept at the song's end

A Psych sprite (the .png with a Sparrow .xml of the same name next to it): plays the frames whose names start with this, at fps. "" = the whole picture.

image[n].blend

choice image[n].blend = "normal"

kept at the song's end

How it's laid over what's under it: "normal", "add" (glows), "multiply" (darkens - shadows, tints), "screen" (lightens), "erase" (wipes out what's under it - in desktop mode a hole to the desktop), "key" (in desktop mode its exact #131313 pixels become holes to the desktop; elsewhere like normal).

One of: "normal", "add", "multiply", "screen", "erase", "key" (what they do).

Psych: setBlendMode

image[n].smooth

switch image[n].smooth = false

kept at the song's end

false (default) = drawn with sharp pixels, like the game. true = smoothed - for big, detailed art that's drawn smaller or turned. Psych's antialiasing.

image[n].shader

text image[n].shader = ""

kept at the song's end

A shader on this picture alone: a .frag or .fsh from the song folder, its events/ or shaders/ folder. "" = none. The shader sees the picture's own file (a Psych sprite: its whole sheet). Its iTime runs by itself; its other values stay 0. A picture with a shader is drawn with the normal blend, and color doesn't tint it. The same rules as shader[n] apply - whether it runs is the player's choice.

Psych: setSpriteShader