(AGK version: 108.24)
Submitted: 2014-12-19 18:41:16
// note: this demo should work in AGk V1 and V2

// make a yellow sphere for the sun (will automatically be place at 0,0,0)
CreateObjectSphere(1,40,25,24)
SetObjectColor(1,255,255,0,255)

// make a green sphere for the planet
CreateObjectSphere(2,20,16,16)
SetObjectColor(2,0,255,0,255)

// make a grey sphere for the moon
CreateObjectSphere(3,10,16,16)
SetObjectColor(3,100,100,100,255)

// create a directional light
CreateLightDirectional(1,-1,-1,1,255,255,255)

// position the camera and orientate it
SetCameraPosition(1,0,150,-250)
SetCameraLookAt(1,0,0,0,0)

do

		// to make the planet orbit the sun
		// positioned it on the sun
		// rotate it
		// then move it along its local z axis
		SetObjectPosition(2,GetObjectX(1),GetObjectY(1),GetObjectZ(1))
		RotateObjectGlobalY(2,1)
		MoveObjectLocalZ(2,100)

		// to make the moon orbit the planet
		// positioned it on the planet
		// rotate it
		// then move it along its local z axis
		SetObjectPosition(3,GetObjectX(2),GetObjectY(2),GetObjectZ(2))
		RotateObjectGlobalY(3,5)
		MoveObjectLocalZ(3,20)



        sync()

loop


Help make AGK better by submitting an example for this command!
(All examples are subject to approval)
Login to post an example of your own.