Browse Source

Updates to Space Game

Josh Engebretson 11 years ago
parent
commit
403b25ca79

+ 9 - 1
SpaceGame/Resources/Components/SpaceGame.js

@@ -134,11 +134,19 @@ function spawnPlayer() {
 
 
 function start() {
 function start() {
 
 
-    self.hud = scene.createJSComponent("HUD");
+    self.hud = scene.createJSComponent("HUD");    
 
 
     spawnSpace();
     spawnSpace();
     spawnPlayer();
     spawnPlayer();
     spawnEnemies();
     spawnEnemies();
+
+    var musicFile = game.cache.getResource("Sound", "Music/battle.ogg");
+    musicFile.looped = true;
+    var musicNode = scene.createChild("MusicNode");
+    var musicSource = musicNode.createComponent("SoundSource");
+    musicSource.gain = .5;
+    musicSource.soundType = Atomic.SOUND_MUSIC;
+    musicSource.play(musicFile);    
 }
 }
 
 
 
 

+ 6 - 2
SpaceGame/Resources/Scripts/main.js

@@ -1,8 +1,12 @@
 
 
 // This script is the main entry point of the game
 // This script is the main entry point of the game
 
 
+require("AtomicGame");
+
+Atomic.game.init(start, update);
+
 // called at the start of play
 // called at the start of play
-function Start() {
+function start() {
 
 
 	var game = Atomic.game;
 	var game = Atomic.game;
 
 
@@ -16,7 +20,7 @@ function Start() {
 }
 }
 
 
 // called per frame
 // called per frame
-function Update(timeStep) {
+function update(timeStep) {
 
 
 
 
 }
 }