Skip to content

Instantly share code, notes, and snippets.

@alamboley

alamboley/gist:4024068

Last active Oct 12, 2015
Embed
What would you like to do?
How to play sounds (Citrus Engine recipe)
// In the Main class, register the sounds :
sound.addSound("Hurt", {sound:"sounds/hurt.mp3"});
sound.addSound("Collect", {sound:"sounds/collect.mp3"});
sound.addSound("Song", {sound:"sounds/song.mp3",timesToPlay:-1});
// In your GameState play them when needed :
private function handleHeroTakeDamage():void {
_ce.sound.playSound("Hurt");
}
private function handleJewelCollected(contact:b2Contact):void {
if (Box2DPhysicsObject.CollisionGetOther(self, contact) != _hero)
return;
_ce.sound.playSound("Collect");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment