// Project: FloatingObject
// Created: 2019-11-26
// show all errors
SetErrorMode(2)
// set window properties
SetWindowTitle( "FloatingObject" )
SetWindowSize( 1024, 768, 0 )
SetWindowAllowResize( 1 ) // allow the user to resize the window
// set display properties
SetVirtualResolution( 1024, 768 ) // doesn't have to match the window
SetOrientationAllowed( 1, 1, 1, 1 ) // allow both portrait and landscape on mobile devices
SetSyncRate( 0, 0 ) // 30fps instead of 60 to save battery
SetScissor( 0,0,0,0 ) // use the maximum available screen space, no black borders
UseNewDefaultFonts( 1 ) // since version 2.0.22 we can use nicer default fonts
SetShadowMappingMode(3)
Ground = CreateObjectPlane(15,15)
Arm = CreateObjectBox(2,2,2)
y# = 4.0
Speed# = 0.2
Amplitude# = 0.5
Global Tempo as Float
RotateObjectLocalX(Ground,90)
SetObjectColor(Ground,0,0,255,255)
SetObjectColor(Arm,255,0,0,150)
SetObjectTransparency(Arm,1)
SetObjectCastShadow(Arm,1)
do
Tempo = GetMilliseconds()
Offset#=BumpFunc(Speed#,Amplitude#)
SetObjectPosition(Arm,0.0,4.0+Offset#,0.0)
x#=cos(tempo*0.01)*15.0
z#=sin(tempo*0.01)*15.0
SetCameraPosition(1,x#,7.0,z#)
SetCameraLookAt(1,0,0,0,0)
Print( ScreenFPS() )
Sync()
loop
Function BumpFunc(Speed as Float, Ampli as Float)
It# = cos(Tempo*Speed)*Ampli
EndFunction It#