// this example should work with AGK V1 and V2
// use wasd keys or on screen joystick to move the camera
// camera will forward, backward, left and right parallel to the boxes
// 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*40,10,z*40)
next x
next z
// create a directional light
CreateLightDirectional(1,-1,-1,0.5,255,255,255)
// set variables for camera's starting position
pos_x# = 0
pos_y# = 100
pos_z# = -100
// orientate camera
SetCameraRotation(1,30,0,0)
// main loop
do
// player input
joystick_x# = GetJoystickX()
joystick_y# = GetJoystickY()
// move camera
pos_x# = pos_x# + joystick_x#*2
pos_z# = pos_z# - joystick_y#*2
// position camera
SetCameraPosition(1,pos_x#,pos_y#,pos_z#)
sync()
loop
Help make AGK better by submitting an example for this command! (All examples are subject to approval)