Commits

illume committed 57acef2

Added a basic duck.

  • Participants
  • Parent commits 7c9ab28

Comments (0)

Files changed (4)

 TODO
 ====
 
+
+* duck flying across
+* hero
+* baddy
+* hole in the floor
+
+* input events.
+	* K, D, W, ESCAPE
+	* touch/mouse events, top middle bottom
+
+* music
+
+
+DONE
+====
+
+* floor moving
+* create status indicator
+* start basic classes for each object needed.
+* set up packaging, bitbucket.
+* do plan drawings
+
+

outofdesert/data/duck.png

Added
New image

outofdesert/main.py

 
 import pygame
 from pygame.locals import *
+from skelutil import data_dir
 
 WIDTH, HEIGHT = 640,480
 
 
         self.indicator = Indicator().start()
         self.indicator.add(self)
+
+
+        self.floor = Floor().start()
+        self.floor.add(self)
+
+        self.duck= Duck().start()
+        self.duck.add(self)
+        self.duck.fly()
+
         return self
 
 
     def start(self):
         pass
 
-class Person(Sprite):
+class Baddy(Sprite):
     def start(self):
         pass
 
         self.indicator = 0.5
         self.rect = Rect(WIDTH -100, 0, 100, 20)
         self.image = pygame.Surface((100, 20))
+        self.count = 0
+        
         return self
 
     def update(self, *args):
+        self.count += 1
         self.indicator += 0.001
+        #if self.indicator > 0.6:
+        #    self.indicator = 0.1
+
         howmuch = int(100 * self.indicator)
         #print ("howmuch %s %s" % (howmuch, self.indicator))
         self.image.fill(Color("white"))
 
 class Floor(Sprite):
     def start(self):
-        pass
+        self.rect = Rect(0, HEIGHT - 40, WIDTH, 20)
+        self.image = pygame.Surface(self.rect.size)
+        self.image.fill((255,255,255))
+
+        self.count = 0
+        return self
+
+    def update(self, *args):
+        self.count += 1
+
+        # draw the floor.
+        c = pygame.Color("black")
+        start = (0,5)
+        end = (self.image.get_width(), 5)
+
+        r = pygame.draw.line(self.image, c, start, end)
+
+        self.dirty = 1
+
+
+
 
 class Duck(Sprite):
+
     def start(self):
-        pass
+        self.rect = Rect(WIDTH + 32, HEIGHT - 200, 32, 32)
+        self.image = pygame.image.load(data_dir("duck.png"))
 
+        self.dy = 0
+        self.count = 0
+        return self
 
+    def fly(self):
+        self.dx = -1
+    def stop(self):
+        self.dx = 0
+    def update(self, *args):
+        self.count += 1
+        #where is duck?
+        self.rect.x += self.dx
+
+        self.dirty = 1
 
 
 
     going = True
     g = Game().start()
     clock = pygame.time.Clock()
+    screen.fill((255,255,255))
 
     while going:
         events = pygame.event.get()

outofdesert/skelutil.py

 
-
+import os
 _DATA_DIR = None
 def data_dir(*args):
     """ data_dir() returns the path to where the data is stored.