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. |
frameSize() |
Returns the size of the game window on the device. |
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() |
(Deprecated) Returns the designer size of the device. This refers to the frame in the UI editor, and the frame when you enter the game camera mode. |
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.
fps()
Returns the Frames Per Second that the game is currently running at.
Returns
number the current game FPS
frameSize()
Returns the size of the game window on the device.
Returns
Vec2 the size of the game window
let width = System.frameSize().x; let height = System.frameSize().y;
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.
isMuteEffectsSound()
Returns true if effects are muted on this device, false if not.
Returns
boolean true if effects are muted, false if not.
save()
Saves all that game data custom for the specific game. This also includes the Settings object.
screenSize()
(Deprecated) Returns the designer size of the device. This refers to the frame in the UI editor, and the frame when you enter the game camera mode. It returns a constant value: 1136×64for landscape and640×113 for portrait.
Returns
Vec2 The designer size of the device
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
setMuteBackgroundSound(value)
Mutes or unmutes the background sound.
Parameters
boolean value – true to mute background sound, false to unmute
setMuteEffectsSound(value)
Mutes or unmutes effects.
Parameters
boolean value – true to mute effects, false to unmute