subtract
Purpose
Subtraction operator -
Description
Finds the difference between the numbers either side of the - operator. The result is the first number decreased by the second
Syntax
result = number1 - number2
Arguments
result difference between number1 and number2
number1 first number
number2 second number
Example
image = loadImage( "Untied Games/Enemy A", false )
enemy = []
for i = 0 to 4 loop
enemy[ i ] = createSprite()
setSpriteImage( enemy[ i ], image)
setSpriteAnimation( enemy[ i ], 0, 4, 20 )
setSpriteLocation( enemy[ i ], { (i % 2) * 400 + 400, int(i / 2) * 300 + 200 } )
setSpriteScale( enemy[ i ], { 4, 4 } )
repeat
camera = getSpriteCamera()
rotation = getSpriteCameraRotation()
loop
clear()
c = controls( 0 )
printAt( 0, 0, "Camera position: x = ", camera.x, " y = ", camera.y, " z = ", camera.z, " rotation: ", rotation )
printAt(0, 1, "Use left joypad to pan, right joypad to zoom/rotate")
if c.up then
camera.y -= 5
endIf
if c.down then
camera.y += 5
endIf
if c.left then
camera.x -= 5
endIf
if c.right then
camera.x += 5
endIf
if c.x then
camera.z += 0.05
endIf
if c.b then
camera.z -= 0.05
endIf
if c.y then
rotation -= 0.5
endIf
if c.a then
rotation += 0.5
endIf
setSpriteCamera( camera.x, camera.y, camera.z )
setSpriteCameraRotation( rotation )
updateSprites()
drawSprites()
update()
repeat
Associated Commands