Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/main.py
diff options
context:
space:
mode:
Diffstat (limited to 'main.py')
-rw-r--r--main.py16
1 files changed, 12 insertions, 4 deletions
diff --git a/main.py b/main.py
index 6e4c88b..036150e 100644
--- a/main.py
+++ b/main.py
@@ -22,7 +22,7 @@ unit = 1.0
score = 0
robot_speed = 9
-garbage_speed = 3
+garbage_speed = 1
person_speed = 4
@@ -88,7 +88,9 @@ while not exit:
if last_garbage_tick == 0:
last_garbage_tick = garbage_generation_ticks
for person in people:
- trash.append(Garbage( window_w, window_h, unit, garbage_speed, (person.position[0] - 20, person.position[1] - 20) ))
+ trash.append(Garbage( window_w, window_h, unit, garbage_speed, \
+ (person.position[0] - (person.image_rect.height/2), \
+ person.position[1] - (person.image_rect.width/2)) ))
else:
last_garbage_tick -= 1
@@ -110,15 +112,18 @@ while not exit:
people.remove(person)
for garbage in trash:
- if garbage.died():
+ if garbage.died_x() or garbage.died_y():
trash.remove(garbage)
- # update objects
+ # Persons
for person in people:
person.update()
+
+ # Garbage
for garbage in trash:
garbage.update()
+ # Robot
robot.update()
# draw the background first, because it will cover all the screen
@@ -131,8 +136,11 @@ while not exit:
# Persons
for person in people:
person.draw(screen)
+
+ #Garbage
for garbage in trash:
garbage.draw(screen)
+
#Robot
robot.draw(screen)