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.py22
1 files changed, 14 insertions, 8 deletions
diff --git a/main.py b/main.py
index f5b2fcb..101b2de 100644
--- a/main.py
+++ b/main.py
@@ -3,6 +3,7 @@
import os
import sys
import time
+import random
import pygame
from pygame.locals import *
@@ -22,9 +23,9 @@ screen.blit(object_background, (0, 0))
speed = 9
# Garbage image
-#object_garbage = pygame.image.load('images/paper.png')
-#position_garbage = [ 400, 300 ]
-#screen.blit(object_garbage, position_garbage)
+object_garbage = pygame.image.load('images/paper.png')
+position_garbage = [ 400, 300 ]
+screen.blit(object_garbage, position_garbage)
# Robot image
object_robot = pygame.image.load('images/robot_1.png')
@@ -90,12 +91,17 @@ while not exit:
# draw the background first, because it will cover all the screen
screen.blit(object_background, (0,0))
# draw everything else over the background
+ # Robot
screen.blit(object_robot, (position_robot[0], position_robot[1]))
-
- # Move the character around the screen
- position_robot = [((position_robot[0] + x_direction * speed )%window_w), ((position_robot[1] + y_direction * speed )%window_h) ]
-
-
+ # Move the character around the screen
+ position_robot = [((position_robot[0] + x_direction * speed )%window_w), \
+ ((position_robot[1] + y_direction * speed )%window_h) ]
+
+ # Garbage
+ screen.blit(object_garbage, (position_garbage[0], position_garbage[1]))
+ position_garbage = [((position_garbage[0] + random.randint(0,10) )%window_w), \
+ ((position_garbage[1] + random.randint(0,10) )%window_h) ]
+# position_garbage = [(position_garbage[0] + 3 ), (position_garbage[1] + 3 ) ]
pygame.display.update()
pygame.quit()