This is a hat from my game that I am currently making.
// Project: RolePlayingTacticalShooter
// Created: 2021-11-26
// show all errors
SetErrorMode(2)
// set window properties
SetWindowTitle( "RolePlayingTacticalShooter" )
global Height
global Width
Height=GetMAXDeviceHeight()
Width=GetMAXDeviceWidth()
SetWindowSize( Width, Height, 1)
SetWindowAllowResize( 1 ) // allow the user to resize the window
// set display properties
SetVirtualResolution( Width, Height ) // doesn't have to match the window
SetOrientationAllowed( 1, 1, 1, 1 ) // allow both portrait and landscape on mobile devices
SetSyncRate( 30, 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
Global cursor
cursor=LoadSprite( "cursor.png" )
SetSpritePosition( cursor, 0, 0 )
#include "Menu.agc"
#include "LoadMAP.agc"
#include "FPSControl.agc"
LoadMenu()
LoadMAP()
LoadSoldiers()
SetTextVisible( TextReturnButton, 0 )
for t=1 to 5
PlayObjectAnimation( qwer[t], "", 239, 261, 1, 0 ) ` move
PlayObjectAnimation( qwer[t], "", 990, 990, 1, 0 ) ` move with weapon
SetObjectAnimationSpeed( qwer[t], 20 )
next t
_Main_menu:
SetSpriteVisible ( BackDropMenu, 1 )
SetSpriteVisible ( StartButton, 1 )
SetSpriteVisible ( QuitButton, 1 )
SetTextVisible( TextQuitButton, 1 )
do
SetSpritePosition( cursor, GetPointerX(), GetPointerY() )
PrintMenu()
printButton()
if StartGame=2 then goto _Game_Loop:
Print( ScreenFPS() )
Print( Height )
Print( Width )
print ( ColorBackDrop )
print ( PlusMinusBackDrop )
print (StartGame)
print (GetSpriteCollision( cursor, StartButton ))
print(GetRawLastKey( ))
if GetRawKeyState(27) then ExitCurrentGame()
Sync()
loop
_Game_Loop:
SetSpriteAngle( StartButton, -180)
SetSpriteVisible ( BackDropMenu, 0 )
SetSpriteVisible ( StartButton, 0 )
SetSpriteVisible ( QuitButton, 0 )
SetTextVisible( TextQuitButton, 0 )
SetTextVisible( TextStartButton, 0 )
SetTextVisible( TextReturnButton, 0 )
`SetObjectVisible( qwer1, 0 )
Do
FPS()
FPS_Soldiers()
FPSControl()
rem Update screen
if GetRawKeyState(27) then ReturnToMenu()
if StartGame=0 then goto _Main_menu:
print(GetObjectAnimationTime (11))
loop
And after long torment of searching for errors, I switched to this form.
Separate cycle menu
The game is a separate cycle.
programming is a hobby, not a job.