本文整理汇总了Python中loader.Loader.load_sound方法的典型用法代码示例。如果您正苦于以下问题:Python Loader.load_sound方法的具体用法?Python Loader.load_sound怎么用?Python Loader.load_sound使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类loader.Loader
的用法示例。
在下文中一共展示了Loader.load_sound方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: GameBoard
# 需要导入模块: from loader import Loader [as 别名]
# 或者: from loader.Loader import load_sound [as 别名]
class GameBoard(object):
def __init__(self):
self.loader = Loader()
self.desk = self.loader.load_image("back.png")
self.back = self.desk.copy()
self.cards1 = self.loader.load_image("cards1.png",True)
self.cards2 = self.loader.load_image("cards2.png",True)
self.card_back = self.loader.load_image("card.png",True)
self.card_images = []
for i in range(18):
self.card_images.append(self.loader.load_image("img%d.png" % (i+1)))
self.gfxcards = []
self.gfxcards_hidden = []
self.delay = 0
self.title_fnt = self.loader.load_font("KLEPTOMA.TTF", 50)
self.text_fnt = self.loader.load_font("scribble.TTF", 24)
self.small_text_fnt = self.loader.load_font("scribble.TTF", 15)
self.START_SCREEN = 0
self.GAME_PLAY = 1
self.GAME_OVER = 2
self.card_snd = self.loader.load_sound("card.wav")
self.goto_start()
def goto_start(self):
self.render_start()
self.state = self.START_SCREEN
def goto_gameover(self,result):
self.render_gameover(result)
self.state = self.GAME_OVER
def goto_game(self):
self.state = self.GAME_PLAY
self.back.blit(self.desk,(0,0))
def _title(self,text,y,x=400):
f = self.title_fnt
t = f.render(text, True, (0,0,0))
r = t.get_rect()
r.center = (x+4,y+4)
self.back.blit(t,r.topleft)
t = f.render(text, True, (255,255,0))
r = t.get_rect()
r.center = (x,y)
self.back.blit(t,r.topleft)
def _text(self,text,y,x=400):
f = self.text_fnt
t = f.render(text, True, (0,0,0))
r = t.get_rect()
r.center = (x+2,y+2)
self.back.blit(t,r.topleft)
t = f.render(text, True, (255,255,255))
r = t.get_rect()
r.center = (x,y)
self.back.blit(t,r.topleft)
def _text2(self,text,y):
f = self.small_text_fnt
t = f.render(text, True, (0,0,0))
r = t.get_rect()
r.center = (400+2,y+2)
self.back.blit(t,r.topleft)
t = f.render(text, True, (255,255,255))
r = t.get_rect()
r.center = (400,y)
self.back.blit(t,r.topleft)
def render_start(self):
self.back.blit(self.desk,(0,0))
r = self.cards1.get_rect()
r.center = (400,340-10)
self.back.blit(self.cards1,r.topleft)
r = self.cards2.get_rect()
r.bottomleft = (-30,620)
self.back.blit(self.cards2,r.topleft)
y = 120-10
self._title("- Guaduelo -",y); y+=50
self._text("Pincha en cualquier sitio para comenzar",y)
y = 480
r = 20
#self._text2("Coding and graphics by John Eriksson",y); y+=r
#self._text2("Photos by Jenny Eriksson",y); y+=r
#self._text2("Testing by Jenny and Pelle Eriksson",y); y+=r
#self._text2("Toys from Pelle and Rasmus collections",y); y+=r
#self._text2("Fonts by Simsjeedy and Jakob Fischer",y); y+=r
#.........这里部分代码省略.........
示例2: GameBoard
# 需要导入模块: from loader import Loader [as 别名]
# 或者: from loader.Loader import load_sound [as 别名]
class GameBoard(object):
def __init__(self):
self.loader = Loader()
self.desk = self.loader.load_image("back.png")
self.back = self.desk.copy()
self.cards1 = self.loader.load_image("cards1.png",True)
self.cards2 = self.loader.load_image("cards2.png",True)
self.card_back = self.loader.load_image("card.png",True)
self.card_mouse_over = self.loader.load_image("card_mouse_over.png", True)
self.card_images_first = []
self.card_images_second = []
for i in range(18):
self.card_images_first.append(self.loader.load_image("img%d_1.png" % (i+1)))
self.card_images_second.append(self.loader.load_image("img%d_2.png" % (i+1)))
self.gfxcards = []
self.gfxcards_hidden = []
self.delay = 0
self.title_fnt = self.loader.load_font("KLEPTOMA.TTF", 60)
self.text_fnt = self.loader.load_font("scribble.TTF", 24)
self.small_text_fnt = self.loader.load_font("scribble.TTF", 15)
self.START_SCREEN = 0
self.GAME_PLAY = 1
self.GAME_OVER = 2
self.card_snd = self.loader.load_sound("card.wav")
self.goto_start()
def goto_start(self):
self.render_start()
self.state = self.START_SCREEN
def goto_gameover(self,result):
self.render_gameover(result)
self.state = self.GAME_OVER
def goto_game(self):
self.state = self.GAME_PLAY
self.back.blit(self.desk,(0,0))
def _title(self,text,y,x=400):
f = self.title_fnt
t = f.render(text, True, (0,0,0))
r = t.get_rect()
r.center = (x+4,y+4)
self.back.blit(t,r.topleft)
t = f.render(text, True, (255,255,0))
r = t.get_rect()
r.center = (x,y)
self.back.blit(t,r.topleft)
def _text(self,text,y,x=400):
f = self.text_fnt
t = f.render(text, True, (0,0,0))
r = t.get_rect()
r.center = (x+2,y+2)
self.back.blit(t,r.topleft)
t = f.render(text, True, (255,255,255))
r = t.get_rect()
r.center = (x,y)
self.back.blit(t,r.topleft)
def _text2(self,text,y):
f = self.small_text_fnt
t = f.render(text, True, (0,0,0))
r = t.get_rect()
r.center = (400+2,y+2)
self.back.blit(t,r.topleft)
t = f.render(text, True, (255,255,255))
r = t.get_rect()
r.center = (400,y)
self.back.blit(t,r.topleft)
def render_start(self):
self.back.blit(self.desk,(0,0))
r = self.cards1.get_rect()
r.center = (400,340-10)
self.back.blit(self.cards1,r.topleft)
r = self.cards2.get_rect()
r.bottomleft = (-30,620)
self.back.blit(self.cards2,r.topleft)
y = 120-10
self._title("- Memory-",y); y+=50
self._text("Click anywhere to start",y)
y = 480
r = 20
self._text2("Persoenliches Memory fuer Julia und Oliver",y); y+=r
self._text2("fuer Ihre Hochzeit am 15.09.2012",y); y+=r
#.........这里部分代码省略.........