diff options
author | Luiz Irber <luiz.irber@gmail.com> | 2007-11-11 10:07:42 (GMT) |
---|---|---|
committer | Luiz Irber <luiz.irber@gmail.com> | 2007-11-11 10:07:42 (GMT) |
commit | 158e54c9933f5a244ff27199e4e5786f3add2186 (patch) | |
tree | 5eabea3f0f17c114cf0c734c10ee7f7ddbe5b6c5 | |
parent | 1237d3f177db09c28f02ebe797165a9f093c94e7 (diff) |
V9, 8 horas
-rw-r--r-- | Gambiarra/command.py | 27 | ||||
-rw-r--r-- | Gambiarra/gambiarra.py | 111 | ||||
-rw-r--r-- | Gambiarra/gamemenu.py | 132 | ||||
-rw-r--r-- | Gambiarra/levels.py | 67 | ||||
-rw-r--r-- | Gambiarra/objects/animals.py | 27 | ||||
-rw-r--r-- | Gambiarra/objects/balls.py | 35 | ||||
-rw-r--r-- | Gambiarra/objects/elastica.py | 23 | ||||
-rw-r--r-- | Gambiarra/objects/esteira.py | 27 | ||||
-rw-r--r-- | Gambiarra/objects/target.py | 23 | ||||
-rw-r--r-- | Gambiarra/objects/things.py | 28 | ||||
-rw-r--r-- | Gambiarra/objects/wall.py | 46 | ||||
-rw-r--r-- | GambiarraActivity.py | 22 | ||||
-rw-r--r-- | MANIFEST | 1 | ||||
-rw-r--r-- | data/images/background.png | bin | 0 -> 97577 bytes | |||
-rw-r--r-- | setup.py | 2 |
15 files changed, 440 insertions, 131 deletions
diff --git a/Gambiarra/command.py b/Gambiarra/command.py index 49f4481..9f1c658 100644 --- a/Gambiarra/command.py +++ b/Gambiarra/command.py @@ -1,4 +1,23 @@ -# gambiarra/command.py +# -*- coding: UTF-8 -*- +# +# Copyright (C) 2007 by ULPM: Alexandre Yukio Harano +# Fábio Cassarotti Parronchi Navarro +# Gabriel Geraldo França Marcondes +# Luiz Carlos Irber Júnior +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. from os.path import abspath @@ -20,14 +39,14 @@ class Command(pygame.sprite.Sprite): class Play(Command): def __init__(self): super(Play, self).__init__( pygame.image.load( - abspath("../data/images/playButton.png") ) ) + abspath("../data/images/playButton.png") ) ) class Help(Command): def __init__(self): super(Help, self).__init__( pygame.image.load( - abspath("../data/images/helpButton.png") ) ) + abspath("../data/images/helpButton.png") ) ) class Quit(Command): def __init__(self): super(Quit, self).__init__( pygame.image.load( - abspath("../data/images/quitButton.png") ) ) + abspath("../data/images/quitButton.png") ) ) diff --git a/Gambiarra/gambiarra.py b/Gambiarra/gambiarra.py index e46f174..b9144bc 100644 --- a/Gambiarra/gambiarra.py +++ b/Gambiarra/gambiarra.py @@ -1,5 +1,24 @@ -# gambiarra/gambiarra.py -#aqui fica o codigo do jogo em si +#!/usr/bin/env python +# -*- coding: UTF-8 -*- +# +# Copyright (C) 2007 by ULPM: Alexandre Yukio Harano +# Fábio Cassarotti Parronchi Navarro +# Gabriel Geraldo França Marcondes +# Luiz Carlos Irber Júnior +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. import pygame from pygame.locals import * @@ -9,6 +28,8 @@ from objects.elastica import Elastica from objects.esteira import Esteira from objects.target import Target from objects.wall import * +from command import Play, Help, Quit +from gamemenu import GameMenu def check_collision(sprite_list, wall_list): new_objects = pygame.sprite.RenderPlain() @@ -27,7 +48,7 @@ def check_collision(sprite_list, wall_list): if obj.rect.bottom > w.rect.top: obj.rect.bottom = w.rect.top - 1 obj.speed[1] = -0.7*obj.speed[1] - + #1. a**n + b**n = c**n ? if isinstance(w, UpWall): if obj.rect.top < w.rect.bottom: obj.rect.top = w.rect.bottom + 1 @@ -63,28 +84,27 @@ def check_collision(sprite_list, wall_list): class Game(object): - fps = 5 + fps = 30 screen = None - screenSize = None playing = None run = None background = None clock = None level = 0 levels = [] - action = [] selected_element = None + menu = None def __init__(self): pygame.init() self.screen = pygame.display.set_mode((1200,900)) #omitindo flags - self.screenSize = self.screen.get_size() pygame.display.flip() self.run = True self.playing = False pygame.display.set_caption("Gambiarra") self.clock = pygame.time.Clock() self.levels = Levels.init_levels() + self.menu = GameMenu() #inicia o loop self.main_loop() @@ -111,16 +131,13 @@ class Game(object): else: obj.speed[0] = 20 obj.speed[1] += obj.gravity - elif self.action: - action = None - - def start_window(self): - #desenha a tela inicial (abstrato -chama os outros metodos predefinidos) - pass - - def next_level(self): - pass - + + def goal_reached(self): + reached = False + if self.levels[self.level].goal.rect.collidepoint(self.levels[self.level].toGoal.rect.center): + reached = True + return reached + def mouse_event(self, mousePos): if not self.selected_element: collided = False @@ -129,44 +146,68 @@ class Game(object): for element in self.levels[self.level].simulator.objects: if element.rect.collidepoint(mousePos): - print "COLIDIU PORRA", element collided = True self.selected_element = element break + if not self.selected_element: + for element in self.levels[self.level].simulator.staticObjs: + if element.rect.collidepoint(mousePos): + collided = True + self.selected_element = element + break + if not self.selected_element: #se nao encontrou no for anterior - print "nao colidiu no simulador" for element in self.levels[self.level].objbar.objects: if element.rect.collidepoint(mousePos): - print "COLIDIU PORRA", element collided = True + element.remove(self.levels[self.level].objbar.objects) + self.levels[self.level].simulator.add(element) self.selected_element = element break - """if not self.selected_element: #se nao encontrou no for anterior + if not self.selected_element: #se nao encontrou no for anterior for element in self.levels[self.level].cmdbar.commands: if element.rect.collidepoint(mousePos): - print "COLIDIU PORRA", element - collided = True - self.selected_element = element - break""" - + if isinstance(element, Play): + element.image = pygame.transform.flip(element.image, + True, False) + self.playing = not self.playing + if not self.playing: + for element in self.levels[self.level].simulator.objects: + element.speed = [0,0] + element.rect.topleft = element.initialPosition + + elif isinstance(element, Help): + #TODO: como mostrar a ajuda? + pass + elif isinstance(element, Quit): + self.run = False + break else: mouseMove = pygame.mouse.get_rel() - self.selected_element.rect = self.selected_element.rect.move(mouseMove) + if self.selected_element.editable: + self.selected_element.rect = self.selected_element.rect.move(mouseMove) + self.selected_element.initialPosition = self.selected_element.rect.topleft self.selected_element = None def main_loop(self): - #quando clicar em play transformar o botao em stop + self.menu.run() while self.run: - self.event_handler() - self.clock.tick(self.fps) - self.update_screen(self.fps) - self.levels[self.level].draw() - - pygame.display.flip() - + goal = self.goal_reached() + while not goal: + self.event_handler() + self.clock.tick(self.fps) + self.update_screen(self.fps) + self.levels[self.level].draw() + + pygame.display.flip() + + goal = self.goal_reached() + self.playing = False + goal = False + self.level += 1 def main(): game = Game() diff --git a/Gambiarra/gamemenu.py b/Gambiarra/gamemenu.py index 0f18bee..52e0b86 100644 --- a/Gambiarra/gamemenu.py +++ b/Gambiarra/gamemenu.py @@ -1,4 +1,23 @@ -# gambiarra/gamemenu.py +# -*- coding: UTF-8 -*- +# +# Copyright (C) 2007 by ULPM: Alexandre Yukio Harano +# Fábio Cassarotti Parronchi Navarro +# Gabriel Geraldo França Marcondes +# Luiz Carlos Irber Júnior +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. import pygame from pygame.locals import * @@ -8,63 +27,87 @@ from os.path import abspath class GameMenu(object): screen = None background = None - level = None +# level = None start = None def __init__(self): - pygame.init() - pygame.display.set_mode((1280,800)) +# pygame.init() +# pygame.display.set_mode((1280,800)) self.screen = pygame.display.get_surface() - self.background = pygame.image.load(abspath("../data/images/iniciar_normal.png")) + self.background = pygame.image.load(abspath("../data/images/background.png")) # mudar o arquivo de logotipo - self.level = LevelButton([400,350]) - self.start = StartButton([400,600]) +# self.level = LevelButton(350) + self.start = StartButton(520) def run(self): self.screen.blit(self.background, (0,0)) - self.level.draw(self.screen) +# self.level.draw(self.screen) self.start.draw(self.screen) pygame.display.flip() while (True): pos = pygame.mouse.get_pos() - print pos event = self.event_handler() if ( event == MOUSEMOTION ): self.screen.fill((0,0,0)) self.screen.blit(self.background, (0,0)) - self.level.draw(self.screen) +# self.level.draw(self.screen) self.start.draw(self.screen) pygame.display.flip() + if ( event == MOUSEBUTTONUP ) : + if self.start.clicked: + return +# if self.level.clicked: +# self.screen.fill((0,0,0)) +# self.screen.blit(self.background, (0,0)) +# self.level.draw(self.screen) +# self.start.draw(self.screen) +# pygame.display.flip() +# self.level.clicked = False def event_handler(self): validEventFound = False while True: for event in pygame.event.get(): if event.type == MOUSEMOTION: - if self.level.current_img.get_rect(topleft = self.level.position).collidepoint(pygame.mouse.get_pos()): - if self.level.current == 0 : - if self.start.current == 1: - self.start.current = 0 - self.start.current_img = self.start.img[self.start.current] - self.level.current = 1 - self.level.current_img = self.level.img[self.level.current] - return MOUSEMOTION - elif self.start.current_img.get_rect(topleft = self.start.position).collidepoint(pygame.mouse.get_pos()): + if self.start.current_img.get_rect(topleft = self.start.position).collidepoint(pygame.mouse.get_pos()): if self.start.current == 0 : - if self.level.current == 1: - self.level.current = 0 - self.level.current_img = self.level.img[self.level.current] +# if self.level.current == 1: +# self.level.current = 0 +# self.level.current_img = self.level.img[self.level.current] self.start.current = 1 self.start.current_img = self.start.img[self.start.current] return MOUSEMOTION - elif self.level.current == 1 or self.start.current == 1 : - if self.level.current == 1 : - self.level.current = 0 - self.level.current_img = self.level.img[self.level.current] - else: +# elif self.level.current_img.get_rect(topleft = self.level.position).collidepoint(pygame.mouse.get_pos()): +# if self.level.current == 0 : +# if self.start.current == 1: +# self.start.current = 0 +# self.start.current_img = self.start.img[self.start.current] +# self.level.current = 1 +# self.level.current_img = self.level.img[self.level.current] +# return MOUSEMOTION +# elif self.level.current == 1 or self.start.current == 1 : + elif self.start.current == 1 : + if self.start.current == 1 : self.start.current = 0 self.start.current_img = self.start.img[self.start.current] +# else: +# self.level.current = 0 +# self.level.current_img = self.level.img[self.level.current] return MOUSEMOTION + if event.type == MOUSEBUTTONUP: + if (self.start.current_img.get_rect( + topleft = self.start.position).collidepoint( + pygame.mouse.get_pos()) + and self.start.current == 1): + self.start.click() + return MOUSEBUTTONUP +# elif (self.level.current_img.get_rect( +# topleft = self.level.position).collidepoint( +# pygame.mouse.get_pos()) +# and self.level.current == 1): +# self.level.click() +# return MOUSEBUTTONUP + class LevelButton(object): img = None @@ -72,38 +115,53 @@ class LevelButton(object): level = None current = None current_img = None + numberOfLevels = None + current_level_img = None + clicked = None - def __init__(self, position): - nonHover = pygame.image.load(abspath("../data/images/nivel_normal.png")) - hover = pygame.image.load(abspath("../data/images/nivel_hover.png")) + def __init__(self, position, numberOfLevels = 1): + nonHover = pygame.image.load( + abspath("../data/images/nivel_normal.png") ) + hover = pygame.image.load( + abspath("../data/images/nivel_hover.png") ) self.img = [nonHover,hover] - self.position = position + self.position = [600 - nonHover.get_width()/2, position] self.level = 0 self.current = 0 self.current_img = self.img[self.current] + self.numberOfLevels = numberOfLevels + self.current_level_img = None # Precisa 'renderizar' o numero do nivel + self.clicked = False def draw(self, screen): screen.blit(self.current_img, self.position) def click(self): - pass + self.clicked = True + self.level += 1 + if self.level == self.numberOfLevels : + self.level = 0 class StartButton(object): img = None position = None current = None current_img = None + clicked = None def __init__(self, position): - nonHover=pygame.image.load(abspath("../data/images/iniciar_normal.png")) - hover = pygame.image.load(abspath("../data/images/iniciar_hover.png")) + nonHover=pygame.image.load( + abspath("../data/images/iniciar_normal.png") ) + hover = pygame.image.load( + abspath("../data/images/iniciar_hover.png") ) self.img = [nonHover,hover] - self.position = position + self.position = [600 - nonHover.get_width()/2 - 50, position] self.current = 0 self.current_img = self.img[self.current] + self.clicked = False def draw(self, screen): screen.blit(self.current_img, self.position) - + def click(self): - pass
\ No newline at end of file + self.clicked = True
\ No newline at end of file diff --git a/Gambiarra/levels.py b/Gambiarra/levels.py index 7efb41c..9c6beeb 100644 --- a/Gambiarra/levels.py +++ b/Gambiarra/levels.py @@ -1,5 +1,23 @@ -# gambiarra/levels.py -#arquivo que contem a lista de fases +# -*- coding: UTF-8 -*- +# +# Copyright (C) 2007 by ULPM: Alexandre Yukio Harano +# Fábio Cassarotti Parronchi Navarro +# Gabriel Geraldo França Marcondes +# Luiz Carlos Irber Júnior +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. import pygame from objects.balls import * @@ -52,6 +70,12 @@ class SimulationView(object): for item in self.objects: item.draw(screen, item.rect.topleft) + def add(self, obj): + if _is_static(obj): + self.staticObjs.append(obj) + else: + obj.add(self.objects) + class ObjectBar(object): """ This widget contains the objects available for the problem. """ @@ -92,10 +116,11 @@ class CommandBar(object): else: screen.blit(self.background, (1000, 770)) - pos = [1015, 810] + objpos = [1015, 810] for cmd in self.commands: - cmd.draw(screen, pos) - pos[0] += cmd.image.get_width() + 15 + cmd.rect.topleft = objpos + cmd.draw(screen, cmd.rect.topleft ) + objpos[0] += cmd.image.get_width() + 15 def update(self): pass @@ -105,10 +130,12 @@ class Level(object): on the screen""" objects = None - def __init__(self, objInPlace, objToAdd): + def __init__(self, objInPlace, objToAdd, goal, toGoal): self.simulator = SimulationView(objInPlace) self.objbar = ObjectBar(objToAdd) self.cmdbar = CommandBar() + self.goal = goal + self.toGoal = toGoal def draw(self): self.simulator.draw() @@ -119,19 +146,27 @@ class Level(object): def init_levels(): #FIXME: fazer de um jeito menos lusitano #Sample levels - level1ObjInPlace = [ BowlingBall((200,300)), BeachBall((300,0)), - Esteira((300,500)), Target((1000,600)), - Elastica((700, 600))] - level1ObjToAdd = [ Penguin(), BeachBall(), BowlingBall(), Esteira(), Elastica() ] - - level2ObjInPlace = [ Penguin((300,600)), Esteira((20,650))] + level1ObjInPlace = [ SoccerBall((200,300),editable=False), + Esteira((300,500), editable=False), + Target((1000,600), editable=False)] + level1ObjToAdd = [ Penguin() ] + level1Goal = level1ObjInPlace[-1] + level1ToGoal = level1ObjInPlace[0] + + level2ObjInPlace = [ Penguin((300,600),editable=False), + Esteira((20,650),editable=False), + Target((500,600), editable=False)] level2ObjToAdd = [ BeachBall(), Penguin(), BowlingBall() ] + level2Goal = level2ObjInPlace[-1] + level2ToGoal = level2ObjInPlace[0] - level3ObjInPlace = [ BowlingBall((200,700)), Penguin((500, 800))] + level3ObjInPlace = [ BowlingBall((200,700),editable=False), Penguin((500, 800),editable=False)] level3ObjToAdd = [ Penguin(), BeachBall() ] + level3Goal = level3ObjInPlace[-1] + level3ToGoal = level3ObjInPlace[0] - level1 = Level( level1ObjInPlace, level1ObjToAdd ) - level2 = Level( level2ObjInPlace, level2ObjToAdd ) - level3 = Level( level3ObjInPlace, level3ObjToAdd ) + level1 = Level( level1ObjInPlace, level1ObjToAdd, level1Goal, level1ToGoal) + level2 = Level( level2ObjInPlace, level2ObjToAdd, level2Goal, level2ToGoal) + level3 = Level( level3ObjInPlace, level3ObjToAdd, level3Goal, level3ToGoal) return [level1, level2, level3]
\ No newline at end of file diff --git a/Gambiarra/objects/animals.py b/Gambiarra/objects/animals.py index 05a436a..1399731 100644 --- a/Gambiarra/objects/animals.py +++ b/Gambiarra/objects/animals.py @@ -1,4 +1,23 @@ -# gambiarra/objects/animals.py +# -*- coding: UTF-8 -*- +# +# Copyright (C) 2007 by ULPM: Alexandre Yukio Harano +# Fábio Cassarotti Parronchi Navarro +# Gabriel Geraldo França Marcondes +# Luiz Carlos Irber Júnior +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. import pygame @@ -9,6 +28,6 @@ from os.path import abspath class Penguin(Thing): def __init__(self, initialPosition=None, editable=True): super(Penguin, self).__init__( - pygame.image.load(abspath("../data/images/penguin.png")), - editable, initialPosition, elasticity = 100, mobility = True, - gravity = 1) + pygame.image.load(abspath("../data/images/penguin.png")), + editable, initialPosition, elasticity = 100, mobility = True, + gravity = 1) diff --git a/Gambiarra/objects/balls.py b/Gambiarra/objects/balls.py index 0fb5b66..58021e6 100644 --- a/Gambiarra/objects/balls.py +++ b/Gambiarra/objects/balls.py @@ -1,5 +1,23 @@ -# gambiarra/objects/balls.py -# este arquivo contem a bola basica, outras sao derivadas desta +# -*- coding: UTF-8 -*- +# +# Copyright (C) 2007 by ULPM: Alexandre Yukio Harano +# Fábio Cassarotti Parronchi Navarro +# Gabriel Geraldo França Marcondes +# Luiz Carlos Irber Júnior +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. from os.path import abspath @@ -10,9 +28,9 @@ from things import Thing class BowlingBall(Thing): def __init__(self, initialPosition=None, editable=True): super(BowlingBall, self).__init__( - pygame.image.load(abspath("../data/images/bolaBoliche.png")), - editable, initialPosition, elasticity = 100, mobility = True, - gravity = 10) + pygame.image.load(abspath("../data/images/bolaBoliche.png")), + editable, initialPosition, elasticity = 100, mobility = True, + gravity = 10) class BeachBall(Thing): def __init__(self, initialPosition=None, editable=True): @@ -20,3 +38,10 @@ class BeachBall(Thing): pygame.image.load(abspath("../data/images/bola.png")), editable, initialPosition, elasticity = 100, mobility = True, gravity = 10) + +class SoccerBall(Thing): + def __init__(self, initialPosition=None, editable=True): + super(SoccerBall, self).__init__( + pygame.image.load(abspath("../data/images/futebol.png")), + editable, initialPosition, elasticity = 100, mobility = True, + gravity = 10) diff --git a/Gambiarra/objects/elastica.py b/Gambiarra/objects/elastica.py index 1d208fa..94567ef 100644 --- a/Gambiarra/objects/elastica.py +++ b/Gambiarra/objects/elastica.py @@ -1,4 +1,23 @@ -# gambiarra/elastica.py +# -*- coding: UTF-8 -*- +# +# Copyright (C) 2007 by ULPM: Alexandre Yukio Harano +# Fábio Cassarotti Parronchi Navarro +# Gabriel Geraldo França Marcondes +# Luiz Carlos Irber Júnior +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. from os.path import abspath @@ -8,7 +27,7 @@ from things import Thing class Elastica(Thing): - def __init__(self, initialPosition = [0,0], editable=False): + def __init__(self, initialPosition = [0,0], editable=True): super(Elastica, self).__init__( pygame.image.load(abspath("../data/images/cama_elastica.png")), editable, initialPosition, elasticity = 100, mobility = False, diff --git a/Gambiarra/objects/esteira.py b/Gambiarra/objects/esteira.py index 75ada56..11170c6 100644 --- a/Gambiarra/objects/esteira.py +++ b/Gambiarra/objects/esteira.py @@ -1,4 +1,23 @@ -# gambiarra/esteira.py +# -*- coding: UTF-8 -*- +# +# Copyright (C) 2007 by ULPM: Alexandre Yukio Harano +# Fábio Cassarotti Parronchi Navarro +# Gabriel Geraldo França Marcondes +# Luiz Carlos Irber Júnior +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. from os.path import abspath @@ -10,16 +29,16 @@ class Esteira(Thing): sentido = None - def __init__(self, initialPosition = [0,0], editable=False): + def __init__(self, initialPosition = [0,0], editable=True): super(Esteira, self).__init__( pygame.image.load(abspath("../data/images/esteira_dir.png")), editable, initialPosition, elasticity = 100, mobility = False, gravity = 10) self.sentido = 1 self.image_dir = pygame.image.load( - abspath("../data/images/esteira_dir.png")) + abspath("../data/images/esteira_dir.png")) self.image_esq = pygame.image.load( - abspath("../data/images/esteira_esq.png")) + abspath("../data/images/esteira_esq.png")) def draw(self, screen, pos): # temos a imagem na variavel <img> e diff --git a/Gambiarra/objects/target.py b/Gambiarra/objects/target.py index 0791146..284315a 100644 --- a/Gambiarra/objects/target.py +++ b/Gambiarra/objects/target.py @@ -1,4 +1,23 @@ -# gambiarra/target.py +# -*- coding: UTF-8 -*- +# +# Copyright (C) 2007 by ULPM: Alexandre Yukio Harano +# Fábio Cassarotti Parronchi Navarro +# Gabriel Geraldo França Marcondes +# Luiz Carlos Irber Júnior +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. from os.path import abspath @@ -7,7 +26,7 @@ import pygame from things import Thing class Target(Thing): - def __init__(self, initialPosition = [0,0], editable=False): + def __init__(self, initialPosition = [0,0], editable=True): super(Target, self).__init__( pygame.image.load(abspath("../data/images/target.png")), editable, initialPosition, elasticity = 100, mobility = False, diff --git a/Gambiarra/objects/things.py b/Gambiarra/objects/things.py index 0e399fd..da440d0 100644 --- a/Gambiarra/objects/things.py +++ b/Gambiarra/objects/things.py @@ -1,5 +1,23 @@ -# gambiarra/objects/things.py -# classe mais abstrata para "coisas" na tela +# -*- coding: UTF-8 -*- +# +# Copyright (C) 2007 by ULPM: Alexandre Yukio Harano +# Fábio Cassarotti Parronchi Navarro +# Gabriel Geraldo França Marcondes +# Luiz Carlos Irber Júnior +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. import pygame @@ -13,8 +31,8 @@ class Thing(pygame.sprite.Sprite): gravity = None elasticity = None # * 1%, from 0 up to 100 - def __init__(self, image, editable, initialPosition=None, elasticity = 100, - mobility = False, gravity = 10 ): + def __init__(self, image, editable, initialPosition=None, + elasticity = 100, mobility = False, gravity = 10 ): pygame.sprite.Sprite.__init__(self) #call Sprite intializer self.image = image self.rect = image.get_rect() @@ -23,7 +41,7 @@ class Thing(pygame.sprite.Sprite): self.initialPosition = initialPosition self.rect.topleft = initialPosition[0], initialPosition[1] self.elasticity = elasticity - self.editable = True ###VOLTAR!! + self.editable = editable self.speed = [0,0] self.mobility = mobility self.gravity = gravity diff --git a/Gambiarra/objects/wall.py b/Gambiarra/objects/wall.py index 6ef75ed..a6c40fb 100644 --- a/Gambiarra/objects/wall.py +++ b/Gambiarra/objects/wall.py @@ -1,5 +1,23 @@ -# gambiarra/objects/wall.py -# este arquivo contem a bola basica, outras sao derivadas desta +# -*- coding: UTF-8 -*- +# +# Copyright (C) 2007 by ULPM: Alexandre Yukio Harano +# Fábio Cassarotti Parronchi Navarro +# Gabriel Geraldo França Marcondes +# Luiz Carlos Irber Júnior +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. from os.path import abspath @@ -10,27 +28,27 @@ from things import Thing class LeftWall(Thing): def __init__(self, initialPosition = [0,0], editable=False): super(LeftWall, self).__init__( - pygame.image.load(abspath("../data/images/leftwall.png")), - editable, initialPosition, elasticity = 100, mobility = False, - gravity = 10) + pygame.image.load(abspath("../data/images/leftwall.png")), + editable, initialPosition, elasticity = 100, mobility = False, + gravity = 10) class RightWall(Thing): def __init__(self, initialPosition = [1185,0], editable=False): super(RightWall, self).__init__( - pygame.image.load(abspath("../data/images/rightwall.png")), - editable, initialPosition, elasticity = 100, mobility = False, - gravity = 10) + pygame.image.load(abspath("../data/images/rightwall.png")), + editable, initialPosition, elasticity = 100, mobility = False, + gravity = 10) class UpWall(Thing): def __init__(self, initialPosition = [15,0], editable=False): super(UpWall, self).__init__( - pygame.image.load(abspath("../data/images/upwall.png")), - editable, initialPosition, elasticity = 100, mobility = False, - gravity = 10) + pygame.image.load(abspath("../data/images/upwall.png")), + editable, initialPosition, elasticity = 100, mobility = False, + gravity = 10) class DownWall(Thing): def __init__(self, initialPosition = [15,755], editable=False): super(DownWall, self).__init__( - pygame.image.load(abspath("../data/images/downwall.png")), - editable, initialPosition, elasticity = 100, mobility = False, - gravity = 10) + pygame.image.load(abspath("../data/images/downwall.png")), + editable, initialPosition, elasticity = 100, mobility = False, + gravity = 10) diff --git a/GambiarraActivity.py b/GambiarraActivity.py index efaec3b..f9a9c84 100644 --- a/GambiarraActivity.py +++ b/GambiarraActivity.py @@ -1,5 +1,23 @@ -# GambiarraActivity.py -#Aqui vai o codigo de inicializacao da atividade +# -*- coding: UTF-8 -*- +# +# Copyright (C) 2007 by ULPM: Alexandre Yukio Harano +# Fábio Cassarotti Parronchi Navarro +# Gabriel Geraldo França Marcondes +# Luiz Carlos Irber Júnior +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. import olpcgames @@ -1,6 +1,7 @@ activity/activity-gambiarra.svg activity/activity.info +data/images/background.png data/images/bolaBoliche.png data/images/bola.png data/images/cama_elastica.png diff --git a/data/images/background.png b/data/images/background.png Binary files differnew file mode 100644 index 0000000..fb11ecf --- /dev/null +++ b/data/images/background.png @@ -1,4 +1,4 @@ #!/usr/bin/env python -# setup.py + from sugar.activity import bundlebuilder bundlebuilder.start('Gambiarra')
\ No newline at end of file |