Skip to content

Commit

Permalink
Modified controls for Pandora
Browse files Browse the repository at this point in the history
Added names for difficulty levels.
  • Loading branch information
unknown authored and unknown committed Dec 4, 2010
1 parent 3ac7ea1 commit 815e45e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
8 changes: 4 additions & 4 deletions Sparks/Game.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,15 +181,15 @@ def __gameInput(self):
if e.type == QUIT:
pygame.quit()
sys.exit()
if (e.type == KEYDOWN and e.key == K_ESCAPE) or (e.type == JOYBUTTONDOWN and e.button==JOY_ESCAPE):
if (e.type == KEYDOWN and e.key == K_ESCAPE) or (e.type == JOYBUTTONDOWN and e.button==JOY_ESCAPE) or (e.type == KEYDOWN and e.key == K_SYSREQ )or (e.type == KEYDOWN and e.key == K_q):
self.restart = False
self.done = True
if (e.type == KEYDOWN and e.key == K_p) or (e.type == JOYBUTTONDOWN and e.button==JOY_PAUSE):
if (e.type == KEYDOWN and e.key == K_p) or (e.type == JOYBUTTONDOWN and e.button==JOY_PAUSE) or (e.type == KEYDOWN and e.key == K_LALT):
self.paused ^= 1
if (e.type == KEYDOWN and e.key == K_SPACE) or (e.type == JOYBUTTONDOWN and e.button==JOY_FIRE):
if (e.type == KEYDOWN and e.key == K_SPACE) or (e.type == JOYBUTTONDOWN and e.button==JOY_FIRE) or (e.type == KEYDOWN and e.key == K_END):
if self.state==STATE_END_GAME:
self.done = True
if (e.type == JOYBUTTONDOWN and e.button==JOY_FPS):
if (e.type == JOYBUTTONDOWN and e.button==JOY_FPS) or (e.type == KEYDOWN and e.key == K_f):
self.display_fps = not self.display_fps

if e.type == ACTIVEEVENT:
Expand Down
13 changes: 7 additions & 6 deletions Sparks/Menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,13 @@ def __menuInput(self):
if e.type == QUIT:
pygame.quit()
sys.exit()
if (e.type == KEYDOWN and e.key == K_ESCAPE or e.type == JOYBUTTONDOWN and e.button==JOY_BACK):
if (e.type == KEYDOWN and e.key == K_ESCAPE or e.type == KEYDOWN and e.key == K_PAGEUP or e.type == KEYDOWN and e.key == K_SYSREQ or e.type == JOYBUTTONDOWN and e.button==JOY_BACK):
self._escape()
if (e.type == KEYDOWN and e.key == K_UP):
self.__moveUp()
if (e.type == KEYDOWN and e.key == K_DOWN):
self.__moveDown()
if (e.type == KEYDOWN and e.key == K_RETURN or e.type == JOYBUTTONDOWN and e.button==JOY_FIRE):
if (e.type == KEYDOWN and e.key == K_RETURN or e.type == KEYDOWN and e.key == K_END or e.type == KEYDOWN and e.key == K_RETURN or e.type == JOYBUTTONDOWN and e.button==JOY_FIRE):
self.options[self.option].command()

time = pygame.time.get_ticks()
Expand Down Expand Up @@ -184,7 +184,7 @@ def runCustomLevels(self):

def start_game(self,diff):
game = Game.Game()
game.initialize(self.screen,Game.MODE_ARCADE,diff-1)
game.initialize(self.screen,Game.MODE_ARCADE,diff)
game.Run()


Expand All @@ -205,14 +205,15 @@ def start_game(self,diff):
replay=True
while (replay):
game = Game.Game()
game.initialize(self.screen,Game.MODE_LEVEL,diff-1,self.level(diff-1))
game.initialize(self.screen,Game.MODE_LEVEL,diff,self.level(diff))
replay = game.Run()


class DifficultyMenu(Menu):
def _define_menu_entries(self):
for i in range(1,5):
self.AddOption(str(i), self.__set_difficulty_command(i))
strDiffs=["Easy","Normal","Hard","Very hard"]
for i in range(0,4):
self.AddOption(strDiffs[i], self.__set_difficulty_command(i))
self.AddOption("back", self._escape)

def __set_difficulty_command(self,diff):
Expand Down

0 comments on commit 815e45e

Please sign in to comment.