really I'm confused.
this is my game menu exit code:
function GameMenu()
do
//Exit the Game
if Selectbtn = 5
if TX# <= 1.0 then TX# = TX# + 0.05
if TX# >= 0.5 and TX# < 1.0
TX# = 0
exit
endif
endif
sync()
loop
EndFunction
but I don't know why run main.agc.
It occurs when I change exit to exitfunction in Functions.agc.
I think Problem is relate to below function. I change exit command to exitfunction but won't work it. but when I comment below function, exit button work correctly. seem when this function is running, can't exit the function and when I click on exit button, it load main.agc. so how we can exit from this function?
Function CreateNextRound()
if (Player.win < 2 and Enemy.win < 2) or (Player.die = 1 and Enemy.die = 1)
if NextRoundTimer# <= 4 then NextRoundTimer# = NextRoundTimer# + fps#
if NextRoundTimer# > 3 and NextRoundTimer# < 4
//CreateLoading()
//if GetSpriteExists(LoadingSpr) = 1 then SetSpriteVisible(LoadingSpr,1) //Show LoadingSpr
if GetSpriteExists(BlackSpr) = 1 then SetSpriteVisible(BlackSpr,1) //Show BlackSpr
for i = 1 to 8
if GetVirtualButtonExists(i) = 1
SetVirtualButtonVisible(i,0)
endif
next i
endif
if NextRoundTimer# >= 4 //and (Player.state = 22 or Enemy.state = 24) or (Player.die = 1 and Enemy.die = 1)
//DeletePlayerHealthBar()
if GetSpriteExists(P_HealthBarSpr) = 1 then SetSpriteScale(P_HealthBarSpr,2.6,0.25)
//DeletePlayerEnergy()
if GetSpriteExists(P_EnergyBarSpr) = 1 then SetSpriteScale(P_EnergyBarSpr,1.61,0.16)
DeletePlayer()
DeleteEnemy()
DeleteEnemyHealthBar()
DeleteEnemyEnergy()
DeleteWinLoss()
DeletePlayerBullet()
DeleteEnemyBullet()
DeleteVictoryEnergy()
Player.state = 0
Player.Health = 10
Player.Energy = 100
//Player.die = 0
Player.damage = 0
Player.MoveLeft = 0
Player.MoveRight = 0
Player.fire = 0
Player.dash = 0
Player.Trowing = 0
Player.GetUpTimer = 0
Player.DashTimer = 0
Player.knife = 0
Player.falling = 0
PCreateBullet = 0
Pxspeed# = 0.3
Pyspeed# = 0.0
Pyvelocity# = 83.5
dim P_ActionTimer#[5]
dim P_StartTimer[5]
dim PAttack[4]
P_BulletNumber = 0
PDashTimer# = 0.0
PDash = 0
PIsGround = 0
playvoice = 0
Pwin = 0
Enemy.state = 0
Enemy.Health = 10
Enemy.Energy = 100
//Enemy.die = 0
Enemy.damage = 0
Enemy.MoveLeft = 0
Enemy.MoveRight = 0
Enemy.fire = 0
Enemy.dash = 0
Enemy.Trowing = 0
Enemy.GetUpTimer = 0
Enemy.DashTimer = 0
Enemy.knife = 0
Enemy.falling = 0
ECreateBullet = 0
Enemy.run = 0
Enemy.hit = 0
Exspeed# = 0.3
Eyspeed# = 0.0
Eyvelocity# = 83.5
dim E_ActionTimer#[5]
dim E_StartTimer[5]
dim EAttack[4]
E_BulletNumber = 0
EDashTimer# = 0.0
EDash = 0
EIsGround = 0
grav# = 0.09
collide = 0
LastRand = 0
LastRand2 = 0
BeginFight# = 0.0
BeginFight2# = 0.0
BSlideTimer# = 0.0
BRollingTimer# = 0.0
BulletDist = 0
Bwin = 0
Rand2 = 0
Rand3 = 0
Rand4 = 0
Rand5 = 0
Dist = 0
Time# = 59.0
fps# = 0.0
Rand = 0
fight = 0
rnd = 0
Rand2 = 0
shaking = 0
G_Timer# = 10.0
Tap = 0
SikhTime# = 0.0
SensorCollide = 0
Difficult# = LastDifficult#
if GetTextExists(TimeText) = 1 then SetTextString(TimeText,str(Round(Time#))) //Update TimeText value
NextRoundTimer# = 0.0
CheckDieTimer# = 0.0
Game()
exitfunction
endif
endif
EndFunction
anyone have any suggestion ?