Fuze Arena Logo
  • Forum
  • Creations
    Catalogue Showcase
  • Help

getSpriteCamera()

Purpose

Get the sprite camera position

Description

Find the current sprite camera position. The initial position is (0, 0, 1)

Syntax

camera = getSpriteCamera( )

Arguments

camera A vector containing the current sprite camera position { x, y, z }

Example

image = loadImage( "Untied Games/Enemy A", false )
enemy = []
for i = 0 to 4 loop
    enemy[i] = createsprite()
    setSpriteImage( enemy[i], image )
    setSpriteAnimation( enemy[i], 0, 4, 20 )
    setSpriteLocation( enemy[i], { ( i % 2 ) * 400 + 400, int( i / 2 ) * 300 + 200 } )
    setSpriteScale( enemy[i], { 4, 4 } )
repeat

camera = getSpriteCamera()
rotation = getSpriteCameraRotation()
loop
    clear()
    c = controls( 0 )
    printAt( 0, 0, "Camera posotion: x = ", camera.x, " y = ", camera.y, " z = ", camera.z, " rotation: ", rotation )
    printAt( 0, 1, "Use left joypad to pan, right joypad to zoom/rotate" )
    if c.up then
        camera.y -= 5
    endIf
    if c.down then
        camera.y += 5
    endIf
    if c.left then
        camera.x -= 5
    endIf
    if c.right then
        camera.x += 5
    endIf
    if c.x then
        camera.z += 0.05
    endIf
    if c.b then
        camera.z -= 0.05
    endIf
    if c.y then
        rotation -= 0.5
    endIf
    if c.a then
        rotation += 0.5
    endIf
    setSpriteCamera( camera.x, camera.y, camera.z )
    setSpriteCameraRotation( rotation )
    updateSprites()
    drawSprites()
    update()
repeat

Associated Commands

centreSpriteCamera(), getSpriteCameraRotation(), setSpriteCamera(), setSpriteCameraRotation()

logo

©2019 FUZE Technologies Ltd. FUZE is a registered trademark of FUZE Technologies Ltd. All rights reserved.

Useful links

  • Fuze Main Site
  • Fuze Arena on Twitter
  • Fuze Arena on Youtube
  • Download Buyer

Contact Information

  • FUZE Technologies Ltd
    15 Clearfields Farm
    Wotton Underwood
    Aylesbury, Buckinghamshire
    ​England, HP18 0RS

  • +44 (0) 1844 239 432

  • contact@fuze.co.uk

© Copyright FUZE Technologies Ltd. All rights reserved.