diff options
author | Alan Aguiar <alanjas@hotmail.com> | 2013-04-09 21:11:41 (GMT) |
---|---|---|
committer | Alan Aguiar <alanjas@hotmail.com> | 2013-04-09 21:11:41 (GMT) |
commit | a6a0abae9ae1da08dddd2058836164cdd05198b8 (patch) | |
tree | 99aeafc385d20ad3b615fc2e39cb5b80b0e7af27 | |
parent | a13ed1ca6318aa82330162f24673a017eadeb9c5 (diff) |
only import the just and necessary
-rwxr-xr-x | activity.py | 2 | ||||
-rwxr-xr-x | cells.py | 29 | ||||
-rwxr-xr-x | pieces.py | 7 | ||||
-rwxr-xr-x | sprites.py | 9 |
4 files changed, 20 insertions, 27 deletions
diff --git a/activity.py b/activity.py index bb5ded1..e60ef8c 100755 --- a/activity.py +++ b/activity.py @@ -19,10 +19,8 @@ import gtk from sugar.activity import activity from sugar.graphics.toolbarbox import ToolbarBox -from sugar.graphics.toolbutton import ToolButton from sugar.activity.widgets import ActivityToolbarButton from sugar.activity.widgets import StopButton -from sugar.graphics.toolbarbox import ToolbarButton import sugargame.canvas import cells @@ -20,11 +20,10 @@ import gtk import math import pygame -from pygame.locals import * -from pieces import * -from sprites import * -from colors import * -from random import * +from random import randint, shuffle +from pieces import EscapeArea, Cell, Hideout +from sprites import Text, Group, Guard +from colors import blue, yellow, black, white from gettext import gettext as _ @@ -190,18 +189,18 @@ class Game(): # Handle Input Events for event in pygame.event.get(): # this one is for the box in the top right marked X - if event.type == QUIT: + if event.type == pygame.QUIT: playing, self.running = False, False # and this one is for the "ESC" key - if event.type == KEYDOWN: - if event.key == K_ESCAPE: + if event.type == pygame.KEYDOWN: + if event.key == pygame.K_ESCAPE: self.move_count = 0 playing = False self.makeMenu() self.cell_count = 1 - if event.key == K_r: + if event.key == pygame.K_r: self.resetGame() - elif event.key == K_h: + elif event.key == pygame.K_h: self.help() # update sprites @@ -269,10 +268,10 @@ class Game(): for event in pygame.event.get(): # this one is for the box in the top right marked X - if event.type == QUIT: + if event.type == pygame.QUIT: self.running = False # and this one is for the "ESC" key - if event.type == KEYDOWN and event.key == K_ESCAPE: + if event.type == pygame.KEYDOWN and event.key == pygame.K_ESCAPE: helping = False pygame.display.flip() @@ -292,11 +291,11 @@ class Game(): for event in pygame.event.get(): # this one is for the box in the top right marked X - if event.type == QUIT: + if event.type == pygame.QUIT: self.running = False # and this one is for the "ESC" key - if event.type == KEYDOWN: - if event.key == K_ESCAPE: + if event.type == pygame.KEYDOWN: + if event.key == pygame.K_ESCAPE: self.running = False elif self.cell_count == 2 and not self.new_game: self.new_game = True @@ -14,12 +14,9 @@ # You should have received a copy of the GNU General Public License # along with Cells. If not, see <http://www.gnu.org/licenses/>. -import math import pygame -from pygame.locals import * -from sprites import * -from colors import * -from random import * +from sprites import Group, Text, Prisoner +from colors import red, green, black, white ################################################################################ # The Cells @@ -16,9 +16,8 @@ import math import pygame -from pygame.locals import * -from colors import * -from random import * +from colors import red, yellow, black, grey, white +from random import randint ################################################################################ # the Super Group... because regular groups aren't good enough @@ -36,8 +35,8 @@ class Text(pygame.sprite.Sprite): def __init__(self, text, size, color = black): pygame.sprite.Sprite.__init__(self) default = pygame.font.get_default_font() - font = pygame.font.Font(default, size) - self.original = font.render(text, True, color) + font = pygame.font.Font(default, size) + self.original = font.render(text, True, color) self.image = self.original.copy() self.rect = self.image.get_rect() |