// this example should work with AGK V1 and AGK V2
// press the spacebar or on screen button to randomly place the cubes
// make a bunch of boxes and color them randomly (they will all initial be position at 0,0,0)
for i = 1 to 9
CreateObjectBox(i,10,10,10)
SetObjectColor(i,random(100,255),random(100,255),150,255)
next i
// make a plain, rotate and position it to act as a floor
CreateObjectPlane(99,100,100)
SetObjectRotation(99,90,0,0)
SetObjectPosition(99,50,0,50)
// create a directional light
CreateLightDirectional(1,1,-1,0.5,255,255,255)
// position and orientate the camera (camera looks at the center of the floor)
SetCameraPosition(1,50,100,-150)
SetCameraLookAt(1,50,0,50,0)
// main loop
do
// press spacebar or on screen button to position boxes randomly
if GetButtonPressed(1) = 1
for i = 1 to 9
SetObjectPosition(i,random(5,95),5,random(5,95))
next i
endif
sync()
loop
Help make AGK better by submitting an example for this command! (All examples are subject to approval)