当前位置: 首页>>代码示例>>Python>>正文


Python sound.play_effect方法代码示例

本文整理汇总了Python中sound.play_effect方法的典型用法代码示例。如果您正苦于以下问题:Python sound.play_effect方法的具体用法?Python sound.play_effect怎么用?Python sound.play_effect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sound的用法示例。


在下文中一共展示了sound.play_effect方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: update

# 需要导入模块: import sound [as 别名]
# 或者: from sound import play_effect [as 别名]
def update(self):
    if self.animation_state == 'moving':
      if self.animate_counter < len(self.current_move):
        self.animate_counter += max(10, int(len(self.current_move)/40))
        self.animate_counter = min(len(self.current_move), self.animate_counter)
        self.set_needs_display()
      else:
        self.animation_state = 'sploding'
        self.update_interval = 0.1
    if self.animation_state == 'sploding':
      self.set_needs_display()
      if self.splosion_counter == 0:
        sound.play_effect('arcade:Explosion_2')
      self.splosion_counter += 1
      if self.splosion_counter > 5:
        self.animation_state = 'stopped'
    if self.animation_state == 'stopped':
      self.update_interval = 0.0 
开发者ID:mikaelho,项目名称:caves,代码行数:20,代码来源:caves.py

示例2: button_pushed

# 需要导入模块: import sound [as 别名]
# 或者: from sound import play_effect [as 别名]
def button_pushed(self, button):
		if self.game_state == GAME_PLAYING:
			x, y = self.get_selected_block()
			problem = self.problems[y][x]
			sound.play_effect('Click_1')
			if button.text == 'Delete':
				l = len(problem.answer_text)
				if l > 0:
					problem.answer_text = problem.answer_text[0:l-1]
			else:
				problem.answer_text += button.text
				if len(problem.answer_text) >= len(problem.answer):
					if(problem.answer_text == problem.answer):
						self.correct_answer(x, y)
					else:
						sound.play_effect('Error')
						problem.answer_text = '' 
开发者ID:khilnani,项目名称:pythonista-scripts,代码行数:19,代码来源:TimesTablesTorture.py

示例3: draw

# 需要导入模块: import sound [as 别名]
# 或者: from sound import play_effect [as 别名]
def draw(self):
    if self.tracking:
      ui.set_color('black')
      ui.fill_rect(0, 0, self.width, self.height)
    else:
      base_color = tuple([self.color[i] for i in range(3)])
      opacity_increment = 1.0/(len(self.current_move)+1) # 0.002
      alpha_incremental = 1.0 - self.animate_counter*opacity_increment
      if self.animate_counter > 0:
        for i in range(1, self.animate_counter):
          alpha_actual = max(0, alpha_incremental)
          self.draw_segment(base_color + (alpha_actual,), self.current_move[i-1], self.current_move[i])
          alpha_incremental += opacity_increment
          if len(self.waypoints_hit_this_turn) > 0:
            (hit_distance, waypoint_index) = self.waypoints_hit_this_turn[0]
            if self.animate_counter >= hit_distance:
              sound.play_effect('digital:PowerUp1')
              self.waypoints[waypoint_index].background_color = '#6cd655'
              self.waypoints_hit_this_turn = self.waypoints_hit_this_turn[1:]
      if self.animation_state == 'sploding':
        splode_alpha = 1.0-self.splosion_counter*0.15
        splode_radius = self.splosion_counter * 4
        splode_color = base_color + (splode_alpha,)
        (x,y) = self.current_move[-1]
        path = ui.Path.oval(x-splode_radius,y-splode_radius,2*splode_radius,2*splode_radius)
        ui.set_color(splode_color)
        path.fill()
#        pos1 = self.current_move[self.animate_counter - 2]
#        pos2 = self.current_move[self.animate_counter - 1]
#        angle = (Vector(pos2) - Vector(pos1)).degrees
        #print(self.animate_counter, angle) 
开发者ID:mikaelho,项目名称:caves,代码行数:33,代码来源:caves.py

示例4: help

# 需要导入模块: import sound [as 别名]
# 或者: from sound import play_effect [as 别名]
def help():
	time.sleep(3)
	sound.play_effect("/System/Library/Audio/UISounds/SIMToolkitNegativeACK.caf")
	print "  Usage:\n\n-u <File> -p <File>\n\n\n  RoBrute Usage:\n <word>;<word>;<word>;<word>;<symbol>"
	print "\n Read Usage.md for more information."
	sys.exit() 
开发者ID:RussianOtter,项目名称:elpscrk,代码行数:8,代码来源:elpscrk.py

示例5: play_tuning

# 需要导入模块: import sound [as 别名]
# 或者: from sound import play_effect [as 别名]
def play_tuning(button):
	if os.path.exists('waves'):
		try:
			strings = model._InstrumentTuning
		except TypeError: # no instrument delected yet
			return
		baseOctave = model._InstrumentOctave
		tones = []
		for string in strings:
			octave,tone = divmod(string,12)
			tones.append((tone,octave+baseOctave))
		for tone,octave in tones:
			sound.play_effect(getWaveName(tone,octave))
			time.sleep(fretboard.arpSpeed) 
开发者ID:polymerchm,项目名称:ccMVC,代码行数:16,代码来源:chordcalc.py

示例6: playScale

# 需要导入模块: import sound [as 别名]
# 或者: from sound import play_effect [as 别名]
def playScale(button):
	if model._TwoOctaveScale:
		if os.path.exists('waves'):
			for string,fret in model._TwoOctaveScale:
				octave,tone = divmod((model._InstrumentTuning[string]+fret),12)
				sound.play_effect(getWaveName(tone,octave+model._InstrumentOctave))
				time.sleep(fretboard.arpSpeed) 
开发者ID:polymerchm,项目名称:ccMVC,代码行数:9,代码来源:chordcalc.py

示例7: playTuning

# 需要导入模块: import sound [as 别名]
# 或者: from sound import play_effect [as 别名]
def playTuning(self,button):
		tones =  [spinner.pointer for spinner in self.spinnerArray]
		octaves = [int(tf.text) for tf in self.octaveTextArray]
		baseOctave = self.octave
		for i,tone in enumerate(tones):
			sound.play_effect(getWaveName(tone,octaves[i]+baseOctave))
			time.sleep(fretboard.arpSpeed) 
开发者ID:polymerchm,项目名称:ccMVC,代码行数:9,代码来源:chordcalc.py

示例8: player_killed_sounds

# 需要导入模块: import sound [as 别名]
# 或者: from sound import play_effect [as 别名]
def player_killed_sounds():
    for i in xrange(4):
        sound.play_effect('Hit_{}'.format(i+1))
        time.sleep(0.5) 
开发者ID:khilnani,项目名称:pythonista-scripts,代码行数:6,代码来源:CloudJump2.py

示例9: high_score_sounds

# 需要导入模块: import sound [as 别名]
# 或者: from sound import play_effect [as 别名]
def high_score_sounds():
    for i in xrange(4):
        sound.play_effect('Jump_{}'.format(i+1))
        time.sleep(0.3) 
开发者ID:khilnani,项目名称:pythonista-scripts,代码行数:6,代码来源:CloudJump2.py

示例10: run_gravity

# 需要导入模块: import sound [as 别名]
# 或者: from sound import play_effect [as 别名]
def run_gravity(self):
        player_y_move = self.dt * self.player.velocity.y
        scenery_y_move = 0
        old_velocity_y = self.player.velocity.y
        self.player.velocity.y -= self.dt * GAME_GRAVITY
        if old_velocity_y > 0 and self.player.velocity.y <= 0:
            self.player_apex_frame = True
        if self.player.frame.y >= self.player_max_y :
            scenery_y_move = self.player.frame.y - self.player_max_y
            self.player.frame.y = self.player_max_y
            self.lower_scenery(scenery_y_move)
        elif self.player.frame.center().y < 0:
            self.player.frame.y = 0
            sound.play_effect('Crashing')
            self.end_game() 
开发者ID:khilnani,项目名称:pythonista-scripts,代码行数:17,代码来源:CloudJump2.py

示例11: collision_detect

# 需要导入模块: import sound [as 别名]
# 或者: from sound import play_effect [as 别名]
def collision_detect(self):
        bounce = False
        if self.player.velocity.y < 0:
            p = self.player.frame.center()
            for sublayer in self.root_layer.sublayers:
                if self.player.frame.center() in sublayer.frame:
                    if isinstance(sublayer, Enemy):
                        sound.play_effect('Powerup_1')
                        self.end_game()
                        return  # player killed by collision
                    elif isinstance(sublayer, Cloud):
                        bounce = True
        if bounce:
            self.player.velocity.y = PLAYER_BOUNCE_VELOCITY
            sound.play_effect('Boing_1') 
开发者ID:khilnani,项目名称:pythonista-scripts,代码行数:17,代码来源:CloudJump2.py

示例12: touch_ended

# 需要导入模块: import sound [as 别名]
# 或者: from sound import play_effect [as 别名]
def touch_ended(self, node, touch):
        if node == self:
            return
        for square in self.get_children_with_name('*'):
            #print(square.name)
            if isinstance(square, sk_BoardSquare) and touch in square:
                target_fen_loc = square.name
                save_fen_loc = node.fen_loc
                #node.move() is called on a different thread so it returns None!!!
                move_was_made = node.move(target_fen_loc) # always returns None!!
                #print('mwm 1', move_was_made)  # fails!!
                move_was_made = node.fen_loc != save_fen_loc
                #print('mwm 2', move_was_made)
                if move_was_made:
                    for piece in self.get_children_with_name('*'):
                        # remove the killed sk_ChessPiece
                        if (piece != node
                        and isinstance(piece, sk_ChessPiece)
                        and piece.fen_loc == node.fen_loc):
                            if piece.piece.ptype == 'king':
                                import dialogs
                                dialogs.hud_alert('Game over man!')
                            piece.remove_from_parent()
                    #import dialogs
                    #dialogs.hud_alert(str(type(self.view.superview)))
                    self.view.superview.update_view(node.piece)
                    node.position = square.position
                    sound.play_effect('8ve:8ve-tap-professional')
                else:
                    node.position = self.save_position
                    sound.play_effect('8ve:8ve-beep-rejected')
                not_str = '' if move_was_made else 'not '
                fmt = '{} at {} was {}moved to square {}\n'
                print(fmt.format(node.name, save_fen_loc, not_str, square.name)) 
开发者ID:khilnani,项目名称:pythonista-scripts,代码行数:36,代码来源:SkChessBoardScene.py

示例13: game_finished

# 需要导入模块: import sound [as 别名]
# 或者: from sound import play_effect [as 别名]
def game_finished(self):
		self.game_state = GAME_FINISHED
		sound.play_effect('Powerup_2')
		self.finish_time = self.t
		self.play_time = self.finish_time - self.start_time
		self.avg_prob_time = self.play_time / self.score 
开发者ID:khilnani,项目名称:pythonista-scripts,代码行数:8,代码来源:TimesTablesTorture.py

示例14: captureOutput_didOutputMetadataObjects_fromConnection_

# 需要导入模块: import sound [as 别名]
# 或者: from sound import play_effect [as 别名]
def captureOutput_didOutputMetadataObjects_fromConnection_(_self, _cmd, _output, _metadata_objects, _conn):
    objects = ObjCInstance(_metadata_objects)
    for obj in objects:
        s = str(obj.stringValue())
        if s not in found_codes:
            found_codes.add(s)
            sound.play_effect('digital:PowerUp7')
        main_view['label'].text = 'Last scan: ' + s 
开发者ID:wizardofozzie,项目名称:Pythonista_scripts,代码行数:10,代码来源:barcode_scanner.py

示例15: play

# 需要导入模块: import sound [as 别名]
# 或者: from sound import play_effect [as 别名]
def play(button):
	if os.path.exists('waves'):
		if not model._InstrumentOctave:
			return
		else:
			baseOctave = model._InstrumentOctave
		strings = model._InstrumentTuning
		if model._Mode == 'C':
			try:
				cc = model._Fingerings[model._FingeringPointer]
			except TypeError: # no chords yet
				return
			except IndexError: #oops
				return
			frets = cc[2]
			dead_notes = [item[3] == 'X' for item in cc[0]]
			tones = []
			for fret,string,dead_note in zip(frets,strings,dead_notes):
				if  dead_note:
					continue
				octave,tone = divmod(string + fret,12)
				tones.append((tone,octave+baseOctave))
		elif fretboard.cc_mode == 'I': # identify
			positions = [string_fret for string_fret in fretboard.touched.keys()]
			positions = sorted(positions,key=lambda x:x[0])
			position_dict = {}
			for string,fret in positions:
				position_dict[string] = fret
			tones = []
			for i,pitch in enumerate(strings):
				if i in position_dict:
					octave,tone = divmod(pitch + position_dict[i],12)
					tones.append((tone,octave+baseOctave))
					
		else: #scale
			pass
			
		for tone,octave in tones:
			sound.play_effect(getWaveName(tone,octave))
			time.sleep(0.05)
			if button.name == 'button_arp':
				time.sleep(fretboard.arpSpeed) 
开发者ID:polymerchm,项目名称:ccMVC,代码行数:44,代码来源:chordcalc.py


注:本文中的sound.play_effect方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。