ClassyBeat related functions - DPS2004/Doctor-s-Notepad GitHub Wiki

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

All functions and variables on this page are in a row object (see Row related functions). For the examples provided, the row is going to be stored in the variable mycoolrow.

row:classyinit(disableHeartCrack)

Initializes ClassyBeat for the respective row. If the optional argument disableHeartCrack is set, heart cracking functionality is disabled for this row.

Note: heart cracking is implemented using RDCode and each row uses an integer (i0-i9) if heart cracking is disabled for it. This means that you can only have 10 rows maximum that have heart cracking (there isn't a limit on ClassyBeat rows that have disabled heart cracking, however)

Every function under this will only be available if classyinit() was called on said row, and this function cannot be called multiple times per row. Additionally, all base row functions can still be called, even after classyinit().

Example:

mycoolrow:classyinit() -- Initialize the row as a ClassyBeat row and don't disable heart cracking
mycoolrow:classyinit(true) -- Initialize the row as a ClassyBeat row and disable heart cracking

row.classy

Table which stores the components of the row. Has four members: connector (decoration), beats (list of decorations), hitbar (decoration), heart (decoration). For functions to manipulate said decorations, see Decoration related functions.

connector is a decoration, the connector between the character and the row.
beats holds 6 decorations, each corresponding to one pulse on the row.
hitbar is a decoration, the yellow hitline at the end of the row.
heart is a decoration, the heart at the end of the row along with the connector between the two.

It is not recommended to move the decorations themselves, as they will be moved automatically whenever the row moves around.

Example:

local heart = row.classy.heart -- Get the row's heart
heart:movesy(1, 2, 1, 'OutElastic') -- Scale the heart on the Y axis

row:showclassy(beat)

Shows the ClassyBeat row and hides the real row at the beat beat. ClassyBeat rows start out hidden, this function is needed to make them appear.

Example:

mycoolrow:showclassy(0) -- Show the ClassyBeat row from the beginning

row:hideclassy(beat)

Hides the ClassyBeat row and shows the real row at the beat beat.

Example:

mycoolrow:hideclassy(2) -- Hide the ClassyBeat row at beat 2

row:delayclassy(beat, delay)

Delays movements of the ClassyBeats by delay beats, increasing the closer the ClassyBeats are to the end of the row.
The connector will be unaffected, the first pulse will be delayed by delay beats, the second will be by delay * 2 beats, etc.

Example:

mycoolrow2:delayclassy(1, 0.25) -- Delay the movements of subsequent pulses by .25 beats
mycoolrow2:movey(1, 40, 1, 'OutQuad')
mycoolrow2:movey(2, 26, 2, 'InOutQuad')
mycoolrow2:movey(4, 40, 2, 'InOutQuad')
-- The functions above will create a wave-y effect!

mycoolrow2:delayclassy(8, -0.25) -- The delay can also be negative, moving the heart first and character last!
mycoolrow2:movey(8, 26, 2, 'InOutQuad')
mycoolrow2:movey(10, 40, 2, 'InOutQuad')
mycoolrow2:movey(12, 26, 2, 'InOutQuad')
mycoolrow2:movey(14, 40, 2, 'InOutQuad')

row:usepivot(beat, usePivot)

By default, ClassyBeats are moved using their X and Y positions to where they should be, which doesn't bode well with rotation. However, if this function is called and usePivot is set to true, ClassyBeats will instead change their horizontal pivot to achieve the effect, allowing the use of rotation, at the potential cost of side-effects.
if usePivot is set to false, ClassyBeats will once again be moved using their X and Y positions instead of pivots.

Note: this function will cancel ongoing movements and teleport ClassyBeats to their destination. Calling this when they are not moving shouldn't be a problem, though.

Example:

mycoolrow:classyusepivot(1, true) -- Set-up pivot movement
mycoolrow:rotate(1, 20, 2, 'OutSine')
mycoolrow:rotate(3, -20, 4, 'InOutSine')
mycoolrow:rotate(7, 20, 4, 'InOutSine')
mycoolrow:rotate(11, 0, 4, 'InOutSine')
 -- Rotation!! woo

row:lockposition(beat, lock)

"Locks" the position of the row, allowing using the function classyoffset.

Note: unlike the name suggests, does not really lock the row. The row can still be moved, however, it is not recommended to do so.

Example:

mycoolrow:lockposition(1, true) -- Lock the row in place
mycoolrow:classyoffset(1, 1, { -- Offset the first pulse (more on this later)
	y = 30
}, 1, 'Linear')
mycoolrow:lockposition(2, false) -- Unlock the row
mycoolrow:movey(2, 20, 1, 'OutExpo') -- We can move it again

row:classyoffset(beat, part, p, duration, ease)

Moves the part part much like a decoration's move function, with p being a table of movements.
part can be: 0 (connector), 1-6 (pulses), 7 (hitbar), 8 (heart)

Example:

mycoolrow:lockposition(1, true)
mycoolrow:classyoffset(1, 1, { -- Offset the first pulse 
	y = 30
}, 1, 'Linear')
mycoolrow:lockposition(2, false)
mycoolrow:movey(2, 20, 1, 'OutExpo') -- Move the row, the beat remains offset!