New games every week!
JSE - GameHandler Blog
20th June 2021
I finally did that mini writeup of the GameHandler function, today.

-=-=-

I've been putting it off for a while, as I kept adding in little nips and tucks, but today I've decided that enough's enough, and just finished the whole thing off.

GameHandler("Game Title","Easy|Normal|Hard")
is more or less enough to get the menu going.
From there, add an .Ingame subroutine, and be sure to return each frame, whilst keeping your game ticking away. Keep track of a Score variable, and it'll pop up on the highscore table.
The EndGame command does just that, and returns the player back to the menu, adding the latest score to the scoreboard, saving the current high scores, and so on.

// GameHandler Example // Mouse Clicker Symbol 0,"0__4?0,4.0.4.0.4?0,4004,0!4,0!4,0!44"; Graphics 512,512,1 SetHandlerFont "Labyrinth" GameHandler("Mouse|Clicker|2000","5 seconds|10 seconds|15 seconds") .StartGame Score=0 // Change the time limit based on the menu option selected. If GameType==1 then TimeLimit=Mills(1)+(5*1000)+999 If GameType==2 then TimeLimit=Mills(1)+(10*1000)+999 If GameType==3 then TimeLimit=Mills(1)+(15*1000)+999 Return .Ingame CLS;ResetDraw() TimeLeft=Floor((TimeLimit-Mills(1))/1000) If TimeLeft<0 then TimeLeft=0 If GameOver==0 then PlaySFX("Beeper_Fruit_Win") EndGame "Time's Up" Endif Text ScreenWidth/2,ScreenHeight/2-64,TimeLeft,1 // A Click If MouseHit() and GameOver==0 // GameOver increases once EndGame has been called Score=Score+1 // Score is used by the Highscore system PlaySFX("Beeper_Coin") ThrowParticle MouseX,MouseY,2,Rand(-45,45),Rand(2,5) Endif TextScore ScreenWidth/2,ScreenHeight/2 Text ScreenWidth-16,16,"Score to beat "+Highscore,2 // Highscore is the topmost score on the current leaderboard Flip Return


The Mouse Clicker 2000 example should help you figure the rest out..
.. Maybe!?!
There's more info in The Help Files

Meanwhile..



A few extra new commands have been added.
GetRed(), GetGreen(), GetBlue() and GetAlpha() return the currently set colour values.

TextScore x,y displays the value of the variable Score onscreen, centred at x,y, using the current colour/size/etc settings.
Views 128, Upvotes 22  
Jse , Commands
New games every week!
Site credits : This was all done by Jayenkai
(c) Jayenkai 2023 and onwards, RSS feed 83

Blog - JSE - GameHandler - AGameAWeek