Fuze Arena Logo
  • Forum
  • Creations
    Catalogue Showcase
  • Help

setSpriteRotationSpeed()

Purpose

Set a sprites rotation speed

Description

Set a sprites speed of rotation. This is the amount that the sprite rotation angle is changed by when updatesprites is called

Syntax

setSpriteRotationSpeed( sprite, rotationSpeed )

sprite.rotation_speed = rotationSpeed

Arguments

sprite handle of the created sprite

*rotationSpeedamount to add to the rotation angle of the sprite at each updatesprites call

Example

radians( true )
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 } )
rv = 0
maxrv = 30 // max rotation speed
accrv = 0.3 // accelaration

loop
    clear()
    c = controls( 0 )
    printAt( 0, 0, "Use left joystick left or right to change rotation speed" )
    rv = rv + c.lx * accrv
    if abs( rv ) > maxrv then
        rv = rv / abs( rv ) * maxrv
    endIf
    setSpriteRotationSpeed( ship, rv )
    updateSprites()
    drawSprites()
    update()
repeat

Associated Commands

getSpriteRotation(), getSpriteRotationSpeed(), setSpriteRotation()

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.