Fuze Arena Logo
  • Forum
  • Creations
    Catalogue Showcase
  • Help

abs()

Purpose

Returns absolute value of the given argument.

Description

Always returns the positive value of a given number. For instance: abs( -1 ) = 1

Syntax

absolute = abs( number )

Arguments

number A positive or negative number

absolute The positive value of number (the number without the - sign)

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 } )
maxrs = 240 // max rotation speed
accr = 1    // accelaration
loop
    clear()
    rs = getSpriteRotationSpeed( ship )
    if ( abs( rs ) > maxrs ) then
        accr = -accr
    endIf
    setSpriteRotationSpeed( ship, rs + accr )
    updateSprites()
    drawSprites()
    update()
repeat

Associated Commands

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.