(AGK version: 108.24)
Submitted: 2014-12-15 07:52:13
// this example should work with both AGK V1 and V2

// use the wasd key or on screen joystick to change the scale of the box

// create a box (automaticall placed at 0,0,0)
CreateObjectBox(1,10,10,10)

// create a directional light (this makes the box look nicer, remark it out and see what happens if you don't believe me)
CreateLightDirectional(1,1,-1,0,255,255,255)

// position and orientate the camera so it looks at the box
SetCameraPosition(1,-200,300,-200)
SetCameraLookAt(1,0,0,0,0)

// set some intial values for the scale of the box
scale_x# = 1.0
scale_y# = 1.0

// main loop
do

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

	// calculate scale based on player input
	scale_x# = scale_x# + joystick_x#
	scale_y# = scale_y# - joystick_y#

	// stop scale from going below 0 (if the scale becomes negative it'll turn the object in-side-out)
	if scale_x# < 0.0
		scale_x# = 0.0
	endif
	if scale_y# < 0.0
		scale_y# = 0.0
	endif

	// scale the object
	SetObjectScale(1,scale_x#,scale_y#,1.0)

	// print the scale values to the screen
	print(scale_x#)
	print(scale_y#)

	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.