screen Width

Get the width in pixels of the screen.

scene.screenWidth()

Returns

  • a number that’s the width of the screen on the game device or simulator.

Example

Draw a wide line across the entire screen.

let showLine: Sprite = null
let wideLine: Image = null
wideLine = image.create(scene.screenWidth(), 3)
wideLine.fill(5)
showLine = sprites.create(wideLine)

See also

screen height