File tree Expand file tree Collapse file tree 4 files changed +15
-11
lines changed
Expand file tree Collapse file tree 4 files changed +15
-11
lines changed Original file line number Diff line number Diff line change 1+ from __future__ import print_function
12try :
23 import pygame_sdl2 as pygame
34except ImportError :
4- print "pygame_sdl2 not found; falling back to pygame."
5+ print ( "pygame_sdl2 not found; falling back to pygame." )
56 import pygame
67import time
78
Original file line number Diff line number Diff line change 11#!/usr/bin/env python
22
3-
3+ from __future__ import print_function
44import os
55#from screen import screen
66import sys
77import random
8+
89try :
910 import pygame_sdl2 as pygame
1011except ImportError :
11- print "pygame_sdl2 not found; falling back to pygame."
12+ print ( "pygame_sdl2 not found; falling back to pygame." )
1213 import pygame
1314import conf
1415from ui import ui
@@ -292,7 +293,7 @@ def run_game(self):
292293 elif event .key == pygame .K_q :
293294 self .exit_game ()
294295 else :
295- print "event.key:" , event .key
296+ print ( "event.key:" , event .key )
296297 #if event.key == pygame.K_UP:
297298 # self.move(1)
298299 else :
@@ -301,7 +302,7 @@ def run_game(self):
301302
302303 if conf .TOUCH_SCREEN :
303304 mouseAction = self .touchScreen .getEventBoxes ()
304- if mouseAction > 0 :
305+ if mouseAction and mouseAction > 0 :
305306 if gameOver :
306307 self .resetGame ()
307308 gameOver = False
Original file line number Diff line number Diff line change 1+ from __future__ import print_function
2+
13try :
24 import pygame_sdl2 as pygame
35except ImportError :
4- print "pygame_sdl2 not found; falling back to pygame."
6+ print ( "pygame_sdl2 not found; falling back to pygame." )
57 import pygame
68
79class touchScreen (object ):
Original file line number Diff line number Diff line change 22
33# notes:
44# The Ten Commandments Of Video Game Menus http://kotaku.com/5955855/the-ten-commandments-of-video-game-menus
5-
5+ from __future__ import print_function
66try :
77 import pygame_sdl2 as pygame
88except ImportError :
9- print "pygame_sdl2 not found; falling back to pygame."
9+ print ( "pygame_sdl2 not found; falling back to pygame." )
1010 import pygame
1111import sys
1212
@@ -183,11 +183,11 @@ def draw(self, menuKey=''):
183183
184184 elif event .type == pygame .KEYDOWN :
185185 if iUi .interaction (event .key ):
186- print "UI catched this key:" , event .key
186+ print ( "UI catched this key:" , event .key )
187187 else :
188- print "no UI catch, key pressed:" , event .key
188+ print ( "no UI catch, key pressed:" , event .key )
189189 if pygame .K_RETURN == event .key :
190- print "selected item:" , iUi .getSelectedItem ()
190+ print ( "selected item:" , iUi .getSelectedItem () )
191191
192192 if event .key == pygame .K_q :
193193 sys .exit (0 )
You can’t perform that action at this time.
0 commit comments