def input(self, i): if self.done: return if i.release: return if i.translated == input.ABORT: self.aborted = 1 self.done = 1 self.current[0] = -1 self.clearlist() self.moveto((2, 2)) snd.play('select_choose') if i.translated == input.PRESS: return self.pressed() if i.translated in (input.DOWN, input.UP, input.LEFT, input.RIGHT): if i.translated == input.DOWN: self.current[0] = (self.current[0] + 1) % len(self.gamelist) self.current[1] = min(self.current[1], len(self.gamelist[self.current[0]]) - 1) elif i.translated == input.UP: self.current[0] = (self.current[0] - 1) % len(self.gamelist) self.current[1] = min(self.current[1], len(self.gamelist[self.current[0]]) - 1) elif i.translated == input.LEFT: self.current[1] = (self.current[1] - 1) % len( self.gamelist[self.current[0]]) else: self.current[1] = (self.current[1] + 1) % len( self.gamelist[self.current[0]]) snd.play('select_move') x = self.gamelist[self.current[0]][self.current[1]][1].left y = self.gamelist[self.current[0]][self.current[1]][1].top self.moveto((x, y))
def gameover_start(self): snd.play("gameover") self.ticks = 0 if not self.gamewon: if self.curwave: for wave in self.curwave: for baddy in wave.enemies: baddy.dead = 1 self.background(baddy.lastrect) gfx.dirty(baddy.rect) for x in self.popobjs: x.dead = 1 for x in self.powerupobjs: x.dead = 1 B = self.background for l in self.objlists: for o in l: o.erase(B) if self.map: self.map.erase(B) if self.curwave: [wave.erase(B) for wave in self.curwave] self.runobjects(self.objlists) self.cleanup()
def quit(self): snd.play('select_choose') game.handler = self.prevhandler self.done = 1 if not game.player.name: game.player.name = 'NONAME' game.player.newguid()
def input(self, i): if self.done: return if i.release: return if i.translated == input.ABORT: self.aborted = 1 self.done = 1 self.current[0] = -1 self.clearlist() self.moveto((2, 2)) snd.play('select_choose') if i.translated == input.PRESS: return self.pressed() if i.translated in (input.DOWN, input.UP, input.LEFT, input.RIGHT): if i.translated == input.DOWN: self.current[0] = (self.current[0] + 1) % len(self.gamelist) elif i.translated == input.UP: self.current[0] = (self.current[0] - 1) % len(self.gamelist) elif i.translated == input.LEFT or i.translated == input.RIGHT: self.current[1] = not self.current[1] if self.current[1] and len(self.gamelist[self.current[0]]) <= 2: self.current[1] = 0 snd.play('select_move') x = self.gamelist[self.current[0]][1 + self.current[1]][1].left y = self.gamelist[self.current[0]][1][1].top + self.current[1] * 10 self.moveto((x, y)) self.buildlist()
def playerstart_start(self): snd.play('startlife', 1.0, self.startpos[0]) self.hud.drawlives(self.lives_left) self.powerupcount = max(0.0, self.powerupcount - 15.0) self.teleport = objtele.Tele(self.startpos) self.popobjs.append(self.teleport) self.grabbedboxes = 0
def playerstart_start(self): snd.play("startlife", 1.0, self.startpos[0]) self.hud.drawlives(self.lives_left) self.powerupcount = max(0.0, self.powerupcount - 15.0) self.teleport = objtele.Tele(self.startpos) self.popobjs.append(self.teleport) self.grabbedboxes = 0
def input(self, i): if self.done: return if i.release: return if i.translated == input.ABORT: self.aborted = 1 self.done = 1 self.current[0] = -1 self.clearlist() self.moveto((2, 2)) snd.play("select_choose") if i.translated == input.PRESS: return self.pressed() if i.translated in (input.DOWN, input.UP, input.LEFT, input.RIGHT): if i.translated == input.DOWN: self.current[0] = (self.current[0] + 1) % len(self.gamelist) self.current[1] = min(self.current[1], len(self.gamelist[self.current[0]]) - 1) elif i.translated == input.UP: self.current[0] = (self.current[0] - 1) % len(self.gamelist) self.current[1] = min(self.current[1], len(self.gamelist[self.current[0]]) - 1) elif i.translated == input.LEFT: self.current[1] = (self.current[1] - 1) % len(self.gamelist[self.current[0]]) else: self.current[1] = (self.current[1] + 1) % len(self.gamelist[self.current[0]]) snd.play("select_move") x = self.gamelist[self.current[0]][self.current[1]][1].left y = self.gamelist[self.current[0]][self.current[1]][1].top self.moveto((x, y))
def input(self, i): if i.release: return if i.type == pygame.KEYDOWN: if i.unicode and i.unicode.upper() in charset: return elif i.key in (pygame.K_DELETE, pygame.K_BACKSPACE, pygame.K_RETURN, pygame.K_KP_ENTER): return if i.translated == input.ABORT: return self.quit() if i.translated == input.PRESS: letter = self.letter[2] if letter == '<': self.rub() elif letter == '>': self.quit() else: self.addletter(self.letter[2]) return change = 0 if i.translated == input.LEFT: change = -1 elif i.translated == input.RIGHT: change = 1 elif i.translated == input.UP: change = -10 elif i.translated == input.DOWN: change = 10 if not change: return snd.play('select_move') current = self.fontimages.index(self.letter) + change if current < 0: current = len(self.fontimages) + current if current >= len(self.fontimages): current = current - len(self.fontimages) self.selectletter(self.fontimages[current])
def __init__(self, prevhandler): """ Parametros: prevhandler - handler previamente ativo do jogo. """ self.prevhandler = prevhandler font = txt.Font(None, 20) self.font = txt.Font(None, 22) self.rect = Rect(50, 450, 700, 22) self.text = font.render('Loading Resources...', 1, (250, 255, 255)) self.img_powered = gfx.load('pygame_powered.gif') self.img_logo = gfx.load('1945.png') self.textrect = self.text.get_rect() self.textrect.center = self.rect.center self.lastcurrent = -1 snd.play('startup') self.top = 120 self.left = 100 self.blocks = [] self.starttime = pygame.time.get_ticks() #self.gatherinfo() self.handlederror = 0 self.thread = threading.Thread(None, loadresources) game.threadstop = 0 game.thread = self.thread self.thread.start()
def input(self, i): if i.release: return if i.type == KEYDOWN: if i.unicode and i.unicode.upper() in charset: return elif i.key in (K_DELETE, K_BACKSPACE, K_RETURN, K_KP_ENTER): return if i.translated == input.ABORT: return self.quit() if i.translated == input.PRESS: letter = self.letter[2] if letter == '<': self.rub() elif letter == '>': self.quit() else: self.addletter(self.letter[2]) return change = 0 if i.translated == input.LEFT: change = -1 elif i.translated == input.RIGHT: change = 1 elif i.translated == input.UP: change = -10 elif i.translated == input.DOWN: change = 10 if not change: return snd.play('select_move') current = self.fontimages.index(self.letter) + change if current < 0: current = len(self.fontimages) + current if current >= len(self.fontimages): current = current - len(self.fontimages) self.selectletter(self.fontimages[current])
def quit(self): """ Funcao de saida do menu de creditos """ gfx.dirty(self.background(gfx.rect)) game.handler = self.prevhandler self.done = 1 snd.play('select_choose')
def addletter(self, letter): if len(game.player.name) >= game.name_maxlength or letter not in charset: snd.play('incorrect') return snd.play('select_choose') game.player.name += letter self.recalcname() self.starinc = -self.starinc
def selectadd(self): if len(self.display[input.actions_order[self.currentaction]]) <= 12: snd.play('select_choose') self.inputstate = ADDING self.currentcontrol = len(self.display[input.actions_order[self.currentaction]]) self.moveto(self.targetcontrol()) else: snd.play('incorrect')
def download_start(self): if not self.thread: self.success = 0 thread = threading.Thread(None, downloadfunc, 'FETCHNEWS', [self]) self.downcur = 1 thread.start() self.thread = thread snd.play('startlife')
def delete(self): snd.play('delete') self.clearactionlist() del self.display[input.actions_order[self.currentaction]][self.currentcontrol] input.setdisplay(self.display) self.buildactionlist() self.drawactionlist() self.inputstate = BUTTONS self.moveto(self.targetbutton())
def quit(self): snd.play('chimeout') if snd.music: snd.tweakmusicvolume() if self.rect: r = self.rect.inflate(2, 2) r = self.prevhandler.background(r) gfx.dirty(r) game.handler = self.prevhandler self.done = 1
def playerdie_start(self): # Adiciona um objeto de explosao da aeronave do jogador # e finaliza o mapa. self.player.lives -= 1 snd.play("explode", 1.0, self.player.rect.centerx) self.popobjs.append(objpopshot.PopShot(self.player.rect.center, size="big")) self.player.dead = 1 self.player.active = 0 self.explodetick = 0 self.map.cleanup()
def selectdelete(self): def ignoreall(x): return x[0] != NOEVENT mutable = len(list(filter(ignoreall, self.display[input.actions_order[self.currentaction]]))) if mutable > 1: snd.play('select_choose') self.inputstate = DELETING self.currentcontrol = 0 self.moveto(self.targetcontrol()) else: snd.play('incorrect')
def playerdie_start(self): #Adiciona um objeto de explosao da aeronave do jogador #e finaliza o mapa. self.player.lives -= 1 snd.play('explode', 1.0, self.player.rect.centerx) self.popobjs.append( objpopshot.PopShot(self.player.rect.center, size='big')) self.player.dead = 1 self.player.active = 0 self.explodetick = 0 self.map.cleanup()
def selectdelete(self): def ignoreall(x): return x[0] != pygame.NOEVENT mutable = len(filter(ignoreall, self.display[input.actions_order[self.currentaction]])) if mutable > 1: snd.play('select_choose') self.inputstate = DELETING self.currentcontrol = 0 self.moveto(self.targetcontrol()) else: snd.play('incorrect')
def selectall(self): snd.play('select_choose') self.clearactionlist() if not input.translations.has_key(pygame.NOEVENT): input.translations[pygame.NOEVENT] = {} input.translations[pygame.NOEVENT][pygame.KEYDOWN] = input.actions_order[self.currentaction] input.translations[pygame.NOEVENT][pygame.JOYBUTTONDOWN] = input.actions_order[self.currentaction] self.display = input.getdisplay() self.buildactionlist() self.drawactionlist() self.inputstate = BUTTONS self.moveto(self.targetbutton())
def levelskip_start(self): snd.play("levelskip") game.player.skips += 1 self.poptime = 2 if game.clock.get_fps() < 25: self.poptime = 1 if game.comments >= 1: self.textobjs.append(objtext.Text("Level Skipped")) self.skiptime = 25 for s in self.spikeobjs: s.dead = 1 self.popobjs.append(objpopshot.PopShot(s.rect.center))
def selectall(self): snd.play('select_choose') self.clearactionlist() if NOEVENT not in input.translations: input.translations[NOEVENT] = {} input.translations[NOEVENT][KEYDOWN] = input.actions_order[self.currentaction] input.translations[NOEVENT][JOYBUTTONDOWN] = input.actions_order[self.currentaction] self.display = input.getdisplay() self.buildactionlist() self.drawactionlist() self.inputstate = BUTTONS self.moveto(self.targetbutton())
def levelskip_start(self): snd.play('levelskip') game.player.skips += 1 self.poptime = 2 if game.clock.get_fps() < 25: self.poptime = 1 if game.comments >= 1: self.textobjs.append(objtext.Text('Level Skipped')) self.skiptime = 25 for s in self.spikeobjs: s.dead = 1 self.popobjs.append(objpopshot.PopShot(s.rect.center))
def add(self, i): if not i.release: if i.all: snd.play('select_choose') self.clearactionlist() self.display[input.actions_order[self.currentaction]].append((i.type, i.normalized)) input.setdisplay(self.display) self.buildactionlist() self.drawactionlist() else: snd.play('incorrect') self.inputstate = BUTTONS self.moveto(self.targetbutton())
def gameover_start(self): snd.play("gameover") self.ticks = 5 if not self.gamewon: self.textobjs.append(objtext.Text("Game Over")) for g in self.guardobjs: if not g.killed: g.killed = 1 explode = objexplode.Explode(g.rect.center) self.staticobjs.append(explode) # argh, force a cleanup self.background(g.lastrect) gfx.dirty(g.lastrect)
def quit(self): if not game.player: game.player = players.Player("NONAME") players.make_winner(game.player) game.handler = self.prevhandler self.done = 1 snd.play('select_choose') r = self.r[0].get_rect() gfx.dirty(self.background(r.move(50, 400))) gfx.dirty(self.background(r.move(300, 400))) gfx.dirty(self.background(r.move(550, 400)))
def gameover_start(self): snd.play('gameover') self.ticks = 5 if not self.gamewon: self.textobjs.append(objtext.Text('Game Over')) for g in self.guardobjs: if not g.killed: g.killed = 1 explode = objexplode.Explode(g.rect.center) self.staticobjs.append(explode) #argh, force a cleanup self.background(g.lastrect) gfx.dirty(g.lastrect)
def __init__(self, prevhandler, helpname, helppos): self.prevhandler = prevhandler self.helpname = helpname self.helppos = helppos self.time = 0.0 self.img = None self.rect = None self.needdraw = 1 self.done = 0 if snd.music: vol = snd.music.get_volume() if vol: snd.music.set_volume(vol * 0.6) snd.play('chimein')
def start(self): snd.play('explode', 1.0, 350) aliveguards = [] for g in self.state.guardobjs: if not g.killed: aliveguards.append(g) if aliveguards: g = random.choice(aliveguards) g.killed = 1 explode = objexplode.Explode(g.rect.center) self.state.staticobjs.append(explode) #argh, force a cleanup self.state.background(g.lastrect) gfx.dirty(g.lastrect)
def input(self, event): """ Detecta os eventos associados a este menu. Parametros: event - Evento detectado no loop principal do jogo. """ if event.type == KEYUP: return if event.key == K_ESCAPE: snd.play('select_choose') self.quit() elif event.key == K_UP or event.key == K_LEFT: #Desloca a selecao para cima self.current = (self.current - 1)%len(menu) self.clearoption() self.selectrect.top = menu[self.current].rect.top + 5 snd.play('select_move') elif event.key == K_DOWN or event.key == K_RIGHT: #Desloca a selecao para baixo self.current = (self.current + 1)%len(menu) self.clearoption() self.selectrect.top = menu[self.current].rect.top + 5 snd.play('select_move') elif event.key == K_RETURN: #Realiza a acao associada ao item do menu self.workbutton() snd.play('select_choose')
def playercollide(self, rect): if self.touching: self.touching = self.rect.colliderect(rect) return 0 elif self.touches and self.rect.colliderect(rect): self.touches -= 1 if self.touches: self.firsttouch = 4.0 self.touching = 1 snd.play('yboxhit', 1.0, self.rect.centerx) return 2 self.firsttouch = 2.0 snd.play('boxhit', 1.0, self.rect.centerx) return 1 return 0
def start(self): snd.play('explode', 1.0, 350) aliveguards = [] for g in self.state.guardobjs: if not g.killed: aliveguards.append(g) if aliveguards: g = random.choice(aliveguards) g.killed = 1 laser = objlaser.Laser(self.state.player.rect.center, g.rect.center) self.state.staticobjs.append(laser) explode = objexplode.Explode(g.rect.center) self.state.staticobjs.append(explode) #argh, force a cleanup self.state.background(g.lastrect) gfx.dirty(g.lastrect)
def pressed(self): pref, vals = self.prefs[self.current[0]] if not pref: snd.play('select_choose') self.done = 1 else: val = self.current[1] oldval = getattr(game, pref) if oldval == val: return setattr(game, pref, val) self.buildlist() #some of these need callbacks, music/volume/display if hasattr(self, "do_" + pref): getattr(self, "do_" + pref)() snd.play('select_choose')
def pressed(self): pref, vals = self.prefs[self.current[0]] if not pref: snd.play("select_choose") self.done = 1 else: val = self.current[1] oldval = getattr(game, pref) if oldval == val: return setattr(game, pref, val) self.buildlist() # some of these need callbacks, music/volume/display if hasattr(self, "do_" + pref): getattr(self, "do_" + pref)() snd.play("select_choose")
def levelend_start(self): snd.play('levelfinish') self.popobjs.append(objwarp.Warp(self.player.rect.center)) self.player.dead = 1 self.player.active = 0 self.poptime = 2 for effect in self.powereffects: effect.dead = 1 if game.comments >= 1 and self.grabbedboxes >= 25: self.textobjs.append(objtext.Text(game.Complements[self.complement])) self.complement = (self.complement + 1) % len(game.Complements) for s in self.spikeobjs: s.dead = 1 self.popobjs.append(objpopshot.PopShot(s.rect.center)) #boxes may be left if the player cheated for b in self.boxobjs: b.erase(self.background) del self.boxobjs[:]
def levelend_start(self): snd.play("levelfinish") self.popobjs.append(objwarp.Warp(self.player.rect.center)) self.player.dead = 1 self.player.active = 0 self.poptime = 2 for effect in self.powereffects: effect.dead = 1 if game.comments >= 1 and self.grabbedboxes >= 25: self.textobjs.append(objtext.Text(game.Complements[self.complement])) self.complement = (self.complement + 1) % len(game.Complements) for s in self.spikeobjs: s.dead = 1 self.popobjs.append(objpopshot.PopShot(s.rect.center)) # boxes may be left if the player cheated for b in self.boxobjs: b.erase(self.background) del self.boxobjs[:]
def input(self, event): """ Detecta os eventos associados a este menu. Parametros: event - Evento detectado no loop principal do jogo. """ if event.type == KEYUP: return if self.done: return if event.key == K_ESCAPE: self.aborted = 1 self.done = 1 self.current[0] = -1 self.clearlist() self.moveto((2, 2)) snd.play('select_choose') #Detecta a selecao de uma opcao do menu if event.key == K_RETURN: return self.pressed() if event.key in (K_DOWN, K_UP, K_LEFT, K_RIGHT): #Seleciona um item do menu... if event.key == K_DOWN: self.current[0] = (self.current[0] + 1) % len(self.gamelist) self.current[1] = min(self.current[1], len(self.gamelist[self.current[0]]) - 1) elif event.key == K_UP: self.current[0] = (self.current[0] - 1) % len(self.gamelist) self.current[1] = min(self.current[1], len(self.gamelist[self.current[0]]) - 1) elif event.key == K_LEFT: self.current[1] = (self.current[1] - 1) % len( self.gamelist[self.current[0]]) else: self.current[1] = (self.current[1] + 1) % len( self.gamelist[self.current[0]]) snd.play('select_move') x = self.gamelist[self.current[0]][self.current[1]][1].left y = self.gamelist[self.current[0]][self.current[1]][1].top #e desloca a seta de selecao para a posicao #selecionada. self.moveto((x, y))
def pressed(self): g = self.gamelist[self.current[0]] p = players.find_player(g[0]) if self.current[1] == 0: snd.play('select_choose') if not p: p = players.Player('') global lastplayer lastplayer = p game.player = p self.clearlist() self.moveto((860, 500)) self.done = 1 else: snd.play('delete') players.players.remove(p) self.buildlist() self.current = [0, 0] self.moveto((120, 110))
def pressed(self): """ Realiza a acao de pressionamento de uma opcao do menu, aplicando a prefe rencia escolhida pelo usuario """ pref, vals = self.prefs[self.current[0]] if not pref: snd.play('select_choose') self.done = 1 else: val = self.current[1] oldval = getattr(game, pref) if oldval == val: return setattr(game, pref, val) self.buildlist() if hasattr(self, "do_" + pref): getattr(self, "do_" + pref)() snd.play('select_choose')
def playerdie_start(self): game.player.lives += 1 snd.play('explode', 1.0, self.player.rect.centerx) #self.explode = objexplode.Explode(self.player.rect.center, self.player.move) #self.staticobjs.append(self.explode) self.staticobjs.extend(objexplode.superexplode(self.player.rect.center, self.player.move)) self.explode = self.staticobjs[-1] self.poptime = 3 self.player.dead = 1 self.player.active = 0 self.grabbedboxes = 0 self.numdeaths += 1 if game.comments >= 2 and len(self.boxobjs) <= 2: self.textobjs.append(objtext.Text('Doh, so close')) elif game.comments >= 2 and self.numdeaths > 1: self.textobjs.append(objtext.Text(game.Insults[self.complement])) self.complement = (self.complement + 1) % len(game.Insults) for effect in self.powereffects: effect.dead = 1 for b in self.guardobjs: b.nofire()
def playerdie_start(self): game.player.lives += 1 snd.play("explode", 1.0, self.player.rect.centerx) # self.explode = objexplode.Explode(self.player.rect.center, self.player.move) # self.staticobjs.append(self.explode) self.staticobjs.extend(objexplode.superexplode(self.player.rect.center, self.player.move)) self.explode = self.staticobjs[-1] self.poptime = 3 self.player.dead = 1 self.player.active = 0 self.grabbedboxes = 0 self.numdeaths += 1 if game.comments >= 2 and len(self.boxobjs) <= 2: self.textobjs.append(objtext.Text("Doh, so close")) elif game.comments >= 2 and self.numdeaths > 1: self.textobjs.append(objtext.Text(game.Insults[self.complement])) self.complement = (self.complement + 1) % len(game.Insults) for effect in self.powereffects: effect.dead = 1 for b in self.guardobjs: b.nofire()
def input(self, event): """ Detecta os eventos associados a este menu. Parametros: event - Evento detectado no loop principal do jogo. """ if event.type == KEYUP: return if self.done: return if event.key == K_ESCAPE: self.aborted = 1 self.done = 1 self.current[0] = -1 self.clearlist() self.moveto((2, 2)) snd.play('select_choose') #Detecta a selecao de uma opcao do menu if event.key == K_RETURN: return self.pressed() if event.key in (K_DOWN, K_UP, K_LEFT, K_RIGHT): #Seleciona um item do menu... if event.key == K_DOWN: self.current[0] = (self.current[0]+1) % len(self.gamelist) self.current[1] = min(self.current[1], len(self.gamelist[self.current[0]])-1) elif event.key == K_UP: self.current[0] = (self.current[0]-1) % len(self.gamelist) self.current[1] = min(self.current[1], len(self.gamelist[self.current[0]])-1) elif event.key == K_LEFT: self.current[1] = (self.current[1]-1) % len(self.gamelist[self.current[0]]) else: self.current[1] = (self.current[1]+1) % len(self.gamelist[self.current[0]]) snd.play('select_move') x = self.gamelist[self.current[0]][self.current[1]][1].left y = self.gamelist[self.current[0]][self.current[1]][1].top #e desloca a seta de selecao para a posicao #selecionada. self.moveto((x, y))
def input(self, i): if i.release: return if self.switchclock: return if i.translated == input.LEFT: self.current = (self.current - 1)%len(menu) snd.play('select_move') elif i.translated == input.RIGHT: self.current = (self.current + 1)%len(menu) snd.play('select_move') elif i.translated == input.PRESS: self.workbutton() snd.play('select_choose') elif i.translated == input.ABORT: snd.play('select_choose') self.quit()
def input(self, i): if self.done: return if i.release: return if i.translated == input.ABORT: self.aborted = 1 self.done = 1 snd.play('select_choose') self.quit() if i.translated == input.PRESS: return self.pressed() if i.translated in (input.DOWN, input.UP): if i.translated == input.DOWN: self.current = (self.current+1) % len(self.gamelist) else: self.current = (self.current-1) % len(self.gamelist) snd.play('select_move') x = self.gamelist[self.current][1].left y = self.gamelist[self.current][1].top self.moveto((x, y)) self.buildlist()
def input(self, i): if i.release: return if self.inputstate == DONE: return self.displayevent(i) #APS switch done to the inputstate if self.inputstate == BUTTONS: if i.translated == input.ABORT: self.quit() if i.translated == input.PRESS: if self.currentbutton == 0: self.selectadd() #elif self.currentbutton == 1: # self.selectall() else: self.selectdelete() if i.translated in ( input.DOWN, input.UP, input.LEFT, input.RIGHT): if i.translated == input.DOWN: self.currentaction = (self.currentaction + 1) % len(self.actionlist) elif i.translated == input.UP: self.currentaction = (self.currentaction - 1) % len(self.actionlist) elif i.translated == input.LEFT: self.currentbutton = (self.currentbutton - 1) % len(self.buttonlist) elif i.translated == input.RIGHT: self.currentbutton = (self.currentbutton + 1) % len(self.buttonlist) snd.play('select_move') self.moveto(self.targetbutton()) elif self.inputstate == DELETING: if i.translated == input.ABORT: snd.play('select_choose') self.inputstate = BUTTONS self.moveto(self.targetbutton()) if i.translated == input.PRESS: self.delete() if i.translated in ( input.DOWN, input.UP, input.LEFT, input.RIGHT): if i.translated == input.DOWN or i.translated == input.UP: currentcontrol = (self.currentcontrol + 6) % 12 if currentcontrol < len(self.display[input.actions_order[self.currentaction]]): self.currentcontrol = currentcontrol elif i.translated == input.LEFT: self.currentcontrol = (self.currentcontrol - 1) % 6 + 6 * (self.currentcontrol / 6) if self.currentcontrol >= len(self.display[input.actions_order[self.currentaction]]): self.currentcontrol = len(self.display[input.actions_order[self.currentaction]]) - 1 elif i.translated == input.RIGHT: self.currentcontrol = (self.currentcontrol + 1) % 6 + 6 * (self.currentcontrol / 6) if self.currentcontrol >= len(self.display[input.actions_order[self.currentaction]]): self.currentcontrol = 6 * (self.currentcontrol / 6) snd.play('select_move') self.moveto(self.targetcontrol()) pass elif self.inputstate == ADDING: self.add(i)