Jump to content
  • Advertisement
Sign in to follow this  
YoungOne

Enabling Cheats

This topic is 3826 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Advertisement
First of all "cheat codes" are not really designed for cheating. So why are they there? For testing. It allows the testers to do things and get through the game easier.

Your question can't really be answered without knowing more about your game, api, platform.

theTroll

Share this post


Link to post
Share on other sites
Ok, well I am programming this game in XNA... and all i really want to enable through the cheats are extra outfits and more vehicles

Share this post


Link to post
Share on other sites
Just set a boolean variable to true when a cheat is activated, false when not. Then in the update loop, check the boolean, if true, do code to do the cheat.

example for a one time cheat

if (input == "cheatcode")
{
AddSuperDuperWeapon(Player);
input = "";
}





example for a cheat that lasts

if (input = "cheatcode2")
{
Cheat2 = true;
}
// And possibly somewhere else
if (Cheat2)
{
if (Player.Weapons[0].Ammo < Player.Weapons[0].FullAmmo)
{
Player.Weapons[0].Ammo = Player.Weapons[0].FullAmmo;
}
}



Share this post


Link to post
Share on other sites
notice that

if (input = "cheatcode2")

should be

if (input == "cheatcode2")

Just incase you Copy/Paste Imgelling's code

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!