Mercurial > pyntnclick
comparison gamelib/scenes/mess.py @ 566:ea9dd2b9186a pyntnclick
Hook up sound in gamelib/scenes.
author | Simon Cross <hodgestar+bzr@gmail.com> |
---|---|
date | Sat, 11 Feb 2012 15:05:18 +0200 |
parents | 098ea4ea0d0d |
children | 9c3528c2cbe5 |
comparison
equal
deleted
inserted
replaced
565:88cffe418201 | 566:ea9dd2b9186a |
---|---|
2 | 2 |
3 from random import randint | 3 from random import randint |
4 | 4 |
5 from pyntnclick.state import Scene, Item, CloneableItem, Thing, Result | 5 from pyntnclick.state import Scene, Item, CloneableItem, Thing, Result |
6 from pyntnclick.cursor import CursorSprite | 6 from pyntnclick.cursor import CursorSprite |
7 from pyntnclick.sound import get_sound | |
8 from pyntnclick import constants | 7 from pyntnclick import constants |
9 from pyntnclick.scenewidgets import (InteractNoImage, InteractImage, | 8 from pyntnclick.scenewidgets import (InteractNoImage, InteractImage, |
10 InteractImageRect, InteractAnimated, | 9 InteractImageRect, InteractAnimated, |
11 GenericDescThing) | 10 GenericDescThing) |
12 | 11 |
255 | 254 |
256 INITIAL_DATA = { | 255 INITIAL_DATA = { |
257 'anim_pos': -1, | 256 'anim_pos': -1, |
258 } | 257 } |
259 | 258 |
260 HISS = get_sound('boomslang.ogg') | 259 HISS = 'boomslang.ogg' |
260 | |
261 def __init__(self, state): | |
262 super(Boomslang, self).__init__(state) | |
263 self.hiss = self.sound.get_sound(self.HISS) | |
261 | 264 |
262 def is_interactive(self, tool=None): | 265 def is_interactive(self, tool=None): |
263 return False | 266 return False |
264 | 267 |
265 def animate(self): | 268 def animate(self): |
272 self.set_data('anim_pos', self.current_interact._anim_pos) | 275 self.set_data('anim_pos', self.current_interact._anim_pos) |
273 return True | 276 return True |
274 if randint(0, 30 * constants.FRAME_RATE) == 0: | 277 if randint(0, 30 * constants.FRAME_RATE) == 0: |
275 self.set_interact('snake') | 278 self.set_interact('snake') |
276 self.set_data('anim_pos', 0) | 279 self.set_data('anim_pos', 0) |
277 self.HISS.play() | 280 self.hiss.play() |
278 return False | 281 return False |
279 | 282 |
280 | 283 |
281 class DetergentThing(Thing): | 284 class DetergentThing(Thing): |
282 | 285 |