# [Tutor] Umm.. I need help on changing Global Variables.

Tallen Grey Smith tallengs at gmail.com
Thu Jan 29 18:16:37 CET 2015

```So, I’m trying to make a very simple game that involves time management properly, but I’m having an issue.

level = 1
player_health = 100
enemy_health = 100
steps = 10
civilians = 20
charge = 0
name_2 = 'Bob'

def game():

global level
global player_health
global enemy_health
global steps
global civilians
global charge

print "\n" * 80
print "Level " + str(level)
print  name_2 +": " + str(player_health) +" HP"
print "Centurion: " + str(enemy_health) + " HP"
print "Distance: " + str(steps) + " feet"
print "Weapon Charge: " + str(charge)
print "Civilians Remaining: " + str(civilians)
print "A Centurion lands near the gate! Prepare the Laser!"
action_1 = raw_input("Do you want to charge the laser or fire?")
action_2 = action_1.lower()

if action_2 == "charge":
charge == charge+10
steps == steps-1
civilians == civilians -1
charge_1()

def charge_1():

level
player_health
enemy_health
steps
civilians
charge
print "\n" * 80
print "Level " + str(level)
print  name_2 +": " + str(player_health) +" HP"
print "Centurion: " + str(enemy_health) + " HP"
print "Distance: " + str(steps) + " feet"
print "Weapon Charge: " + str(charge)
print "Civilians Remaining: " + str(civilians)
print "The Centurion moves closer! Hurry!"
action_1 = raw_input("Do you want to charge the laser or fire?")
action_2 = action_1.lower()

if action_2 == "charge":
charge = charge+10
steps = steps-1
civilians = civilians -1
charge_1()

game()

thats my code, and I want it to where if I type charge it’ll make my charge go up 10, my steps go down 1, my divs going down 1, and it to go to my charge_1 function, which should do the same thing but with a tweaked dialog box. But no matter how hard i try, once it gets to the charge_1, it always says that the variables that I changed where referenced in previous functions and it can’t pull them. How can I change this to get a variable that when changed in my If statement, would be useable in other functions?
Thanks.
```