// Project: Sky Box Example
// Created: 18-05-19
//
// show all errors
// Useful Colour Picker : https://www.w3schools.com/colors/colors_picker.asp
SetErrorMode(2)
screenWidth As Float
screenHeight As Float
screenAspect As Float
screenWidth = GetDeviceWidth()
screenHeight = GetDeviceHeight()
// set window properties
SetWindowTitle("Sky Box Example")
SetOrientationAllowed(0, 0, 1, 1) // allow both portrait and landscape on mobile devices
SetWindowSize(screenWidth, screenHeight, 0, 0)
SetWindowAllowResize(1) // allow the user to resize the window
// set display properties
SetVirtualResolution(screenWidth, screenHeight) // doesn't have to match the window
SetSyncRate(25, 0) // 30fps instead of 60 to save battery
SetScissor(0, 0, 0, 0) // use the maximum available screen space, no black borders
//UseNewDefaultFonts(1)
// Set the Sky's colour using Red/Green/Blue colour components
SetSkyBoxSkyColor(77,121,255)
// Set the horizontal colour size
SetSkyBoxHorizonSize(1,0)
// Set the Horizon and ground colour using Red/Green/Blue colour components
SetSkyBoxHorizonColor(0,128,0)
// Switch the Skybox visibility on
SetSkyBoxVisible(1)
CreateObjectBox(1, 1, 1, 1)
SetObjectColor(1, 255, 0, 0, 0)
SetCameraPosition(1, 0, 0, -3)
SetCameraLookAt(1, 0, 0, 0, 0)
camX As Float
camY As Float
camZ As Float
dist As Float = 2.5
angle As Float = 180
do
// Calculate the rotation position of the camera
camX = Sin(angle) * dist // Create a circular distance along the X axis
camY = Sin(angle*3)*2 // Create a wavey motion along the Y axis
camZ = Cos(angle) * dist // Create a circular distance along the Z axis
SetCameraPosition(1, camX, camY, camZ)
SetCameraLookAt(1, 0, 0, 0, 0)
angle = angle + 1
Sync()
loop
Help make AGK better by submitting an example for this command! (All examples are subject to approval)