def keyrelease(self, k): s = variables.playerspeed t = variables.settings.current_time if variables.checkkey("left", k): self.leftpresstime = 0 self.lastxupdate = t if self.rightpresstime == 0: self.xspeed = 0 else: self.xspeed = s elif variables.checkkey("right", k): self.rightpresstime = 0 self.lastxupdate = t if self.leftpresstime == 0: self.xspeed = 0 else: self.xspeed = -s elif variables.checkkey("up", k): self.lastyupdate = t self.uppresstime = 0 if self.downpresstime == 0: self.yspeed = 0 else: self.yspeed = s elif variables.checkkey("down", k): self.lastyupdate = t self.downpresstime = 0 if self.uppresstime == 0: self.yspeed = 0 else: self.yspeed = -s self.change_animation()
def onrelease(self, key): if variables.checkkey("up", key): self.uptime = None elif variables.checkkey("down", key): self.downtime = None elif variables.checkkey("left", key): self.lefttime = None elif variables.checkkey("right", key): self.righttime = None
def on_key(key): if variables.checkkey("enter", key): e = current_map.checkexit() c = current_map.checkconversation() #if c: # print(c.storyevent) #print(classvar.player.storyevents) # check for conversations first if not c == False: engage_conversation(c.name) elif not e == False: engage_exit(e) if variables.checkkey("zoom", key): variables.settings.updatezoom(variables.displayscale) variables.dirtyrects = [Rect(0, 0, variables.width, variables.height)]
def on_key(key): if variables.checkkey("enter", key): e = current_map.checkexit() c = current_map.checkconversation() #if c: # print(c.storyevent) #print(classvar.player.storyevents) # check for conversations first if not c == False: engage_conversation(c.name) elif not e == False: engage_exit(e) if variables.checkkey("zoom", key): variables.settings.updatezoom(variables.displayscale) variables.dirtyrects = [Rect(0,0,variables.width,variables.height)]
def onkeydown(key): # emergency dev quit if devoptions.devmode and key == devoptions.devquitkey: pygame.quit() sys.exit() # check if the player is pausing the game elif variables.checkkey("escape", key) and not variables.settings.menuonq: menu.pause() # menu press, also check exiting from the menu, saving from menu elif variables.settings.menuonq: if variables.checkkey("enter", key) and menu.state == "main": if menu.getoption() == "exit": global done done = True elif menu.getoption() == "save": save(True) variables.saved = True else: menu.onkey(key) else: menu.onkey(key) # check for dev battle key elif devoptions.devmode and key == devoptions.devengagebattlekey and variables.settings.state == "world": if devbattletest == None: initiatebattle(random_enemy()) else: initiatebattle(devbattletest) # process key in minigame elif variables.settings.state == "game" and not variables.settings.menuonq: variables.currentgame().keydownfunction(variables.settings.current_time, variables.settings, key) elif variables.settings.state == "conversation" and conversations.currentconversation != None: message = conversations.currentconversation.keyevent(key) menu.setmessage(message) # check if it was exited to unhide rocks if variables.settings.state == "world": maps.unhiderock(conversations.currentconversation.unhidethisrock) elif variables.settings.state == "world": if maps.playerenabledp() and maps.current_map.playerenabledp: classvar.player.keypress(key) maps.on_key(key) elif variables.settings.state == "battle": classvar.battle.onkey(key)
def onkeymain(self, key): optionslength = len(self.options()) if variables.checkkey("up", key): self.option = (self.option - 1) % optionslength elif variables.checkkey("down", key): self.option = (self.option + 1) % optionslength elif variables.checkkey("enter", key): if self.getoption() in ["resume", "play"]: self.resume() if self.getoption() == "settings": self.state = "settings" self.settingsmenu.newworkingcopy() if self.getoption() == "leave game": returntoworld() self.resume()
def onrelease(self, key): def check_note(np): if self.notes[np].end_score == None and self.notes[ np].beginning_score != None: top_of_note = self.notes[np].pos[1] - self.notes[np].height( self.tempo) s = self.pos_to_score(top_of_note) if s == None and self.notes[np].beginning_score != None: s = variables.miss_value self.notes[np].height_offset = self.notes[np].pos[ 1] - variables.getpadypos() if s != None: self.process_final_score(self.notes[np], s) # potential hard mode: released before a note a miss def check_place(v): np = self.get_note_place_from_value_end(v) if not np == None: check_note(np) # potential hard mode: make a press without a note a miss for x in range(8): if variables.checkkey("note" + str(x + 1), key): # do the same for both modified and unmodified keys for check place, only start matters check_place(x) if self.held_keys[x] != None: stop_tone(self.held_keys[x]) self.held_keys[x] = None break elif variables.checkkey("note" + str(x + 1) + "modified", key): check_place(x) if self.modifierheldkeys[x] != None: stop_tone(self.modifierheldkeys[x]) self.modifierheldkeys[x] = None break if variables.checkkey("notemodifier", key): self.spacepressedp = False
def keypress(self, k): t = variables.settings.current_time s = variables.playerspeed if variables.checkkey("left", k): self.leftpresstime = variables.settings.current_time self.xspeed = -s self.lastxupdate = t - 16 if variables.checkkey("right", k): self.rightpresstime = variables.settings.current_time self.lastxupdate = t - 16 self.xspeed = s if variables.checkkey("up", k): self.uppresstime = variables.settings.current_time self.yspeed = -s self.lastyupdate = t - 16 if variables.checkkey("down", k): self.downpresstime = variables.settings.current_time self.yspeed = s self.lastyupdate = t - 16 self.change_animation()
def onrelease(self, key): def check_note(np): if self.notes[np].end_score == None and self.notes[np].beginning_score != None: top_of_note = self.notes[np].pos[1] - self.notes[np].height(self.tempo) s = self.pos_to_score(top_of_note) if s == None and self.notes[np].beginning_score != None: s = variables.miss_value self.notes[np].height_offset = self.notes[np].pos[1] - variables.getpadypos() if s != None: self.process_final_score(self.notes[np], s) # potential hard mode: released before a note a miss def check_place(v): np = self.get_note_place_from_value_end(v) if not np == None: check_note(np) # potential hard mode: make a press without a note a miss for x in range(8): if variables.checkkey("note" + str(x+1), key): # do the same for both modified and unmodified keys for check place, only start matters check_place(x) if self.held_keys[x] != None: stop_tone(self.held_keys[x]) self.held_keys[x] = None break elif variables.checkkey("note" + str(x+1) + "modified", key): check_place(x) if self.modifierheldkeys[x] != None: stop_tone(self.modifierheldkeys[x]) self.modifierheldkeys[x] = None break if variables.checkkey("notemodifier", key): self.spacepressedp = False
def keypress(self, key): choice = None if self.line < len(self.dialogue) - variables.getlinesinscreen(): self.line += 1 return "talking" # if there is a choice to be made elif self.choicebuttons != None: if self.state == "talking": self.state = "choosing" elif self.state == "choosing": self.choicebuttons.leftrightonkey(key) if variables.checkkey("enter", key): choice = self.choicebuttons.getoption() self.state = "done" # if there is a specialexitkey, only exit if it is pressed elif self.specialexitkeys != None: keypressedp = False for keytype in self.specialexitkeys: if variables.checkkey(keytype, key): keypressedp = True break if keypressedp: self.state = "done" elif variables.checkkey("enter", key): self.state = "done" returnstate = self.state if self.state == "done": if choice in [None, "y", "yes"]: if self.special_battle != "none": initiatebattle(self.special_battle) returnstate = "specialbattle" self.reset() return returnstate
def keypress(self, key): choice = None if self.line < len(self.dialogue) - variables.getlinesinscreen(): self.line += 1 return "talking" # if there is a choice to be made elif self.choicebuttons != None: if self.state == "talking": self.state = "choosing" elif self.state == "choosing": self.choicebuttons.leftrightonkey(key) if variables.checkkey("enter", key): choice = self.choicebuttons.getoption() self.state = "done" # if there is a specialexitkey, only exit if it is pressed elif self.specialexitkeys != None: keypressedp = False for keytype in self.specialexitkeys: if variables.checkkey(keytype, key): keypressedp = True break if keypressedp: self.state = "done" elif variables.checkkey("enter", key): self.state = "done" returnstate = self.state if self.state == "done": if choice in [None, "y", "yes"]: if self.special_battle != "none": initiatebattle.initiatebattle(self.special_battle) returnstate = "specialbattle" self.reset() return returnstate
def onrelease(self, key): releasep = False if self.state == "dance": if self.tutorialp: if (variables.checkkey("note1", key) and not self.accidentaltutorialp) or (variables.checkkey("note1modified", key) and self.accidentaltutorialp): if self.tutorialstate == "first note": pass elif self.tutorialstate == "release note": maps.engage_conversation(self.tutorialconversations[4], True) else: releasep = True else: releasep = True else: releasep = True if releasep: # check for octopus animation change if self.drummermodep(): for noteindex in range(8): if variables.checkkey("note" + str(noteindex+1), key): self.enemy.animation.change_frame(variables.octopusarmtomultipartpart[noteindex], newframe = 0) self.beatmaps[self.current_beatmap].onrelease(key)
def onkey(self, key): if self.state in ["main"]: play_effect("onedrum") if self.state == "main": if variables.checkkey("escape", key): self.resume() else: self.onkeymain(key) elif self.state == "settings": message = self.settingsmenu.onkey(key) if message != "confirmed without change": self.setmessage(message) if message == "confirmed new settings" or message == "confirmed without change": self.state = "main" else: self.onkeyname(key)
def leftrightonkey(self, key): if variables.checkkey("left", key): self.previousoption() elif variables.checkkey("right", key): self.nextoption()
def onkey(self, key): play_effect("onedrum", volumeoverride = self.workingcopy.volume) if self.state == "main": message = None optionslist = self.getoptionlist() optionslength = len(optionslist) # if on the back button bindingslength = len(self.getcurrentoptionbindings()) + 2 if bindingslength == 2: bindingslength = 0 if optionslist[self.option] == "mode": bindingslength = len(self.windowmodes) if optionslist[self.option] in self.toggleoptions: bindingslength = 1 if variables.checkkey("up", key): self.uptime = variables.settings.current_time if self.option <= 0: self.scroll = optionslength-self.linesperscreen() self.option = (self.option - 1) % optionslength if self.option < self.scroll: self.scroll -= 1 if bindingslength == 0: self.bindingoption = 0 else: self.bindingoption = min(bindingslength-1, self.bindingoption) elif variables.checkkey("down", key): self.downtime = variables.settings.current_time if self.option >= optionslength-1: self.scroll = 0 self.option = (self.option + 1) % optionslength if self.option > self.scroll + self.linesperscreen()-1: self.scroll += 1 bindlength = len(self.getcurrentoptionbindings()) if bindingslength == 0: self.bindingoption = 0 else: self.bindingoption = min(bindingslength-1, self.bindingoption) elif variables.checkkey("left", key): self.lefttime = variables.settings.current_time if bindingslength > 0: self.bindingoption = (self.bindingoption - 1) % bindingslength if optionslist[self.option] == "volume": self.changevolume(-1) elif variables.checkkey("right", key): self.righttime = variables.settings.current_time if bindingslength > 0: self.bindingoption = (self.bindingoption + 1) % bindingslength if optionslist[self.option] == "volume": self.changevolume(1) elif variables.checkkey("enter", key): if bindingslength-1 > self.bindingoption > 0: self.initiatekeychange() elif optionslist[self.option] == "back": message = self.initiateconfirm() elif optionslist[self.option] == "mode": self.changewindowmode() elif optionslist[self.option] in self.toggleoptions: self.changingcopy() varname = self.toggleoptionsvars[self.toggleoptions.index(optionslist[self.option])] oldval = getattr(self.workingcopy, varname) setattr(self.workingcopy, varname, not oldval) elif self.bindingoption == 0: self.deleteonebinding() elif self.bindingoption == bindingslength-1: message = self.addonebinding() elif variables.checkkey("escape", key): message = self.initiateconfirm() return message elif self.state == "keychange": current = self.getcurrentoptionbindings() current[self.bindingoption-1] = key self.exitkeychange() return None # for confirming, we use the temporary controls elif self.state == "confirm": message = None def checkkeyworkingcopy(name, key): if name == "enter": name = "action" # to make things easier return key in self.workingcopy.keydict[name] if checkkeyworkingcopy("left", key): self.uptime = variables.settings.current_time self.confirmoption = (self.confirmoption - 1) % 2 elif checkkeyworkingcopy("right", key): self.downtime = variables.settings.current_time self.confirmoption = (self.confirmoption + 1) % 2 elif checkkeyworkingcopy("enter", key): if self.confirmoption == 1: self.notconfirm() elif self.confirmoption == 0: # put the working copy into effect message = self.implementnewsettings() self.exitsettingsmenu() return message
def onkeyname(self, key): if variables.checkkey("enter", key) and (key != pygame.K_SPACE or self.option != 0): if len(self.namestring) != 0 or self.option>1: # self.namestring = self.namestring[:1].upper() + self.namestring[1:] if self.option == 0: variables.settings.username = self.namestring if variables.settings.username.lower() == "tessa": self.setmessage("<3") elif variables.settings.username.lower() == "2j": self.setmessage("green beans my friend") elif variables.settings.username.lower() == "oliver": self.setmessage("hey that's me") elif variables.settings.username.lower() == "sophie" or variables.settings.username.lower() == "sophia": self.setmessage("heyo, have fun") elif self.option == 1: variables.settings.bearname = self.namestring self.namestring = "" if self.nameprompts[self.option] == "Confirm difficulty level ": if self.yesno.getoption() in ["n","no","NO"]: self.option -= 2 else: variables.settings.difficulty = self.tempdifficulty classvar.player.exp = stathandeling.lvexp(self.tempdifficulty + 1) if self.option == len(self.nameprompts)-1: # check if bear needs to be woken up if player.getstoryevent("bed") < len(maps.getbed().animations)-1: maps.getbed().nextanimation() player.addstoryevent("bed") if player.getstoryevent("bed") == len(maps.getbed().animations)-1: self.mainmenup = False self.resume() else: self.mainmenup = False self.resume() else: self.option += 1 elif key in [pygame.K_LSHIFT, pygame.K_RSHIFT]: self.shifton = True elif key in [pygame.K_BACKSPACE]: self.namestring = self.namestring[:-1] self.tempdifficulty = int(self.tempdifficulty/10) self.backspaceon = True self.backspacetime = variables.settings.current_time elif len(self.namestring) < 20 and not variables.checkkey("escape", key) and self.option <2: toadd = pygame.key.name(key) if toadd == "space": toadd = " " elif self.shifton: toadd = toadd.upper() self.namestring = self.namestring + toadd elif self.option == 2: numentered = keytonum(key) if not numentered == None: if self.tempdifficulty == 0: self.tempdifficulty = numentered else: self.tempdifficulty = self.tempdifficulty * 10 + numentered elif variables.checkkey("up", key): self.tempdifficulty += 1 elif variables.checkkey("down", key) and self.tempdifficulty > 0: self.tempdifficulty -= 1 if self.tempdifficulty > variables.maxdifficulty: self.tempdifficulty = variables.maxdifficulty elif self.nameprompts[self.option] == "Confirm difficulty level ": self.yesno.leftrightonkey(key)
def onkey(self, key): def change_soundpack(offset): i = classvar.player.soundpacks.index(variables.settings.soundpack) variables.settings.soundpack = classvar.player.soundpacks[(i + offset) % len(classvar.player.soundpacks)] self.battlechoice.buttons[-2].assign_text(variables.settings.soundpack) def change_scale(offset): variables.settings.scaleindex = (variables.settings.scaleindex + offset) % len(classvar.player.scales) self.battlechoice.buttons[-1].assign_text(self.getscalename()) if(devoptions.devmode): if(key == devoptions.devlosebattlekey): self.flee() elif(key == devoptions.devwinbattlekey): self.win() if self.state == 'dance': if self.tutorialp: if not self.tutorialstate == "first note" or (not variables.checkkey("note1", key) and not variables.checkkey("note1modified", key)): self.beatmaps[self.current_beatmap].onkey(key) else: self.beatmaps[self.current_beatmap].onkey(key) # check for octopus animation change if self.drummermodep(): for noteindex in range(8): if variables.checkkey("note" + str(noteindex+1), key): self.enemy.animation.change_frame(variables.octopusarmtomultipartpart[noteindex], newframe = 1) elif self.state == "choose": if variables.checkkey("enter", key): if self.battlechoice.currentoption == 0: self.startnew() elif self.battlechoice.currentoption == 1: self.flee() elif self.battlechoice.currentoption == 2: change_soundpack(1) elif self.battlechoice.currentoption == 3: change_scale(1) else: if variables.checkkey("left", key): play_drum(4, self.enemy.drumpackname) self.battlechoice.previousoption() elif variables.checkkey("right", key): play_drum(4, self.enemy.drumpackname) self.battlechoice.nextoption() elif variables.checkkey("up", key) and self.battlechoice.currentoption == 2: change_soundpack(-1) elif variables.checkkey("down", key) and self.battlechoice.currentoption == 2: change_soundpack(1) elif variables.checkkey("up", key) and self.battlechoice.currentoption == 3: change_scale(-1) elif variables.checkkey("down", key) and self.battlechoice.currentoption == 3: change_scale(1) elif self.state == "exp": self.togotexp() elif self.state == "lose": if variables.checkkey("enter", key): if self.retrychoice.getoption() == "retry": self.startnew() else: self.flee() else: self.retrychoice.leftrightonkey(key) elif self.state == "win" and variables.checkkey("enter", key): self.addexp() elif self.state == "got exp" and variables.checkkey("enter", key): self.win()
def onkey(self, key): def check_note(np, modifiedp): if self.notes[np].beginning_score == None: s = self.pos_to_score(self.notes[np].pos[1] - variables.getpadheight()) if s != None: # check if modifier is correct if not self.notes[np].accidentalp == modifiedp: s = variables.miss_value self.notes[np].beginning_score = s # just process right away if dancepadmode if variables.settings.dancepadmodep: self.process_final_score(self.notes[np], s) # also if it missed, process right away elif s == variables.miss_value: self.process_final_score(self.notes[np], s) # returns the value for the sound produced def check_place(v, modifiedp): placeandvalue = self.get_note_place_from_value_begin(v) np = placeandvalue[0] if not np == None: check_note(np, modifiedp) return placeandvalue[1] def simple_value_in_key(v): av = abs(v) sound_value = 0 if (v < 0): for x in range(av): sound_value -= self.scale[6 - (x % 7)] else: for x in range(av): sound_value += self.scale[x % 7] return sound_value def playnotepressed(kp, modifiedp): v = check_place(kp, modifiedp) v = simple_value_in_key(v) if self.spacepressedp or modifiedp: v += 1 play_tone(v, self.enemyspecs["volumeenvelope"], self.numofupdatetones) self.numofupdatetones += 1 if modifiedp: self.modifierheldkeys[kp] = v else: self.held_keys[kp] = v for x in range(8): if variables.checkkey("note" + str(x + 1), key): playnotepressed(x, self.spacepressedp) break if variables.checkkey("notemodifier", key): self.spacepressedp = True for x in range(8): if variables.checkkey("note" + str(x + 1) + "modified", key): playnotepressed(x, True)
def onkey(self, key): play_effect("onedrum", volumeoverride=self.workingcopy.volume) if self.state == "main": message = None optionslist = self.getoptionlist() optionslength = len(optionslist) # if on the back button bindingslength = len(self.getcurrentoptionbindings()) + 2 if bindingslength == 2: bindingslength = 0 if optionslist[self.option] == "mode": bindingslength = len(self.windowmodes) if optionslist[self.option] in self.toggleoptions: bindingslength = 1 if variables.checkkey("up", key): self.uptime = variables.settings.current_time if self.option <= 0: self.scroll = optionslength - self.linesperscreen() self.option = (self.option - 1) % optionslength if self.option < self.scroll: self.scroll -= 1 if bindingslength == 0: self.bindingoption = 0 else: self.bindingoption = min(bindingslength - 1, self.bindingoption) elif variables.checkkey("down", key): self.downtime = variables.settings.current_time if self.option >= optionslength - 1: self.scroll = 0 self.option = (self.option + 1) % optionslength if self.option > self.scroll + self.linesperscreen() - 1: self.scroll += 1 bindlength = len(self.getcurrentoptionbindings()) if bindingslength == 0: self.bindingoption = 0 else: self.bindingoption = min(bindingslength - 1, self.bindingoption) elif variables.checkkey("left", key): self.lefttime = variables.settings.current_time if bindingslength > 0: self.bindingoption = (self.bindingoption - 1) % bindingslength if optionslist[self.option] == "volume": self.changevolume(-1) elif variables.checkkey("right", key): self.righttime = variables.settings.current_time if bindingslength > 0: self.bindingoption = (self.bindingoption + 1) % bindingslength if optionslist[self.option] == "volume": self.changevolume(1) elif variables.checkkey("enter", key): if bindingslength - 1 > self.bindingoption > 0: self.initiatekeychange() elif optionslist[self.option] == "back": message = self.initiateconfirm() elif optionslist[self.option] == "mode": self.changewindowmode() elif optionslist[self.option] in self.toggleoptions: self.changingcopy() varname = self.toggleoptionsvars[self.toggleoptions.index( optionslist[self.option])] oldval = getattr(self.workingcopy, varname) setattr(self.workingcopy, varname, not oldval) elif self.bindingoption == 0: self.deleteonebinding() elif self.bindingoption == bindingslength - 1: message = self.addonebinding() elif variables.checkkey("escape", key): message = self.initiateconfirm() return message elif self.state == "keychange": current = self.getcurrentoptionbindings() current[self.bindingoption - 1] = key self.exitkeychange() return None # for confirming, we use the temporary controls elif self.state == "confirm": message = None def checkkeyworkingcopy(name, key): if name == "enter": name = "action" # to make things easier return key in self.workingcopy.keydict[name] if checkkeyworkingcopy("left", key): self.uptime = variables.settings.current_time self.confirmoption = (self.confirmoption - 1) % 2 elif checkkeyworkingcopy("right", key): self.downtime = variables.settings.current_time self.confirmoption = (self.confirmoption + 1) % 2 elif checkkeyworkingcopy("enter", key): if self.confirmoption == 1: self.notconfirm() elif self.confirmoption == 0: # put the working copy into effect message = self.implementnewsettings() self.exitsettingsmenu() return message
def onkey(self, key): def change_soundpack(offset): i = classvar.player.soundpacks.index(variables.settings.soundpack) variables.settings.soundpack = classvar.player.soundpacks[(i + offset) % len(classvar.player.soundpacks)] self.battlechoice.buttons[-2].assign_text(variables.settings.soundpack) def change_scale(offset): variables.settings.scaleindex = (variables.settings.scaleindex + offset) % len(classvar.player.scales) self.battlechoice.buttons[-1].assign_text(self.getscalename()) if(variables.devmode): if(key == variables.devlosebattlekey): self.lose() elif(key == variables.devwinbattlekey): self.win() if self.state == 'dance': if self.tutorialp: if not self.tutorialstate == "first note" or (not variables.checkkey("note1", key) and not variables.checkkey("note1modified", key)): self.beatmaps[self.current_beatmap].onkey(key) else: self.beatmaps[self.current_beatmap].onkey(key) # check for octopus animation change if self.drummermodep(): for noteindex in range(8): if variables.checkkey("note" + str(noteindex+1), key): self.enemy.animation.change_frame(variables.octopusarmtomultipartpart[noteindex], newframe = 1) elif self.state == "choose": if variables.checkkey("enter", key): if self.battlechoice.current_option == 0: self.startnew() elif self.battlechoice.current_option == 1: self.flee() elif self.battlechoice.current_option == 2: change_soundpack(1) elif self.battlechoice.current_option == 3: change_scale(1) else: if variables.checkkey("left", key): play_drum(4, self.enemy.drumpackname) self.battlechoice.previousoption() elif variables.checkkey("right", key): play_drum(4, self.enemy.drumpackname) self.battlechoice.nextoption() elif variables.checkkey("up", key) and self.battlechoice.current_option == 2: change_soundpack(-1) elif variables.checkkey("down", key) and self.battlechoice.current_option == 2: change_soundpack(1) elif variables.checkkey("up", key) and self.battlechoice.current_option == 3: change_scale(-1) elif variables.checkkey("down", key) and self.battlechoice.current_option == 3: change_scale(1) elif self.state == "lose": if variables.checkkey("enter", key): if self.retrychoice.getoption() == "retry": self.startnew() else: self.lose() else: self.retrychoice.leftrightonkey(key) elif self.state == "win" and variables.checkkey("enter", key): self.addexp() elif self.state == "got exp" and variables.checkkey("enter", key): self.win()
def onkey(self, key): def check_note(np, modifiedp): if self.notes[np].beginning_score == None: s = self.pos_to_score(self.notes[np].pos[1] - padheight) if s != None: # check if modifier is correct if not self.notes[np].accidentalp == modifiedp: s = variables.miss_value self.notes[np].beginning_score = s # just process right away if dancepadmode if variables.settings.dancepadmodep: self.process_final_score(self.notes[np], s) # also if it missed, process right away elif s == variables.miss_value: self.process_final_score(self.notes[np], s) # returns the value for the sound produced def check_place(v, modifiedp): placeandvalue = self.get_note_place_from_value_begin(v) np = placeandvalue[0] if not np == None: check_note(np, modifiedp) return placeandvalue[1] def simple_value_in_key(v): av = abs(v) sound_value = 0 if (v < 0): for x in range(av): sound_value -= self.scale[6 - (x % 7)] else: for x in range(av): sound_value += self.scale[x % 7] return sound_value def playnotepressed(kp, modifiedp): v = check_place(kp, modifiedp) v = simple_value_in_key(v) if self.spacepressedp or modifiedp: v += 1 play_tone(v, self.enemyspecs["volumeenvelope"], self.numofupdatetones) self.numofupdatetones += 1 if modifiedp: self.modifierheldkeys[kp] = v else: self.held_keys[kp] = v for x in range(8): if variables.checkkey("note" + str(x+1), key): playnotepressed(x, self.spacepressedp) break if variables.checkkey("notemodifier", key): self.spacepressedp = True for x in range(8): if variables.checkkey("note" + str(x+1) + "modified", key): playnotepressed(x, True)