Skip to content

Room related functions

9thCore edited this page Sep 19, 2022 · 14 revisions

The functions on this page are available by loading the room.lua extension. It is loaded by default.

level:getroom(index)

Returns the room at index index (0-3 for regular rooms, 4 for the ontop room) in the form of an object with functions to modify values of it.

Example:

mycoolroom = level:getroom(0) -- Get the first room.
-- Now you can do stuff with it, such as
mycoolroom:movex(1, 75, 1, 'Linear')
-- to move it.
-- The function used above will be explained later.

room:movex(beat, x, duration, ease)

Moves the room to x% on the x axis at beat beat with a duration duration and ease ease.

Example:

mycoolroom:movex(4, 75, 1, 'OutExpo') -- at beat 4, move mycoolroom's x position to 75% with a duration of 1 beat and OutExpo ease

room:movey(beat, y, duration, ease)

Moves the room to y% on the y axis at beat beat with a duration duration and ease ease.

Example:

mycoolroom:movey(6, 30, 0, 'OutQuad') -- at beat 6, move mycoolroom's y position to 30% with a duration of 0 beats and OutQuad ease

room:movesx(beat, x, duration, ease)

Scales the room on the x axis to x% with a duration duration and ease ease.

Example:

mycoolroom:movesx(8, 200, 1, 'InQuint') -- at beat 8, set mycoolroom's horizontal size to 200% with a duration of 1 beat and InQuint ease.

room:movesy(beat, y, duration, ease)

Scales the room on the y axis to y% with a duration duration and ease ease.

Example:

mycoolroom:movesy(6, 150, 1, 'InQuint') -- at beat 6, set mycoolroom's vertical size to 150% with a duration of 1 beat and InQuint ease.

room:rotate(beat, rot, duration, ease)

Rotates the room to rot degrees with a duration duration and ease ease.

Example:

mycoolroom:rotate(3, 90, 0.5, 'OutSine') -- at beat 3, rotate mycoolroom to 90 degrees with a duration of 0.5 beats and OutSine ease.

room:movepx(beat, x, duration, ease)

Moves the room's pivot to x% on the x axis at beat beat with a duration duration and ease ease.

Example:

mycoolroom:movepx(4, 75, 1, 'OutExpo') -- at beat 4, move mycoolroom's x pivot to 75% with a duration of 1 beat and OutExpo ease

room:movepy(beat, y, duration, ease)

Moves the room's pivot to y% on the y axis at beat beat with a duration duration and ease ease.

Example:

mycoolroom:movepx(4, 75, 1, 'OutExpo') -- at beat 4, move mycoolroom's y pivot to 75% with a duration of 1 beat and OutExpo ease

room:move(beat, p, duration, ease)

A helper function to make creating multiple movements at once easier. p is a key-value table where the key is what function to call and the value is the parameter.

Example:

mycoolroom:move(2, {     -- at beat 2,
    x = 40,         -- move the room to 40% on the x axis,
    sy = 0.5,       -- scale the room to half its size on the y axis,
    rotate = 90,        -- rotate the room by 90 degrees, (you can also use rot!)
    camx = 20,        -- move the room's camera's x position to 20%,
}, 1, 'Linear')         -- with a duration of 1 beat and Linear ease.
Clone this wiki locally