Fuze Arena Logo
  • Forum
  • Creations
    Catalogue Showcase
  • Help

setSpriteScale()

Purpose

Scale a sprite

Description

Scale a sprite up or down in the horizontal and vertical axis

Syntax

setSpriteScale( sprite, scale )

setSpriteScale( sprite, { xScale, yScale } )

sprite.xscale = xScale; sprite.yscale = yScale

Arguments

sprite handle of the created sprite

scale amount to scale the sprite in the horizontal and vertical axes { x, y }

xScale amount to scale the sprite in the horizontal axis

yScale amount to scale the sprite in the vertical axis

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, { 5, 5 } )

loop
    clear()
    c = controls( 0 )
    printAt( 0, 0, "Use left joystick to resize sprite" )
    setSpriteScale( ship, { 10 * abs( c.lx ) + 5, 10 * abs( c.ly ) + 5 } )
    updateSprites()
    drawSprites()
    update()
repeat

Associated Commands

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