endIf
Purpose
Marks the end of a condtional code block
Description
This ends the conditional if statement and returns to unconditional execution
Syntax
if condition then ... else ... endIf // if condition is met execute first ... otherwise execute second ...
Arguments
condition condition to be tested. This can be a compound condition using AND and OR
Example
gsize = 64
landscape = createterrain( gsize, 1 )
height = 0
colour = white
for x = 0 to gsize loop
for y = 0 to gsize loop
d = distance( { x, y }, { gsize / 2, gsize / 2 } )
if d > 24 then // sea level
height = 0
colour = blue
else
if d > 18 then // beach
height = 1
colour = yellow
else // hills
height = rnd( 2 ) + 1
colour = green
endIf
endIf
setTerrainPoint( landscape, x, y, height, colour )
repeat
repeat
setCamera( { gsize / 2, 50, gsize / 2 }, { gsize / 2, 0, gsize / 2 - 1 } )
setAmbientlight( { 0.5, 0.5, 0.5 } )
island = placeObject( landscape, { gsize / 2, 0, gsize / 2 }, { 1, 1, 1 } )
loop
c = controls( 0 ) // rotate using joysticks
rotateObject( island, { 1, 0, 0 }, c.ly )
rotateObject( island, { 0, 0, 1 }, c.lx )
rotateObject( island, { 0, 1, 0 }, c.rx )
drawObjects()
update()
repeat
Associated Commands