Skip to content
MPGHThe Dark Arts
/
RegisterLog in
Forum
Community
What's NewLatest posts across the boardTrendingHottest threads right nowSubscribedThreads you follow
Discussion
GeneralIntroductionsEntertainmentDebate FortFlaming & Rage
Board
News & AnnouncementsMPGH TimesSuggestions & HelpGiveaways
More Sections
Art & Graphic DesignProgrammingHackingCryptocurrency
Hacks & Cheats
Games
ValorantCS2 / CS:GOCall of Duty / WarzoneFortniteApex LegendsEscape From Tarkov
+14 moreLeague of LegendsGTA VMinecraftRustROTMGBattlefieldTroveBattleOnCombat ArmsCrossFireBlackshotRuneScapeDayZDead by Daylight
Resources
Game Hacking TutorialsReverse EngineeringGeneral Game HackingAnti-CheatConsole Game Hacking
Tools
Game Hacking ToolsTrainers & CheatsHack/Release NewsNew
Submit a release →Share your cheat, tool, or config with the community.
AINEW
AI Tools
General & DiscussionPrompt EngineeringLLM JailbreaksHotAI Agents & AutomationLocal / Open Models
AI × Gaming
AI Aimbots & VisionML Anti-CheatGame Bots & Automation
Create
AI Coding / Vibe CodingAI Art & MediaAI Voice & TTS
The AI frontier →Where game hacking meets modern machine learning. Jump in.
Marketplace
Buy & Sell
SellingBuyingTradingUser Services
Trust & Safety
Middleman LoungeMarketplace TalkVouch Copy Profiles
Money
Cryptocurrency TalkCurrency ExchangeWork & Job Offers
Start selling →List accounts, services, and goods. Use the middleman to trade safe.
MPGH The Dark Arts

A community for offensive security research, reverse engineering, and AI.

Community

ForumMarketplaceSearch

Account

RegisterLog in

Legal

Privacy PolicyForum RulesHelp & FAQ
© 2026 MPGH · All rights reserved.Built by the community, for the community. For educational purposes onlyContent is shared for security research and education — we don't condone illegal use. You're responsible for complying with applicable laws. Use at your own risk.
Home › Forum › Programming › Game Development › XNA Development › [TUT + Code] Game State

[TUT + Code] Game State

Posts 1–4 of 4 · Page 1 of 1
tuve2
tuve2
[TUT + Code] Game State
If your going to make a game menu and and all those things and with that I mean all menus in the game including the game screen that show up. Everything in the game that show up is a part of a screen. (Just the way I show this way to code this)

Add this code under the Game1 class:
Code:
private enum Screen
{
Menu, Lobby, Game
}
This is just a sample I did. And here are 3 different screens it is the Menu, Lobby and the Game.

Now lets add what screen that it shall start showing.
Code:
Screen mCurrentScreen = Screen.Menu;
Just add that code under the another one.

Now it will just show the starting screen and we cant do anything.
So lets add some controls to the game screens.

Go down to Update.
If you are going to make a computer game the add(if you haven't)
Code:
KeyboardState e = Keyboard.GetState();
if your going to make it for xbox I wont go through the stuff in this tutorial.

Now you have setup the basic on the controls. So lets set the controls.

Add this code under the last code we added:
Code:
switch (mCurrentScreen)
{
case Screen.Menu: {
if (e.IsKeyDown(Keys.Space) == true) {
mCurrentScreen = Screen.Lobby;
} break;
} case Screen.Lobby: {
break;
} case Screen.Game: {
break;
}
}
Now when you press space when you start the game you go to the Lobby screen. I think you can figure out the rest. Or just ask.

Now the last thing. Draw.

Go down to Draw.
and add the same code as in the update.
Code:
switch (mCurrentScreen)
{
case Screen.Menu: {
break;
} case Screen.Lobby: {
break;
} case Screen.Game: {
break;
}
}
And in those you past/write the code...

I will make a video tutorial on this when I got time. Ask for help if you need. And yes Google isn't that helpful, on this.

// Tuve2
#1 · edited 15y ago · 15y ago
'Bruno
'Bruno
Lmao.. This is poor.. seriously.

Is this a case tutorial? or..? you really didn't explain anything special.. and There is really good tutorials about GameState at XNACreators.. :\
#2 · 15y ago
tuve2
tuve2
Quote Originally Posted by Brinuz View Post
Lmao.. This is poor.. seriously.

Is this a case tutorial? or..? you really didn't explain anything special.. and There is really good tutorials about GameState at XNACreators.. :\
Well why don't you make any tutorials then?
#3 · 15y ago
'Bruno
'Bruno
Quote Originally Posted by tuve2 View Post
Well why don't you make any tutorials then?
Obvious reason is obvious..

So i won't get a bad comment like you did
#4 · 15y ago
Posts 1–4 of 4 · Page 1 of 1

Post a Reply

Similar Threads

  • TUT Oneline Games CodesBy [G]a[M]e[R] in C++/C Programming
    12Last post 15y ago
  • [Cross Fire Technical Tut] Best gaming Performance,internet,Lagging Fixes and more !By Harmony♫ in CrossFire Tutorials
    29Last post 15y ago
  • [Vid tut] Basic Game HackingBy Matrix_NEO006 in Programming Tutorials
    5Last post 16y ago
  • QR Code Game.By Fogest in General
    25Last post 15y ago
  • hi, can some1 make a cheat code or find a cheat code for me for this game i play onliBy CrUsHa in General Game Hacking
    37Last post 20y ago

Tags for this Thread

None