Skip to content
Open
Changes from 1 commit
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
b70ae97
location. py is the function indicating the site of pathogen, and imp…
Subeen-Kim Oct 19, 2017
c40af24
Version 1 Skeleton UI
jwen2 Oct 22, 2017
086c735
Added Click Interaction
jwen2 Oct 23, 2017
104e084
Virus Draft - RAW
victorbianchi Oct 23, 2017
2cc94cd
Merge branch 'master' of https://github.com/jwen2/InteractiveProgramming
victorbianchi Oct 23, 2017
d61d10c
Merge branch 'master' of https://github.com/jwen2/InteractiveProgramming
Subeen-Kim Oct 23, 2017
b2a41e0
1st trial about time and input handling
Subeen-Kim Oct 23, 2017
a913dc0
Added Time and Pause Botton on Bottom Right
jwen2 Oct 23, 2017
8486919
Merge branch 'master' of https://github.com/jwen2/InteractiveProgramming
jwen2 Oct 23, 2017
bbf1fd4
Country Population Database
victorbianchi Oct 25, 2017
b80dbf4
Merge branch 'master' of https://github.com/jwen2/InteractiveProgramming
victorbianchi Oct 25, 2017
262f5c1
Attempting to Add Circle Interaction
jwen2 Oct 26, 2017
7fdce31
Merge branch 'master' of https://github.com/jwen2/InteractiveProgramming
jwen2 Oct 26, 2017
4273f42
UI Screen Change Test - Press C to Change Screens/Run Functions
jwen2 Oct 26, 2017
558de66
Useful File
jwen2 Oct 27, 2017
20379d8
new virus format with gorgeous time stuff
Subeen-Kim Oct 27, 2017
db39c83
propagation and death types are added
Subeen-Kim Oct 27, 2017
d73f897
Added display for total infected/total pop. Fixed Initial Infection
jwen2 Oct 29, 2017
95155e0
Added title screen and instructions
jwen2 Oct 29, 2017
16cbf96
modification about death stops at 5
Subeen-Kim Oct 29, 2017
a11db98
Added rounds function
vtbianchi Oct 29, 2017
741f559
Merge branch 'master' of https://github.com/jwen2/InteractiveProgramming
vtbianchi Oct 29, 2017
d8be63f
now it stops at zero
Subeen-Kim Oct 29, 2017
7e115a0
Upgrade points is updated
Subeen-Kim Oct 29, 2017
f49c50c
Merge branch 'master' of https://github.com/jwen2/InteractiveProgramming
Subeen-Kim Oct 29, 2017
0a42179
Added End Game Screen
jwen2 Oct 29, 2017
6fd3c15
Added upgrade possibility
vtbianchi Oct 29, 2017
1fae333
I modified Upgrade_Point into linear function
Subeen-Kim Oct 30, 2017
4e5d19a
death rate modified
Subeen-Kim Oct 30, 2017
6b59ba4
ReadMe File
vtbianchi Oct 30, 2017
d5c9fd7
Read Me File
vtbianchi Oct 30, 2017
1d851ea
Added upgrades
vtbianchi Oct 30, 2017
6086d69
Added Upgrade Points Box, Slow'd down points gain, Fixed upgrade cost
jwen2 Oct 30, 2017
ef209e0
documentation is improved
Subeen-Kim Oct 30, 2017
a2e05c5
Wirte-up and Reflection file
Subeen-Kim Oct 30, 2017
3cb86bd
Reflection
vtbianchi Oct 30, 2017
b2326b7
Added doctor and cure funtionality, Fixed death bug (stuck at 15), ad…
jwen2 Dec 9, 2017
9a12fb2
Merge branch 'master' of https://github.com/jwen2/InteractiveProgramming
jwen2 Dec 9, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
new virus format with gorgeous time stuff
  • Loading branch information
Subeen-Kim committed Oct 27, 2017
commit 20379d8d6c31d014fcae835e0e4967159659294d
37 changes: 24 additions & 13 deletions Country.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,21 @@

pygame.init()


class Ball:
def __init__(self, x, y, radius=50, color=RED, infected_pop=0):
class Country:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This class could be put into its own file and imported.

def __init__(self, x, y, max_pop, radius=50, color=RED, infected_pop=0, infected_rate=1.1):
self.initial_pos = (x, y)
self.x = x
self.y = y
self.color = color
self.radius = radius
self.infected_pop = infected_pop
self.infected_rate = infected_rate
self.max_pop = max_pop

#def step
def step(self):
if self.infected_pop <= self.max_pop:
self.infected_pop = self.infected_pop * self.infected_rate
print(self.infected_pop)

def draw(self):
pygame.draw.circle(screen, self.color, (int(self.x), int(self.y)),
Expand All @@ -33,25 +37,32 @@ def contains_pt(self, pt):

screen = pygame.display.set_mode((640, 480))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All of this setup code could go into a setup() function.


ball1 = Ball(320, 240, radius=80)
country1 = Country(320, 240, 200, radius=80)

countries = [country1]

balls = [ball1]
Time = 0
clock = pygame.time.Clock()

running = True
while running: # forever -- until user clicks in close box
for event in pygame.event.get():
if event.type == pygame.MOUSEBUTTONDOWN:
for ball in balls:
if ball.contains_pt(pygame.mouse.get_pos()):
if ball.infected_pop == 0:
ball.infected_pop = ball.infected_pop + 1
print(ball.infected_pop)
for country in countries:
if country.contains_pt(pygame.mouse.get_pos()):
if country.infected_pop == 0:
country.infected_pop = country.infected_pop + 1
print(country.infected_pop)
if pygame.time.get_ticks() > (Time + 1000):
Time = pygame.time.get_ticks()
country.step()
if event.type == pygame.QUIT:
running = False

screen.fill(BLACK) # erases screen
for ball in balls:
ball.draw()
for country in countries:
country.draw()

pygame.display.update() # updates real screen from staged screen

pygame.quit()