diff options
author | Luiz Irber <luiz.irber@gmail.com> | 2007-11-10 18:01:38 (GMT) |
---|---|---|
committer | Luiz Irber <luiz.irber@gmail.com> | 2007-11-10 18:01:38 (GMT) |
commit | 422d5e38fe942410cf1b4e30e13f76ed0dc4bd1b (patch) | |
tree | 6fb09908dab37acad9bf7eea85865d11a6166a0a | |
parent | e00c360d65fa78fb3a99cc2c6f4db8773009e993 (diff) |
V2, 16 horas
-rw-r--r-- | Gambiarra/__init__.py | 0 | ||||
-rw-r--r-- | Gambiarra/gambiarra.py | 71 | ||||
-rw-r--r-- | Gambiarra/levels/__init__.py | 0 | ||||
-rw-r--r-- | Gambiarra/levels/levels.py | 63 | ||||
-rw-r--r-- | Gambiarra/objects/__init__.py | 0 | ||||
-rw-r--r-- | Gambiarra/objects/animals.py | 16 | ||||
-rw-r--r-- | Gambiarra/objects/balls.py | 17 |
7 files changed, 167 insertions, 0 deletions
diff --git a/Gambiarra/__init__.py b/Gambiarra/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Gambiarra/__init__.py diff --git a/Gambiarra/gambiarra.py b/Gambiarra/gambiarra.py new file mode 100644 index 0000000..61a01dd --- /dev/null +++ b/Gambiarra/gambiarra.py @@ -0,0 +1,71 @@ +# /gambiarra/gambiarra.py +#aqui fica o codigo do jogo em si + +import pygame +from pygame.locals import * +import os +from levels import levels as Levels + +class Game(object): + screen = None + screenSize = None + run = None + background = None + level = 0 + allLevels = [ Levels.level1, Levels.level2, Levels.level3 ] + + def __init__(self): + pygame.init() + actors = {} + self.screen = pygame.display.set_mode((1200,900)) #omitindo flags + self.screenSize = self.screen.get_size() + self.background = pygame.Surface(self.screenSize) + self.background.fill([255,0,0,]) + self.screen.blit(self.background, (0,0)) + pygame.display.flip() + self.run = True + pygame.display.set_caption("Gambiarra") + + #carregar imagens? + #vai carregar tudo de uma vez ou on demand? + + #inicia o loop + self.main_loop() + + def event_handler(self): + #verificar o evento e tomar as acoes + pass + + def update_actors(self): + #update dos elementos da tela + pass + + def actors_clear(self): + #retira ator da tela + pass + + def actors_draw(self): + #desenha ator na tela + pass + + def start_window(self): + #desenha a tela inicial (abstrato -chama os outros metodos predefinidos) + pass + + def next_level(self): + pass + + def main_loop(self): + #loop principal + + while self.run: + + self.allLevels[self.level].draw() + + pygame.display.flip() + +def main(): + game = Game() + +if __name__ == "__main__": + main() diff --git a/Gambiarra/levels/__init__.py b/Gambiarra/levels/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Gambiarra/levels/__init__.py diff --git a/Gambiarra/levels/levels.py b/Gambiarra/levels/levels.py new file mode 100644 index 0000000..613dc6a --- /dev/null +++ b/Gambiarra/levels/levels.py @@ -0,0 +1,63 @@ +# /gambiarra/level.py +#arquivo que contem a lista de fases + +import pygame + +class ObjectBar(object): + """ This widget contains the objects available for the problem. """ + + def __init__(self): + self.background = pygame.Surface((1000, 200)) + self.background.fill([0,255,0]) #TODO: achar uma cor melhor =D + + def draw(self, pos=None): + screen = pygame.display.get_surface() + if pos: + screen.blit(self.background, (pos[0], 700 + pos[1]), pos) + else: + screen.blit(self.background, (0, 700)) + + def update(self): + pass + +class CommandBar(object): + """ This widget contains the commands: play, help, and quit. KISS! =D """ + + def __init__(self): + self.background = pygame.Surface((200, 200)) + self.width, self.height = self.background.get_size() + self.background.fill([0,0,255]) #TODO: achar uma cor melhor =D + + def draw(self, pos=None): + screen = pygame.display.get_surface() + if pos: + screen.blit(self.background, (1000 + pos[0], 700 + pos[1]), pos) + else: + screen.blit(self.background, (1000, 700)) + + def update(self): + pass + +class Level(object): + """This widget contains the objects in the scenario and their positions + on the screen""" + objects = None + + def __init__(self, objectList): + self.objects = objectList + self.objbar = ObjectBar() + self.cmdbar = CommandBar() + + def draw(self): + self.objbar.draw() + self.cmdbar.draw() + + +#Sample levels +level1Objects = [ ("BowlingBall", 200, 300), ("BeachBall", 400, 800)] +level2Objects = [ ("Penguin", 300, 600)] +level3Objects = [ ("BowlingBall", 200, 700), ("Penguin", 500, 800)] + +level1 = Level( level1Objects ) +level2 = Level( level2Objects ) +level3 = Level( level3Objects )
\ No newline at end of file diff --git a/Gambiarra/objects/__init__.py b/Gambiarra/objects/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Gambiarra/objects/__init__.py diff --git a/Gambiarra/objects/animals.py b/Gambiarra/objects/animals.py new file mode 100644 index 0000000..8f30766 --- /dev/null +++ b/Gambiarra/objects/animals.py @@ -0,0 +1,16 @@ +# /gambiarra/objects/animals.py + +# Peguin original art from: +# http://www.flickr.com/photos/katmere/62037353/ +# Updated at November 10th, 2005. +# Published under Creative Commons Attribution 2.0 Generic. + +class Animal(): + img = None + + def __init__(self): + pass + +class Penguin(Animal): + def __init__(self): + super.__init__(self)
\ No newline at end of file diff --git a/Gambiarra/objects/balls.py b/Gambiarra/objects/balls.py new file mode 100644 index 0000000..21f548b --- /dev/null +++ b/Gambiarra/objects/balls.py @@ -0,0 +1,17 @@ +# /gambiarra/objects/level.py +# este arquivo contem a bola basica, outras sao derivadas desta + +class Ball(object): + img = None + + def __init__(self): + pass + +class BowlingBall(Ball): + def __init__(self): + super.__init__(self) + +class BeachBall(Ball): + def __init__(self): + super.__init__(self) + |