System

System functions are used to retrieve or update data on the device that your game is running on.

Function Description
device()

Returns the name of the device that the game is running on.

isMuteBackgroundSound()

Returns true if the background sound is muted on this device, false if not.

isMuteEffectsSound()

Returns true if effects are muted on this device, false if not.

save()

Saves all that game data custom for the specific game. This also includes the Settings object.

screenSize()

Returns the screen size of the device.

sendHapticFeedback(intensity)

Triggers haptic feedback to the user (if the device supports haptic).

setMuteBackgroundSound(value)

Mutes or unmutes the background sound.

setMuteEffectsSound(value)

Mutes or unmutes effects.


device()

Returns the name of the device that the game is running on.

Returns

string device the identification name of the device that the game is running on. Will return “preview” in the preview window.

↑ Back to top


isMuteBackgroundSound()

Returns true if the background sound is muted on this device, false if not.

Returns

boolean true if background sound is muted, false if not.

↑ Back to top


isMuteEffectsSound()

Returns true if effects are muted on this device, false if not.

Returns

boolean true if effects are muted, false if not.

↑ Back to top


save()

Saves all that game data custom for the specific game. This also includes the Settings object.

↑ Back to top


screenSize()

Returns the screen size of the device.

Returns

Vec2 The {x, y} size of the screen that your game is running on.

let width = System.screenSize().x;
let height = System.screenSize().y;

↑ Back to top


sendHapticFeedback(intensity)

Triggers haptic feedback to the user (iPhone support only).

Parameters

number intensity – the intensity of the haptic feedback. Accepted values: 1, 2

↑ Back to top


setMuteBackgroundSound(value)

Mutes or unmutes the background sound.

Parameters

boolean value – true to mute background sound, false to unmute

↑ Back to top


setMuteEffectsSound(value)

Mutes or unmutes effects.

Parameters

boolean value – true to mute effects, false to unmute

↑ Back to top

Did you find this page useful?

Please give it a rating:

Please provide some feedback!

This is very helpful to us.