Frequently asked questions in Scripting

Revision as of 15:19, 8 July 2024 by -u ndefined- (talk | contribs) (Add FAQ 'Can I copy or paste blocks between levels and games?' and category)

This page lists the short, common questions asked when scripting or building a game.

Copy-pasting blocks between levels and games

There is no direct solution. The widely used workaround is to create a new custom block specifically for copying, and to open it and placing the desired blocks. This block is now available for opening in another level, in order to retrieve the contents.

For pasting between games, scroll down and fetch the block in the appropriate game folder in the Blocks tab, and drag it into the level. Setting it to be a custom block for the current game allows to open the script, and get the contents.

Fonts

In alphabetical order:

Virtual Buttons

The Joystick and Button script blocks have been provided since then. It used to be commonplace to build one manually, or use these custom scripts created by these people:

Music

Composing music

Using Tim0lmazan's 'game music kit', you can make music with blocks which don't have any scripts inside them You might need to copy the sheet block a little to make longer songs. Also, the sound pitch depends on the Z position.

Manually

Pitch scales exponentially, not linearly. Two sounds played with the same numerical difference but different ranges will not sound the same in pitch difference.

To get the 12-note scale, use an integer, divide by twelve and power two by the result, because an octave in this scale doubles the pitch.

Other scales are possible using this method, such as the 31-note scale by dividing by 31 instead. In fact, given a List with the tuning of each note in a scale, one can achieve finer control:

o ^ (s[n % l] + floor(n / l)), where
n is an integer, the note to be played,
s is the list of the notes in an ordered ratio,
l is the length of the scale, and
o is the ratio of the octave, usually 2 for regular octave.

Numbers on the list s should not exceed 1.

Pre-made music

Find a editable working music on Fancade game search on the Fancade app. But if you think the music is too bad for your game, then try to modify it. (If you can't modify it, then the music kit is set to 'Levels' and you can't make a editable game using it.)