Sign in to follow this  

Enabling Cheats

This topic is 3460 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

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
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

This topic is 3460 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this