mode : Number or String. Predefined screen modes:
0 - 320x180
1 - 640x360
2 - 1280x720 (default)
3 - 1920x1080
"ZX" - 256x192
"WZX" - 336x192
"ZX81" - 64x48
"CGA" - 320x200
"EGA" - 640x350
"VGA" - 640x480
Set custom screen resolution.
width : Number. Width in pixels.
height : Number. Height in pixels.
Clear the whole screen. All Sprites and Sprite groups would be detached (but not destroyed) from Screen. Clears Console and Canvas, resets their positions and styles.
color : String. Color value. English color name ("yellow","red") or hex format (short "#F90" or long "#FF0000") allowed. Optional parameter. If omitted equals to "#000".
Set the background color. Resets Canvas position and style.
color : String. Color value. English color name ("yellow","red") or hex format (short "#F90" or long "#FF0000") allowed. Optional parameter. If omitted equals to "#000".
color : String. Color value. English color name ("yellow","red") or hex format (short "#F90" or long "#FF0000") allowed. Optional parameter. If omitted equals to "#000".
Return true if provided node is attached to Screen, false otherwise.
node : Object. Could be Sprite, SpriteGroup or HTMLElement object.
Boolean.
This function attaches node to the Screen.
node : Object. Could be Sprite, SpriteGroup or HTMLElement object.
This function detaches node from the Screen.
node : Object. Could be Sprite, SpriteGroup or HTMLElement object.
Clear consoLe Screen buffer.
Outputs text prompt to the Console buffer and waits for user input. If callback is not set, onInput function would be called (if defined). If used with await operator the code execution will be paused until user input is provided.
text : String. Optional parameter. If omitted equals to ''.
callback : Function reference. Function to call when operation is completed. Optional parameter. If omitted equals to null.
If the function was called with await operator, user input would be returned as String.
Output concatenated parameters to the new line in the Console buffer.
any number of parameters, separated by coma.
Output the text to the Console buffer at the given coordinates. Multiline text (separated with \n) is supported. Alternatively, the third parameter could be a two-dimensional array.
px : Number. Horizontal position coordinate.
py : Number. Vertical position coordinate.
any number of parameters, separated by coma.
Get current Console buffer content as string.
String.
Retrieve part of the current Console buffer content at given coordinates, of width and height provided. If asArray parameter is true the result would be a two-dimensional Array, multiline String otherwise.
px : Number. Horizontal position coordinate.
py : Number. Vertical position coordinate.
sw : Optional parameter. If omitted equals to 1.
sh : Optional parameter. If omitted equals to 1.
asArray : Boolean. Optional parameter. If omitted equals to false.
Set the font style to display Console buffer on the Screen.
fontFamily : String. "VGA", "EGA", "CGA" and "Emoji" font families supported. You might use other font families, but don't expect consistent result across all devices and browsers in this case. Specify two font families (separated by a comma) to use emojis and text. Optional parameter. If omitted equals to "Emoji,EGA".
color : String. Color value. English color name ("yellow","red") or hex format (short "#F90" or long "#FF0000") allowed. Optional parameter. If omitted equals to "#FFF".
fontSizePx : Optional parameter. If omitted equals to 16.
lineHeightPx : Optional parameter. If omitted equals to fontSizePx.
bold : Optional parameter. If omitted equals to false.
Set the Console blend mode. Experimental feature, slow on the real hardware. Following values are allowed: normal, multiply, screen, overlay, darken, lighten, color-dodge, color-burn, hard-light, soft-light, difference, exclusion, hue, saturation, color, luminosity, unset.
blendMode : Optional parameter. If omitted equals to "normal".
Show Console on the Screen.
bool : Boolean. Optional parameter. If omitted equals to true.
Hide Console from the Screen.
Mark Console for a rebuild from the Console.buffer. Actual drawing will occur on the next animation frame. Call this function if direct changes were made to the Console.buffer array.
Clear the Canvas with color provided. Resets Canvas position and styles.
color : String. Color value. English color name ("yellow","red") or hex format (short "#F90" or long "#FF0000") allowed. Optional parameter. If omitted equals to "#000".
width : Number. Width in pixels. Optional parameter. If omitted equals to Screen.width.
height : Number. Height in pixels. Optional parameter. If omitted equals to Screen.height.
x : Number. Horizontal position in Canvas coordinates.
y : Number. Vertical position in Canvas coordinates.
z : Optional parameter. If omitted equals to -32768.
Use this function to enable/disable Canvas anti-aliasing. Enable anti-aliasing if you need smoother-looking graphics.
antiAliasing : Optional parameter. If omitted equals to true.
Stroke line from (x1,y1) to (x2,y2) with color provided (or with Canvas.strokeStyle).
x1 : Number. Horizontal position in Canvas coordinates of the starting point.
y1 : Number. Vertical position in Canvas coordinates of the starting point.
x2 : Number. Horizontal position in Canvas coordinates of the destination point.
y2 : Number. Vertical position in Canvas coordinates of the destination point.
strokeStyle : color or style to draw stokes. English color name ("yellow","red") or hex format (short "#F90" or long "#FF0000") allowed. If boolean true argument passed current Canvas.strokeStyle would be used. If boolean false argument passed - no strokes would be drawn. Optional parameter. If omitted equals to true.
x : Number. Horizontal position in Canvas coordinates.
y : Number. Vertical position in Canvas coordinates.
radius : Number. Defines the radius in pixels.
strokeStyle : color or style to draw stokes. English color name ("yellow","red") or hex format (short "#F90" or long "#FF0000") allowed. If boolean true argument passed current Canvas.strokeStyle would be used. If boolean false argument passed - no strokes would be drawn. Optional parameter. If omitted equals to true.
fillStyle : color or style to fill current path. English color name ("yellow","red") or hex format (short "#F90" or long "#FF0000") allowed. If boolean true argument passed current Canvas.fillStyle would be used. If boolean false argument passed - the shape won't be filled. Optional parameter. If omitted equals to false.
x : Number. Horizontal position in Canvas coordinates.
y : Number. Vertical position in Canvas coordinates.
radius : Number. Defines the radius in pixels.
fillStyle : color or style to fill current path. English color name ("yellow","red") or hex format (short "#F90" or long "#FF0000") allowed. If boolean true argument passed current Canvas.fillStyle would be used. If boolean false argument passed - the shape won't be filled. Optional parameter. If omitted equals to true.
Stroke and/or fill rectangle at (x,y) position with (width,height) dimensions.
x : Number. Horizontal position in Canvas coordinates.
y : Number. Vertical position in Canvas coordinates.
width : Number. Width in pixels.
height : Number. Height in pixels.
strokeStyle : color or style to draw stokes. English color name ("yellow","red") or hex format (short "#F90" or long "#FF0000") allowed. If boolean true argument passed current Canvas.strokeStyle would be used. If boolean false argument passed - no strokes would be drawn. Optional parameter. If omitted equals to true.
fillStyle : color or style to fill current path. English color name ("yellow","red") or hex format (short "#F90" or long "#FF0000") allowed. If boolean true argument passed current Canvas.fillStyle would be used. If boolean false argument passed - the shape won't be filled. Optional parameter. If omitted equals to false.
x : Number. Horizontal position in Canvas coordinates.
y : Number. Vertical position in Canvas coordinates.
width : Number. Width in pixels.
height : Number. Height in pixels.
fillStyle : color or style to fill current path. English color name ("yellow","red") or hex format (short "#F90" or long "#FF0000") allowed. If boolean true argument passed current Canvas.fillStyle would be used. If boolean false argument passed - the shape won't be filled. Optional parameter. If omitted equals to true.
x : Number. Horizontal position in Canvas coordinates.
y : Number. Vertical position in Canvas coordinates.
radiusX : Number. Defines the horizontal radius in pixels.
radiusY : Number. Defines the vertical radius in pixels.
rotation : Number. Absolute rotation angle in Radians. Use degToRad() function to easily convert from Degrees to Radians.
strokeStyle : color or style to draw stokes. English color name ("yellow","red") or hex format (short "#F90" or long "#FF0000") allowed. If boolean true argument passed current Canvas.strokeStyle would be used. If boolean false argument passed - no strokes would be drawn. Optional parameter. If omitted equals to true.
fillStyle : color or style to fill current path. English color name ("yellow","red") or hex format (short "#F90" or long "#FF0000") allowed. If boolean true argument passed current Canvas.fillStyle would be used. If boolean false argument passed - the shape won't be filled. Optional parameter. If omitted equals to false.
x : Number. Horizontal position in Canvas coordinates.
y : Number. Vertical position in Canvas coordinates.
radiusX : Number. Defines the horizontal radius in pixels.
radiusY : Number. Defines the vertical radius in pixels.
rotation : Number. Absolute rotation angle in Radians. Use degToRad() function to easily convert from Degrees to Radians.
fillStyle : color or style to fill current path. English color name ("yellow","red") or hex format (short "#F90" or long "#FF0000") allowed. If boolean true argument passed current Canvas.fillStyle would be used. If boolean false argument passed - the shape won't be filled. Optional parameter. If omitted equals to false.
x : Number. Horizontal position in Canvas coordinates.
y : Number. Vertical position in Canvas coordinates.
radius : Number. Defines the radius in pixels.
startAngle : Number. Angle in Radians, counted clockwise. Use degToRad() function to easily convert from Degrees to Radians.
endAngle : Number. Angle in Radians, counted clockwise. Use degToRad() function to easily convert from Degrees to Radians.
strokeStyle : color or style to draw stokes. English color name ("yellow","red") or hex format (short "#F90" or long "#FF0000") allowed. If boolean true argument passed current Canvas.strokeStyle would be used. If boolean false argument passed - no strokes would be drawn. Optional parameter. If omitted equals to true.
fillStyle : color or style to fill current path. English color name ("yellow","red") or hex format (short "#F90" or long "#FF0000") allowed. If boolean true argument passed current Canvas.fillStyle would be used. If boolean false argument passed - the shape won't be filled. Optional parameter. If omitted equals to false.
Put a single pixel on Canvas
x : Number. Horizontal position in Canvas coordinates.
y : Number. Vertical position in Canvas coordinates.
colorOrRGB : String or Array. Color value. In case if array is passed, it should contain 3 or 4 integers in range 0 to 255, representing color component values [Red, Ggreen, Blue, Alpha]. English color name ("yellow","red") or hex format (short "#F90" or long "#FF0000") allowed. Optional parameter. If omitted equals to Canvas.fillStyle.
Get color of a single pixel from the Canvas. By default returns an array [Red,Green,Blue,Alpha]. If hexFormat parameter provided will return color in hex format (#FFFFFF).
x : Number. Horizontal position in Canvas coordinates.
y : Number. Vertical position in Canvas coordinates.
hexFormat : Boolean. Pass boolean true to receive the result in hex format (like "#FFFFFF"). Optional parameter. If omitted equals to false.
Set the Canvas.strokeStyle property. This style would be applied to all consecutive stroke operations.
strokeStyle : color or style to draw stokes. English color name ("yellow","red") or hex format (short "#F90" or long "#FF0000") allowed. If boolean true argument passed current Canvas.strokeStyle would be used. If boolean false argument passed - no strokes would be drawn.
Set the Canvas.fillStyle property. This style would be applied to all consecutive fill operations.
fillStyle : color or style to fill current path. English color name ("yellow","red") or hex format (short "#F90" or long "#FF0000") allowed. If boolean true argument passed current Canvas.fillStyle would be used. If boolean false argument passed - the shape won't be filled.
Set Canvas.lineWidth property, changing the line width for all consecutive line drawing operations.
lineWidth : Number. Line width in pixels. Optional parameter. If omitted equals to 1.
Show Canvas on the Screen.
bool : Boolean. Optional parameter. If omitted equals to true.
Hide Canvas from the Screen.
Set the font parameters to draw text with the following Canvas.fillText or Canvas.strokeText functions. Alters Canvas.fillStyle and Canvas.strokeStyle.
fontFamily : String. "VGA", "EGA", "CGA" and "Emoji" font families supported. You might use other font families, but don't expect consistent result across all devices and browsers in this case. Specify two font families (separated by a comma) to use emojis and text. Optional parameter. If omitted equals to "Emoji,EGA".
color : String. Color value. English color name ("yellow","red") or hex format (short "#F90" or long "#FF0000") allowed. Optional parameter. If omitted equals to "#FFF".
fontSizePx : Optional parameter. If omitted equals to 16.
bold : Optional parameter. If omitted equals to false.
text : String.
x : Number. Horizontal position in Canvas coordinates.
y : Number. Vertical position in Canvas coordinates.
maxWidth : Number. Optional parameter. The maximum number of pixels wide the text should be when rendered.
text : String.
x : Number. Horizontal position in Canvas coordinates.
y : Number. Vertical position in Canvas coordinates.
maxWidth : Number. Optional parameter. The maximum number of pixels wide the text should be when rendered.
Measure provided text, using current font metrics.
text : String.
TextMetrics object that contains following properties: width, actualBoundingBoxLeft, actualBoundingBoxRight, fontBoundingBoxAscent, fontBoundingBoxDescent, actualBoundingBoxAscent, actualBoundingBoxDescent, emHeightAscent, emHeightDescent, hangingBaseline, alphabeticBaseline, ideographicBaseline.
Starts a new sub-path.
Closes the current sub-path, drawing straight line to the start of the path. Call Canvas.fill() or Canvas.stroke() later to fill or stroke the current path.
Move the starting point of a new sub-path to (x, y)
x : Number. Horizontal position in Canvas coordinates.
y : Number. Vertical position in Canvas coordinates.
Connect the current pen position and (x, y) with the straight line in current sub-path. Call Canvas.stroke() later to stroke the current path.
x : Number. Horizontal position in Canvas coordinates.
y : Number. Vertical position in Canvas coordinates.
cpx : Number. Horizontal position in Canvas coordinates of the control point.
cpy : Number. Vertical position in Canvas coordinates of the control point.
cp2x : Number. Horizontal position in Canvas coordinates of the second control point.
cp2y : Number. Vertical position in Canvas coordinates of the second control point.
epx : Number. Horizontal position in Canvas coordinates of the end point.
epy : Number. Vertical position in Canvas coordinates of the end point.
cpx : Number. Horizontal position in Canvas coordinates of the control point.
cpy : Number. Vertical position in Canvas coordinates of the control point.
epx : Number. Horizontal position in Canvas coordinates of the end point.
epy : Number. Vertical position in Canvas coordinates of the end point.
x1 : Number. Horizontal position in Canvas coordinates of the starting point.
y1 : Number. Vertical position in Canvas coordinates of the starting point.
x2 : Number. Horizontal position in Canvas coordinates of the destination point.
y2 : Number. Vertical position in Canvas coordinates of the destination point.
radius : Number. Defines the radius in pixels.
Fill the current sub-path with Canvas.fillStyle
Stroke the current sub-path with Canvas.strokeStyle
imageData : ImageData object. Contains following properties: data (one-dimensional array containing the pixel data in the RGBA order), height (height of the area), width (width of the area)
dx : Number. Horizontal position in Canvas coordinates to draw the image.
dy : Number. Vertical position in Canvas coordinates to draw the image.
rx : Number. Horizontal coordinate of the sub-rectangle of the source image. Optional parameter. If omitted equals to 0.
ry : Number. Vertical coordinate of the sub-rectangle of the source image. Optional parameter. If omitted equals to 0.
width : Number. Width in pixels. Optional parameter. If omitted equals to imageData.width.
height : Number. Height in pixels. Optional parameter. If omitted equals to imageData.height.
rx : Number. Horizontal coordinate of the sub-rectangle of the source image.
ry : Number. Vertical coordinate of the sub-rectangle of the source image.
width : Number. Width in pixels.
height : Number. Height in pixels.
ImageData object. Contains following properties: data (one-dimensional array containing the pixel data in the RGBA order), height (height of the area), width (width of the area)
Draw Image on Canvas. Make sure image is loaded and ready before drawing.
image : Object. Could be Sprite or HTMLImageElement object.
dx : Number. Horizontal position in Canvas coordinates to draw the image.
dy : Number. Vertical position in Canvas coordinates to draw the image.
Draw Image on Canvas. Make sure image is loaded and ready before drawing.
image : Object. Could be Sprite or HTMLImageElement object.
dx : Number. Horizontal position in Canvas coordinates to draw the image.
dy : Number. Vertical position in Canvas coordinates to draw the image.
dWidth : Number. Width of the image rectangle on Canvas.
dHeight : Number. Height of the image rectangle on Canvas.
Draw Image on Canvas. Make sure image is loaded and ready before drawing.
image : Object. Could be Sprite or HTMLImageElement object.
rx : Number. Horizontal coordinate of the sub-rectangle of the source image.
ry : Number. Vertical coordinate of the sub-rectangle of the source image.
rWidth : Number. Width of the sub-rectangle of the source image.
rHeight : Number. Height of the sub-rectangle of the source image.
dx : Number. Horizontal position in Canvas coordinates to draw the image.
dy : Number. Vertical position in Canvas coordinates to draw the image.
dWidth : Number. Width of the image rectangle on Canvas.
dHeight : Number. Height of the image rectangle on Canvas.
x1 : Number. Horizontal position in Canvas coordinates of the starting point.
y1 : Number. Vertical position in Canvas coordinates of the starting point.
x2 : Number. Horizontal position in Canvas coordinates of the destination point.
y2 : Number. Vertical position in Canvas coordinates of the destination point.
x1 : Number. Horizontal position in Canvas coordinates of the starting point.
y1 : Number. Vertical position in Canvas coordinates of the starting point.
r1 : Number. Defines the radius in pixels.
x2 : Number. Horizontal position in Canvas coordinates of the destination point.
y2 : Number. Vertical position in Canvas coordinates of the destination point.
r2 : Number. Defines the radius in pixels.
Add a sentence to the text-to-speech buffer queue.
text : String.
lang : Language constant:
"de-DE" - German
"en-GB" - United Kingdom English
"en-US" - United States English (default)
"es-ES" - Spanish
"fr-FR" - French
"it-IT" - Italian
"ru-RU" - Russian (Cyrillic characters not supported yet - use translit).
Optional parameter. If omitted equals to "en-US".
Clear text-to-speech buffer and say the sentence at once.
text : String.
lang : Language constant:
"de-DE" - German
"en-GB" - United Kingdom English
"en-US" - United States English (default)
"es-ES" - Spanish
"fr-FR" - French
"it-IT" - Italian
"ru-RU" - Russian (Cyrillic characters not supported yet - use translit).
Optional parameter. If omitted equals to "en-US".
Set volume for the audio channel specified.
volume : Number. Should be in range 0.00 to 1.00
channel : Audio channel number. Optional parameter. If omitted equals to 0.
Set the oscillator type for the audio channel specified. Clears the channel.
oscillatorType : String. Supported types are: "sine","square","sawtooth","triangle".
channel : Audio channel number. Optional parameter. If omitted equals to 0.
Clear the audio channel play queue. Stops sound generation.
channel : Audio channel number. Optional parameter. If omitted equals to 0.
Adds sound with specified frequency to the audio channel play queue.
frequency : Number. Frequency of the sound in Hz.
duration : Number. Duration of the sound in Seconds.
fade : Number. Specifies how much sound should fade through the duration in range 0.00 to 1.00 Optional parameter. If omitted equals to 0.
channel : Audio channel number. Optional parameter. If omitted equals to 0.
Adds the frequency corresponding to the MIDI note number to the audio channel play queue.
note : Number. Note number as per MIDI specification in range 0 to 127
duration : Number. Duration of the sound in Seconds.
fade : Number. Specifies how much sound should fade through the duration in range 0.00 to 1.00 Optional parameter. If omitted equals to 0.
channel : Audio channel number. Optional parameter. If omitted equals to 0.
Add simple beep sound to the audio channel play queue. Command is similar to the one found in ZX Spectrum Basic. Be aware that argument order differs. ZX Basic BEEP 1,0 equals to Tauon Basic Script beep(0,1).
pitch : Number. Pitch of the sound, given in semitones above middle C. Use negative numbers for notes below middle C.
duration : Number. Duration of the sound in Seconds.
channel : Audio channel number. Optional parameter. If omitted equals to 0.
Parse music notation string and add resulting frequencies to the audio channel play queue.
musicNotationString : The notation might start with BPM character sequence, for example, "BPM120"
This defines the Tempo of the music. The default Tempo is 120.
You can set the current Octave with the O character, followed by the octave number (0-9). For example "O3" sets the third octave as a default one for the notes that will follow. The default octave is 4.
Capital letters represent single Note: C, D, E, F, G, A, B.
R character represents Rest (pause). It is treated as a Note by the engine, so all duration modifications could be applied.
# (sharp) symbol before Note raises the Note by a semitone (half-step up), for example, sharp C could be written as "#C".
b (small B letter) before Note lowers the Note by a semitone (half-step down), for example, flat D could be written as "bD".
To modify the octave of the Note - add a single number just after the Note: "C5" equals C from the fifth octave. "C+" will shift the octave up and "C-" - down. This octave shift doesn't affect the notes that will follow.
You can control the duration of notes that will follow using the L modifier. With L0 being the longest (Semibreve) and L6 being shortest (Hemidemisemiquaver).
The multiply character "*" after the Note will increase its duration by the factor of two. Two characters will increase Note duration by the factor of four.
The slash character "/" after the Note will decrease its duration by half. Two slashes will decrease Note duration by the factor of four.
The dot "." character after the Note increases duration by half. Two dots ".." will increase the duration by 1/2+1/4 and so on.
Underscore "_" character specifies that the current note is beamed with the following one.
channel : Audio channel number. Optional parameter. If omitted equals to 0.
Get the remaining play queue length (in seconds) for the audio channel specified.
channel : Audio channel number. Optional parameter. If omitted equals to 0.
Create Sprite from one or more Emoji characters.
emoji : String. One or more emoji character. Emoji font would be used to draw glyphs.
size : Number. Font size (in pixels) to draw characters with. Optional parameter. If omitted equals to 16.
paperColor : String. Background color for the Sprite. English color name ("yellow","red") or hex format (short "#F90" or long "#FF0000") allowed. Optional parameter. If omitted equals to ''.
Reference to the newly created Sprite object. It might take some time for Sprite to load and initialize. Use Sprite.isReady and Sprite.whenReady functions if you wish to clone the Sprite or draw it on Canvas.
Create Sprite from one or more characters.
text : String.
fontFamily : String. "VGA", "EGA", "CGA" and "Emoji" font families supported. You might use other font families, but don't expect consistent result across all devices and browsers in this case. Specify two font families (separated by a comma) to use emojis and text. Optional parameter. If omitted equals to "EGA".
size : Number. Font size (in pixels) to draw characters with. Optional parameter. If omitted equals to 16.
inkColor : String. Color to draw character with. English color name ("yellow","red") or hex format (short "#F90" or long "#FF0000") allowed. Optional parameter. If omitted equals to "#FFFFFFFF".
paperColor : String. Background color for the Sprite. English color name ("yellow","red") or hex format (short "#F90" or long "#FF0000") allowed. Optional parameter. If omitted equals to "transparent".
Reference to the newly created Sprite object. It might take some time for Sprite to load and initialize. Use Sprite.isReady and Sprite.whenReady functions if you wish to clone the Sprite or draw it on Canvas.
Create Sprite from image data string. Each character represents index in palette [0..9A..Z] and defines color of the single pixel. The two default palettes have 17 colors [0..G]. You can use ' ' space character in the string to draw transparent pixel.
Palette 0: 0 1 2 3 4 5 6 7 8 9 A B C D E F G
Palette 1: 0 1 2 3 4 5 6 7 8 9 A B C D E F G
pixelData : String. Each character represents index in palette [0..9A..Z] and defines color of the single pixel. The two default palettes have 17 colors [0..G]. You can create more palettes with setPalette function.
width : Number. Width in pixels.
height : Number. Height in pixels.
paletteIndex : Number. Palette index to use. By default Tauon Basic Script has two palettes with indexes 0 and 1. You can create new or modify existing palette with setPalette function. Optional parameter. If omitted equals to 0.
Reference to the newly created Sprite object. It might take some time for Sprite to load and initialize. Use Sprite.isReady and Sprite.whenReady functions if you wish to clone the Sprite or draw it on Canvas.
Create Sprite from binary data array. Each element of the array would be treated as a binary number [0..255]. Each bit of that number will define 8 pixels of the Sprite. All bits equal to 1 would produce pixels with inkColor. Bits equal to 0 - with paperColor. If paperColor parameter is omitted, a transparent color would be used.
bytesArray : Array of bytes in range 0 to 255. Each element of the array will define 8 pixels of the Sprite.
width : Number. Width in pixels.
height : Number. Height in pixels.
inkColor : String. Color to draw character with. English color name ("yellow","red") or hex format (short "#F90" or long "#FF0000") allowed. Optional parameter. If omitted equals to "#FFFFFFFF".
paperColor : String. Background color for the Sprite. English color name ("yellow","red") or hex format (short "#F90" or long "#FF0000") allowed. Optional parameter. If omitted equals to "#00000000".
Reference to the newly created Sprite object. It might take some time for Sprite to load and initialize. Use Sprite.isReady and Sprite.whenReady functions if you wish to clone the Sprite or draw it on Canvas.
url : String. Uniform Resource Locator. Could point to external address to load image from the web or could contain in-line data.
fileName : String. File name. Could contain relative or absolute file system path.
Create new SpriteGroup object and add it to the Screen. Pass various Sprites as parameters to add them to the group. You can add more Sprites later using spriteGroup.appendChild function.
any number of parameters, separated by coma.
sprite : previously created or loaded Sprite object.
bool : Boolean. Optional parameter. If omitted equals to true.
sprite : previously created or loaded Sprite object.
sprite : previously created or loaded Sprite object.
px : Number. Horizontal position coordinate.
py : Number. Vertical position coordinate.
pz : Number. Z-index of the object. An element with greater z-index is always in front of an element with a lower z-index.
rotation : Number. Absolute rotation angle in Radians. Use degToRad() function to easily convert from Degrees to Radians.
scaleX : Number. Absolute horizontal Sprite scale factor.
scaleY : Number. Absolute vertical Sprite scale factor.
Set the Sprite position.
sprite : previously created or loaded Sprite object.
px : Number. Horizontal position coordinate.
py : Number. Vertical position coordinate.
pz : Number. Z-index of the object. An element with greater z-index is always in front of an element with a lower z-index.
Set sprite rotation angle (in Radians) around its pivot point.
sprite : previously created or loaded Sprite object.
rotation : Number. Absolute rotation angle in Radians. Use degToRad() function to easily convert from Degrees to Radians.
sprite : previously created or loaded Sprite object.
scaleX : Number. Absolute horizontal Sprite scale factor.
scaleY : Number. Absolute vertical Sprite scale factor. Optional parameter. If omitted equals to scaleX.
Set sprite pivot point. The pivot defines the starting point for all transforms.
sprite : previously created or loaded Sprite object.
pivotX : Number. Horizontal position coordinate.
pivotY : Number. Vertical position coordinate.
sprite : previously created or loaded Sprite object.
opacity : Number. Should be in range 0.00 to 1.00 Optional parameter. If omitted equals to 1.0.
Apply CSS filter to the Sprite. You can stack filters separating them with space character.
sprite : previously created or loaded Sprite object.
filter : String. Supported filters are: none, blur(), brightness(), contrast(), drop-shadow(), grayscale(), hue-rotate(), invert(), opacity(), saturate(), sepia() Optional parameter. If omitted equals to "none".
Returns true if Sprite is loaded and fully initialized.
sprite : previously created or loaded Sprite object.
Calls callback function when Sprite is loaded and fully initialized.
sprite : previously created or loaded Sprite object.
callback : Function reference. Function to call when operation is completed.
Returns cloned Sprite or SpriteGroup. Make sure the source Sprite is ready or function will throw an error.
sprite : previously created or loaded Sprite object.
Reference to the newly created Sprite object. It might take some time for Sprite to load and initialize. Use Sprite.isReady and Sprite.whenReady functions if you wish to clone the Sprite or draw it on Canvas.
Detach Sprite from the Screen and free all resources associated with the Sprite object.
sprite : previously created or loaded Sprite object.
null
Returns the absolute value of X
Returns the arctangent of X
Returns the cosine of X
Returns E raised to power of X, where X is the argument, and E is Euler's constant
Returns the integer portion of X
Returns the natural logarithm of X
Returns base X to the exponent power of Y
Returns a pseudo-random number in range 0 to 1
Returns the sine of X
Returns the positive square root of X
Returns the tangent of X
Returns X rounded to the nearest integer
Returns X rounded up to the next largest integer.
Returns the largest integer less than or equal to X
Returns the value of X, clamped between an upper and lower bound.
Returns the largest argument.
any number of parameters, separated by coma.
Returns the smallest argument.
any number of parameters, separated by coma.
degrees : Number. Angle in Degrees units.
Number. Angle in Radians units.
radians : Number. Angle in Radians units.
Number. Angle in Degrees units.
Asynchronously read the file and pass its content to the callback function as String parameter.
fileName : String. File name. Could contain relative or absolute file system path.
callback : Function reference. Function to call when operation is completed.
Asynchronously write content to the file and call the callback function when done.
fileName : String. File name. Could contain relative or absolute file system path.
content : String. Content to write into the file.
callback : Function reference. Function to call when operation is completed.
Asynchronously read the directory and pass its content to the callback function as array.
path : String. File system path. Could be relative or absolute file system path.
callback : Function reference. Function to call when operation is completed.
fileName : String. File name. Could contain relative or absolute file system path.
callback : Function reference. Function to call when operation is completed.
fileName : String. File name. Could contain relative or absolute file system path.
callback : Function reference. Function to call when operation is completed.
Returns the length of an Array or String object. If obj is of type Set or Map - will return it size.
obj : Object.
Delay code execution for milliseconds specified. Must be used with await operator.
milliseconds : Number. Delay in milliseconds.
Operator await pauses code execution until asynchronous operation is fulfilled. Use with input, sleep or your async function.
asyncfunc : Asynchronous function, should return the Promise object.
Show an alert box with a specified text and an OK button.
text : String.
Show a dialog box with OK and Cancel buttons. Returns true if "OK" button pressed, false otherwise.
text : String.
Boolean.
Show a dialog box with a specified text, an input field, and an OK button. Returns a user-inputted string.
text : String.
default : String. The default value.
String.
Return the integer value parsed from the argument string.
str : String.
radix : Number. Optional parameter. An integer between 2 and 36 that represents the base of the numeral system.
Number.
Return the float value parsed from the argument string.
str : String.
Number.
Returns true if value is NaN (Not-a-Number).
value : String. Console buffer representation as String. Would be re-built from buffer on the next frame if set to null.
This method calls a function repeatedly after a number of milliseconds.
function : Function reference.
milliseconds : Number. Delay in milliseconds.
Number. Could be used to prevent function execution using clearInterval(intervalId).
Prevent function execution set with setInterval.
intervalId : Number. Could be used to prevent function execution using clearInterval(intervalId).
This method calls a function after a number of milliseconds.
function : Function reference.
milliseconds : Number. Delay in milliseconds.
Number. Could be used to prevent function execution using clearTimeout(timeoutId).
Prevent function execution set with setTimeout.
timeoutId : Number. Could be used to prevent function execution using clearTimeout(timeoutId).
Splits the string into an array of substrings, using separator as delimeter pattern.
str : String. Optional parameter. If omitted equals to ''.
separator : Optional parameter. If omitted equals to ''.
limit : Number. Optional parameter. Limits function output to first N elements.
Splits the string into an array of characters, preserving Unicode codepoints. Useful when working with strings containing Emojis.
str : String. Optional parameter. If omitted equals to ''.
Array.
Escape the string to safely pass it to the Linux shell command.
str : String.
String.
Returns mouse horizontal postion on the screen.
Returns mouse vertical postion on the screen.
Returns true if mouse button is currently down.
btnCode : Number. 0 - left mouse button. 2 - right mouse button.
Boolean.
Returns true if keyboard key with specified scan code is pressed.
keyCode : Number. Keyboard key code. Some useful codes are:
[1] key - 49, [A] key - 65, [Enter] - 13, [Space] - 32, [F1] key - 112.
Boolean.
paletteIndex : Number. Palette index to use. By default Tauon Basic Script has two palettes with indexes 0 and 1. You can create new or modify existing palette with setPalette function.
colorArray : Array. Each element of the array should be a string containing valid color. Both English color names ("yellow","red") and hex format (short "#F90" or long "#FF0000") forms are supported. Optional parameter. If omitted equals to [].
rgba : Array. Should contain 3 or 4 integers in range 0 to 255, representing color component values [Red, Ggreen, Blue, Alpha]. Optional parameter. If omitted equals to [255,255,255,255].
String. Color value. English color name ("yellow","red") or hex format (short "#F90" or long "#FF0000") allowed.
color : String. Color value. English color name ("yellow","red") or hex format (short "#F90" or long "#FF0000") allowed.
Array. Should contain 3 or 4 integers in range 0 to 255, representing color component values [Red, Ggreen, Blue, Alpha].
Get color corresponding to the colorIndex index from the paletteIndex palette.
colorIndex : String. or Number. Color index in the Palette. Supported indexes are from "0" to "9" and from "A" to "Z". If argument of Number type provided it would be treated as numeical color index.
paletteIndex : Number. Palette index to use. By default Tauon Basic Script has two palettes with indexes 0 and 1. You can create new or modify existing palette with setPalette function. Optional parameter. If omitted equals to 0.
String. Color value. English color name ("yellow","red") or hex format (short "#F90" or long "#FF0000") allowed.
Call this function with argument false to prevent program termination on any keypress.
bool : Boolean. Optional parameter. If omitted equals to true.
Execute Linux shell command and pass the result to the callback function when done.
cmd : String. Linux shell command to execute.
callback : Function reference. Function to call when operation is completed.
any number of parameters, separated by coma.
Adds text message to the IDE console
any number of parameters, separated by coma.
Adds warning mesasge to the IDE console
any number of parameters, separated by coma.
Adds an error description to the IDE console and terminates the program execution
any number of parameters, separated by coma.
Return to IDE or exit from the application if in standalone mode.
If defined, engine will call this function on each frame.
If defined, this function would be called when the user gives a response to the input statement.
text : String.
key : String. Keyboard key name in the upper case. For example: "A", "SPACE", "SHIFT", "ARROWLEFT", etc.
keyCode : Number. Keyboard key code. Some useful codes are:
[1] key - 49, [A] key - 65, [Enter] - 13, [Space] - 32, [F1] key - 112.
keyEvent : KeyboardEvent. Keyboard event object. Contains following read-only fields: code, key, repeat, altKey, ctrlKey, shiftKey, metaKey.
key : String. Keyboard key name in the upper case. For example: "A", "SPACE", "SHIFT", "ARROWLEFT", etc.
keyCode : Number. Keyboard key code. Some useful codes are:
[1] key - 49, [A] key - 65, [Enter] - 13, [Space] - 32, [F1] key - 112.
keyEvent : KeyboardEvent. Keyboard event object. Contains following read-only fields: code, key, repeat, altKey, ctrlKey, shiftKey, metaKey.
key : String. Keyboard key name in the upper case. For example: "A", "SPACE", "SHIFT", "ARROWLEFT", etc.
keyCode : Number. Keyboard key code. Some useful codes are:
[1] key - 49, [A] key - 65, [Enter] - 13, [Space] - 32, [F1] key - 112.
keyEvent : KeyboardEvent. Keyboard event object. Contains following read-only fields: code, key, repeat, altKey, ctrlKey, shiftKey, metaKey.
btnCode : Number. 0 - left mouse button. 2 - right mouse button.
mouseEvent : MouseEvent. Mouse event object. Contains following read-only fields: button, buttons, detail, altKey, ctrlKey, shiftKey, metaKey.
btnCode : Number. 0 - left mouse button. 2 - right mouse button.
mouseEvent : MouseEvent. Mouse event object. Contains following read-only fields: button, buttons, detail, altKey, ctrlKey, shiftKey, metaKey.
mouseX : Number. Horizontal position in screen coordinates of the Mouse cursor.
mouseY : Number. Vertical position in screen coordinates of the Mouse cursor.
mouseEvent : MouseEvent. Mouse event object. Contains following read-only fields: button, buttons, detail, altKey, ctrlKey, shiftKey, metaKey.