Skip to content

Commit 1d851ea

Browse files
committed
Added upgrades
1 parent d5c9fd7 commit 1d851ea

1 file changed

Lines changed: 11 additions & 11 deletions

File tree

‎Country.py‎

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414
class Country:
1515
"""
1616
Each country has its maximum population without any infected people,
17-
before we do click the country in the beginning of game.
17+
before we click the country in the beginning of the game.
1818
"""
19-
def __init__(self, x, y, max_pop, radius=50, color=RED, infected_pop=0, infected_rate=1.1, dead_pop=0, death_rate=1):
19+
def __init__(self, x, y, max_pop, radius=50, color=RED, infected_pop=0, infected_rate=1.1, dead_pop=0, death_rate=1, airborne_rate=0):
2020
self.initial_pos = (x, y)
2121
self.x = x
2222
self.y = y
@@ -27,15 +27,17 @@ def __init__(self, x, y, max_pop, radius=50, color=RED, infected_pop=0, infected
2727
self.max_pop = max_pop
2828
self.dead_pop = dead_pop
2929
self.death_rate = death_rate
30+
self.airborne_rate = airborne_rate
3031

3132
def infected_ratio(self):
3233
if self.max_pop != 0:
3334
return int(self.infected_pop) / self.max_pop
3435
else:
3536
return 1
37+
3638
def death(self):
3739
"""
38-
A part of infected population would be passed away.
40+
A part of the infected population would be passed away.
3941
Then the infected population and maximum population will be reduced as many as the number of people death.
4042
"""
4143
death_pop = 0
@@ -143,9 +145,6 @@ def propagation(self, other):
143145
clock = pygame.time.Clock()
144146

145147
upgrades = 0
146-
rate = 1.0
147-
abilities = 1.0
148-
symptoms = 1.0
149148

150149
running = True
151150
while running: # forever -- until user clicks in close box
@@ -160,24 +159,25 @@ def propagation(self, other):
160159
"""now our pathogen embarks on infection!"""
161160

162161
if event.type == pygame.KEYDOWN:
163-
#If upgrade infection rate
162+
#Upgrade infection rate
164163
if event.key == pygame.K_t:
165164
upgrades = upgrades + 1
166165
for country in countries:
167166
country.infected_rate = country.infected_rate * 1.15
168167
print (country.infected_rate)
169-
#if upgrade death_rate
168+
169+
#increase death rate
170170
if event.key == pygame.K_s:
171171
upgrades = upgrades + 1
172172
for country in countries:
173173
country.death_rate = country.death_rate * 1.15
174174
print (country.death_rate)
175-
symptoms += 0.15
175+
#increase airborne capacity
176176
if event.key == pygame.K_a:
177177
upgrades = upgrades + 1
178178
for country in countries:
179-
country.infected_rate = country.infected_rate * 1.15
180-
print (country.infected_rate)
179+
country.airborne_rate = country.airborne_rate + 0.15
180+
print (country.airborne_rate)
181181

182182
"""Modify Time + XXXX to modify the speed of the game."""
183183
if pygame.time.get_ticks() > (Time + 100):

0 commit comments

Comments
 (0)