Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Sound dev #1

Merged
merged 3 commits into from

2 participants

@pengyu

Added all three sound formats. Uncommented audio.play. Should throughly test them later on.

@BlackScorp BlackScorp merged commit 547ca06 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
View
1  .gitignore
@@ -1,3 +1,4 @@
/nbproject/private/
/assets/img/.fr-5KubhJ/
/nbproject
+.*.sw?
View
2  assets/js/effects.js
@@ -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",{
View
2  assets/js/enemys.js
@@ -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,
View
4 assets/js/levels.js
@@ -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){
@@ -85,4 +85,4 @@ Crafty.scene("Level1",function(){
});
-});
+});
View
46 assets/js/sounds.js
@@ -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"
+ ]
+ });
View
6 assets/js/weapons.js
@@ -26,7 +26,7 @@ Crafty.c("Weapon1",{
.attr({
dmg:1
});
- //Crafty.audio.play("laser1");
+ Crafty.audio.play("laser1");
}
});
Crafty.c("Weapon2",{
@@ -40,6 +40,6 @@ Crafty.c("Weapon2",{
}).attr({
dmg:2
});
- //Crafty.audio.play("laser2");
+ Crafty.audio.play("laser2");
}
-});
+});
View
3  index.html
@@ -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>
View
BIN  media/music/spaceship.mp3
Binary file not shown
View
BIN  media/music/spaceship.ogg
Binary file not shown
View
BIN  media/music/through-space.mp3
Binary file not shown
View
BIN  media/music/through-space.wav
Binary file not shown
View
BIN  media/sounds/explode.mp3
Binary file not shown
View
BIN  media/sounds/explode.ogg
Binary file not shown
View
BIN  media/sounds/explodemini.mp3
Binary file not shown
View
BIN  media/sounds/explodemini.ogg
Binary file not shown
View
BIN  media/sounds/laser1.mp3
Binary file not shown
View
BIN  media/sounds/laser1.ogg
Binary file not shown
View
BIN  media/sounds/laser2.mp3
Binary file not shown
View
BIN  media/sounds/laser2.ogg
Binary file not shown
View
BIN  media/sounds/laser3.mp3
Binary file not shown
View
BIN  media/sounds/laser3.ogg
Binary file not shown
View
BIN  media/sounds/laser4.mp3
Binary file not shown
View
BIN  media/sounds/laser4.ogg
Binary file not shown
Something went wrong with that request. Please try again.