Skip to content

Commit

Permalink
Merge pull request #1 from pengyu/sound_dev
Browse files Browse the repository at this point in the history
Sound dev
  • Loading branch information
Witali Mik committed Feb 19, 2012
2 parents befd59a + f7ebe62 commit 547ca06
Show file tree
Hide file tree
Showing 23 changed files with 48 additions and 16 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/nbproject/private/
/assets/img/.fr-5KubhJ/
/nbproject
.*.sw?
2 changes: 1 addition & 1 deletion assets/js/effects.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Crafty.c("RandomExplosion",{
.animate("explode"+rand,10)
.delay(function(){this.destroy()},500);

// Crafty.audio.play("explosion"+(rand %2));
Crafty.audio.play("explosion"+(rand %2));
}
});
Crafty.c("Damage",{
Expand Down
2 changes: 1 addition & 1 deletion assets/js/enemys.js
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ Crafty.c("Level2",{
this.destroy();
},
shoot:function(){
var bullet = Crafty.e("Weapon1","EnemyBullet");
var bullet = Crafty.e("Weapon2","EnemyBullet");
bullet.attr({
x: this._x+this._w/2-bullet.w/2,
y: this._y+this._h-bullet.h/2,
Expand Down
4 changes: 2 additions & 2 deletions assets/js/levels.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Crafty.scene("Level1",function(){
//Setup background of level
Crafty.background("url(assets/img/bg.png)");
//Play background music and repeat
// Crafty.audio.play("space",-1);
//Crafty.audio.play("space",-1);
$('.level').text('Level: 1');

var spotEnemys = function(frame){
Expand Down Expand Up @@ -85,4 +85,4 @@ Crafty.scene("Level1",function(){
});


});
});
46 changes: 37 additions & 9 deletions assets/js/sounds.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,37 @@
/*
Crafty.audio.add("space", "media/music/through-space.ogg");
Crafty.audio.add("explosion0","media/sounds/explodemini.wav");
Crafty.audio.add("explosion1","media/sounds/explode.wav");
Crafty.audio.add("laser1","media/sounds/laser1.wav");
Crafty.audio.add("laser2","media/sounds/laser2.wav");
Crafty.audio.add("laser3","media/sounds/laser3.wav");
Crafty.audio.add("laser4","media/sounds/laser4.wav");
*/
Crafty.audio.add({
space: [
"media/music/through-space.wav",
"media/music/through-space.mp3",
"media/music/through-space.ogg"
],
explosion0: [
"media/sounds/explodemini.wav",
"media/sounds/explodemini.mp3",
"media/sounds/explodemini.ogg"
],
explosion1: [
"media/sounds/explode.wav",
"media/sounds/explode.mp3",
"media/sounds/explode.ogg"
],
laser1: [
"media/sounds/laser1.wav",
"media/sounds/laser1.mp3",
"media/sounds/laser1.ogg"
],
laser2: [
"media/sounds/laser2.wav",
"media/sounds/laser2.mp3",
"media/sounds/laser2.ogg"
],
laser3: [
"media/sounds/laser3.wav",
"media/sounds/laser3.mp3",
"media/sounds/laser3.ogg"
],
laser4: [
"media/sounds/laser4.wav",
"media/sounds/laser4.mp3",
"media/sounds/laser4.ogg"
]
});
6 changes: 3 additions & 3 deletions assets/js/weapons.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Crafty.c("Weapon1",{
.attr({
dmg:1
});
//Crafty.audio.play("laser1");
Crafty.audio.play("laser1");
}
});
Crafty.c("Weapon2",{
Expand All @@ -40,6 +40,6 @@ Crafty.c("Weapon2",{
}).attr({
dmg:2
});
//Crafty.audio.play("laser2");
Crafty.audio.play("laser2");
}
});
});
3 changes: 3 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
<head>
<meta charset="UTF-8" />
<title>Cron</title>
<!--
<script type="text/javascript" src="http://cdn.crafty-modules.com/crafty-DEBUG.js"></script>
-->
<script type="text/javascript" src="http://localhost/~pengy/crafty/crafty.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js"></script>
<script type="text/javascript" src="assets/js/sprites.js"></script>
Expand Down
Binary file added media/music/spaceship.mp3
Binary file not shown.
Binary file added media/music/spaceship.ogg
Binary file not shown.
Binary file added media/music/through-space.mp3
Binary file not shown.
Binary file added media/music/through-space.wav
Binary file not shown.
Binary file added media/sounds/explode.mp3
Binary file not shown.
Binary file added media/sounds/explode.ogg
Binary file not shown.
Binary file added media/sounds/explodemini.mp3
Binary file not shown.
Binary file added media/sounds/explodemini.ogg
Binary file not shown.
Binary file added media/sounds/laser1.mp3
Binary file not shown.
Binary file added media/sounds/laser1.ogg
Binary file not shown.
Binary file added media/sounds/laser2.mp3
Binary file not shown.
Binary file added media/sounds/laser2.ogg
Binary file not shown.
Binary file added media/sounds/laser3.mp3
Binary file not shown.
Binary file added media/sounds/laser3.ogg
Binary file not shown.
Binary file added media/sounds/laser4.mp3
Binary file not shown.
Binary file added media/sounds/laser4.ogg
Binary file not shown.

0 comments on commit 547ca06

Please sign in to comment.