Fuze Arena Logo
  • Forum
  • Creations
    Catalogue Showcase
  • Help

getSpriteSize()

Purpose

Find the size of a sprite

Description

Find the size of a sprite at the current scale factor. If the sprite was created from a tiled image then the tile size is returned at the current scale factor

Syntax

size = getSpriteSize( sprite )

Arguments

sprite handle of the sprite

size vector containing the width and height of the image (or tile) at the current scale factor { x, y }

Example

image = loadImage( "Untied Games/Player ships", false )
ship = createSprite()
setSpriteImage( ship, image )
setSpriteAnimation( ship, 0, 0, 0 )
setSpriteLocation( ship, { gWidth() / 2, gHeight() / 2 } )
setSpriteScale( ship, { 5, 5 } )

loop
    clear()
    size = getSpriteSize( ship )
    printAt( 0, 0, "Sprite Width: " + size.x )
    printAt( 0, 1, "Sprite Height: " + size.y )
    drawSprites()
    update()
repeat

Associated Commands

getSpriteScale(), getSpriteScaleSpeed(), setSpriteScale(), setSpriteScaleSpeed()

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.