System

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

Static Function Description
device()

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

fps()

Returns the Frames Per Second that the game is running currently.

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 (device vibration).

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 the identification name of the device that the game is running on. Will return “preview” in the preview window.

↑ Back to top


fps()

Returns the Frames Per Second that the game is currently running at.

Returns

number the current game FPS

↑ 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 (device vibration). The intensity variable will adjust the strength of the vibration on iPhone, but Android doesn’t have a concept of vibration strength, so a higher intensity variable will make the vibration last slightly longer.

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.

Tell us how we can improve this post?