the begin function can be a loop with select case.
it starts with a default value to jump in menu or game.
example without menü
//-------------------------------------- Screen
SetDisplayAspect(1.0 / 1.0)
setvirtualresolution(100,100) // wichtig auch wegen Physik 100x100
SetResolutionMode( 1 )
SetSyncRate( 60, 0 ) //Tablet schaft 40-50 FPS
SetOrientationAllowed( 0,0,1,0 ) //sonst dreht sich das im Spiel^^ am Gerät kann man das ja sperren/dreht aber immer noch
SetViewZoomMode( 1 ) //1= centered
//SetViewZoom( 1.5 )
SetClearColor(128,128,128)
EnableClearColor( 0 ) //hab ja hintergrund
SetBorderColor( 0, 0, 0 )
SetGenerateMipmaps( 1 )
SetPrintColor( 255, 255, 255, 192 )
SetPrintSize( 4 )
SetSortTextures(1)
imgFont=loadimage("font.png")
SetTextDefaultFontImage(imgFont)
//SetTextDefaultExtendedFontImage
//-------------------------------------- Physik
//SetPhysicsDebugOn()
SetPhysicsGravity( 0, 0 ) //wir gucken ja von oben drauf
SetPhysicsCCD( 1 ) //Turns Continuous Collision Detection on and off.
SetPhysicsWallLeft(1)
SetPhysicsWallRight(1)
SetPhysicsWallTop(1)
SetPhysicsWallBottom(1)
//-------------------------------------- Loch
Type THole
spr
force
endtype
//-------------------------------------- Start
Type TStart
spr=0
endtype
//-------------------------------------- Goal
Type TGoal
spr=0
endtype
//-------------------------------------- Way
Type TWayPoint
spr=0
activated=0
endtype
//-------------------------------------- Block / Pin / Wall
Type TBlock
spr=0
endtype
//-------------------------------------- Ball
type TBall
spr=0
energie#=999
size
volume
stop
endtype
#constant CollBall 1
#constant CollHole 2
#constant CollStart 3
#constant CollGoal 4
#constant CollWay 5
//-------------------------------------- Level
type TLevel
sndWay
sndApplause
sndBande
sndRoll
sndStart
sndLost
imgball
imgbg
imgbgway
imgexit
imge
imghole
imgwall
imgblock
imgpin
imgway
imgstartpoint
imgstart
imggoalpoint
imggoal
imglost
imgpause
sprbg
sprbgway
spre
btnpause
btnende
iCondition
color
style
collibande
lost
atgoal
waypointsactivated
pause
Ball as TBall
Start as TStart
Goal as TGoal
holes
waypoints
blocks //zumindest beim erzeugen muß ich wissen was ich da geladen hab
pins
walls
endtype
global Level as TLevel
global dim Level_Hole[99] as THole //25
global dim Level_WayPoint[99] as TWayPoint
global dim Level_Block[99] as TBlock
global dim Level_Pin[99] as TBlock
global dim Level_Wall[99] as TBlock
//-------------------------------------- Includes / kommen hinter Main
#include "color.agc"
#include "waypoint.agc"
#include "way.agc"
#include "ball.agc"
#include "wall.agc"
#include "holes.agc"
#include "start.agc"
#include "goal.agc"
#include "level.agc"
#include "game.agc"
//-------------------------------------- Main
MainLoop()
end
//--------------------------------------
function MainLoop()
GameLoop()
endfunction
old source from blitzbasic
Function MainLoop()
Local Ende=0
Repeat
If FrontEnd()=True Then
MakePuzzles() <-Prepare
ShowPuzzles() <-Splash Screen
If PlayGame()=0 Then Ende=True
Else
Ende=True
EndIf
Until Ende=True
End Function
-----------------------------
Function MainLoop()
;MR 30.06.2004
Local ende=False
HidePointer
SkyCreate()
;---------------------------------------------------------------
Local Menuepunkt = 1
Repeat
Menuepunkt=MainMenu(Menuepunkt)
Select Menuepunkt
Case 1:PlaySound sndSwitch:If Play()=0 Then ende=True Else Menuepunkt=2:PlaySound sndSwitch
Case 2:ende=True
Case 3:PlaySound sndSwitch:If FreeLook()=0 Then ende=True Else Menuepunkt=1:PlaySound sndSwitch
Case 4:PlaySound sndSwitch:If Pathfinding()=0 Then ende=True Else Menuepunkt=1:PlaySound sndSwitch
Case 5:PlaySound sndSwitch:If TerrainEdit()=0 Then ende=True Else Menuepunkt=1:PlaySound sndSwitch
End Select
Until ende=True
;---------------------------------------------------------------
SkyFreeAll()
FadeFreeAll()
;---------------------------------------------------------------
ShowPointer
End Function