Enabling Cheats
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
Your question can't really be answered without knowing more about your game, api, platform.
theTroll
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
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
example for a cheat that lasts
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 elseif (Cheat2){ if (Player.Weapons[0].Ammo < Player.Weapons[0].FullAmmo) { Player.Weapons[0].Ammo = Player.Weapons[0].FullAmmo; }}
notice that
if (input = "cheatcode2")
should be
if (input == "cheatcode2")
Just incase you Copy/Paste Imgelling's code
if (input = "cheatcode2")
should be
if (input == "cheatcode2")
Just incase you Copy/Paste Imgelling's code
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement