(AGK version: 108.24)
Submitted: 2014-12-17 14:45:35
// this example should work with AGK V1 and V2

// use the wasd keys or the on screen joystick to make the box move

// make a box, colour it green and position it (so it appears on the floor, that be created next)
CreateObjectBox(1,5,5,15)
SetObjectColor(1,0,255,0,255)
SetObjectPosition(1,0,2.5,0)

// make a floor using a plane
CreateObjectPlane(2,100,100)
SetObjectRotation(2,90,0,0)

// create a directional light (to make the scene look better)
CreateLightDirectional(1,-1,-1,-0.5,255,255,255)

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

// main loop
do

	// get player input
	joystick_x# = GetJoystickX()
	joystick_y# = GetJoystickY()

	// rotate the box
	RotateObjectGlobalY(1,0.5)

	// move object along its local x and local z axis based on the player input
	MoveObjectLocalX(1,joystick_x#*0.5)
	MoveObjectLocalZ(1,joystick_y#*-0.5)


	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.