Fuze Arena Logo
  • Forum
  • Creations
    Catalogue Showcase
  • Help

getSpriteColourSpeed()

Purpose

Get the colour speeds of a sprite

Description

Get the rates of change of the colours of a sprite. These are the amounts that the sprite colours are changed by when updatesprites is called

Syntax

colourspeed = getSpriteColourSpeed( sprite )

rspeed = sprite.r_speed; gspeed = sprite.g_speed; bspeed = sprite.b_speed; aspeed = sprite.a_speed; 

Arguments

handle handle of the created sprite

colourv vector containing the colour speed values { r, g, b, a }

rspeed amount to add to the red colour of the sprite at each updatesprites call

gspeed amount to add to the blue colour of the sprite at each updatesprites call

bspeed amount to add to the green colour of the sprite at each updatesprites call

aspeed amount to add to the opacity 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, { 20, 20 } )
setSpriteColourSpeed( ship, { -0.5, 0.5, 0, 0 } )

loop
    clear()
    sc = getSpriteColour( ship )
    cv = getSpriteColourSpeed( ship )
    if sc.r > 1 or sc.r < 0 then
        setSpriteColourSpeed(ship, { -cv.r, cv.g, cv.b, 0 } )
    endIf
    if sc.g > 1 or sc.g < 0 then
        setSpriteColourSpeed(ship, { cv.r, -cv.g, cv.b, 0 } )
    endIf
    updateSprites()
    drawSprites()
    update()
    sleep( 0.1 )
repeat

Associated Commands

getSpriteColour(), setSpriteColour(), setSpriteColourSpeed()

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.