Fuze Arena Logo
  • Forum
  • Creations
    Catalogue Showcase
  • Help

getSpriteScale()

Purpose

Get a sprite's scale factor

Description

This is the amount that the sprite's scale factor is changed by when updatesprites is called

Syntax

scale = getSpriteScale( sprite )

xscale = sprite.xscale; yscale = sprite.yscale

Arguments

handle handle of the created sprite

scale vector containing the scale factor values { x, y }

xscale amount to add to the horizontal scale of the sprite at each updatesprites call

yscale amount to add to the vertical scale of the sprite at each updatesprites call

Example

image = loadImage( "Untied Games/Enemy small top C", false )
ship = createSprite()
setSpriteImage( ship, image )
lastpos = { gWidth() / 2, gHeight() / 2 }
setSpriteLocation( ship, lastpos )
setSpriteScale( ship, { 10, 10 } )
minsf = 10 // min scale factor
maxsf = 20 // max scale factor
sv = 5

loop
    clear()
    sf = getSpriteScale( ship )
    if sv > 0 and sf.x > maxsf then
        sv = -sv
    endIf
    if sv < 0 and sf.x < minsf then
        sv = -sv
    endIf
    setSpriteScaleSpeed(ship, { sv, sv } )
    updateSprites()
    drawSprites()
    update()
repeat

Associated Commands

getSpriteScaleSpeed(), getSpriteSize(), 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.