Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

uncommented audio.load. Should thoroughly tested them later on.

  • Loading branch information...
commit f7ebe62c58cd7fbd9abb8e69acb5dac0d85ef805 1 parent e2ec277
@pengyu pengyu authored
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>
Please sign in to comment.
Something went wrong with that request. Please try again.