// this example should work with AGK V1 and V2
// use wasd or on screen joystick to move camera sideways and forward and back
// camera will always point at the centre of the map so it will look like the
// camera is circling the map
// make cubes and arrange in a grid pattern
i = 0
for z = 0 to 4
for x = 0 to 4
inc i
CreateObjectBox(i,20,20,20)
SetObjectPosition(i,(x-2)*40,10,(z-2)*40)
next x
next z
// create a directional light
CreateLightDirectional(1,-0.75,-1,0.5,0,255,255)
// set camera position
SetCameraPosition(1,0,30,-100)
// main loop
do
// get player input
joystick_x# = GetJoystickX()
joystick_y# = GetJoystickY()
// move camera sideways
MoveCameraLocalX(1,joystick_x#*2)
// move camera forward and back
MoveCameraLocalZ(1,joystick_y#*-2)
// make camera look at center of map
SetCameraLookAt(1,0,30,0,0)
sync()
loop
Help make AGK better by submitting an example for this command! (All examples are subject to approval)