Goto function is the only function which can do this?

K.I.L.E.R

Retarded moron
Veteran
In the prototype of my game I'm making I am also making a frontend to change a line of code directly here and there.

For example: In the marked part of my code is a line which ends god mode right after you win the battle however I if I remove the line god mode will continue to be enabled after the fight and will only be disabled after 4 'god' rounds.

IE:
In the wilderness: player drinks God potion.
Player gets in a fight.

god round = 0.

Round 1: pcAttack, npcAttack, god mode round++, battleRound++.

Monster dies and gode mode is still on as god round is only 1.

Player is in wilderness again.
Player gets into another fight.

Round 1: pcAttack, god mode round++, battleRound++.
Round 2: pcAttack, god mode round++, battleRound++.
Round 3: pcAttack, god mode round++, battleRound++.

Player wins and god round is set to 4. Godmode gets taken off and god round is reset to 0.

See what I mean?

The frontend will give a person the choice to leave it like that or turn off god mode after the end of battle.

The only way I know how to change 1 line fo code is by using the goto function and then change the line it went through and then terminateing the goto function.

Anyone have any better way of doing this?


Code:
				  else if(RPG.player.maxHP > 0 && RPG.enemyBase.maxHP <= 0)
					{
						txtArea_Events.setText("You've won!");
						btn_Attack.setEnabled(false);
						btn_Defend.setEnabled(false);
						btn_Continue.setEnabled(true);
						
						RPG.player.godMode = false; //////////////////////I WANT TO CHANGE THIS
						fight = false;
					}
 
Why not use a counter for godRounds, decrement it through each round of combat, have the debug-console-god-mode be set in a different variable (input sets globalGodMode), and then have the line in question be something akin to Rpg.player.setGodMode((godRounds > 0) || globalGodMode); ?
 
Back
Top