diff melee/melee.d @ 26:88cca12cc8b9

added ship explode
author zzzzrrr <mason.green@gmail.com>
date Fri, 27 Mar 2009 19:26:01 -0400
parents 2bf818f8b005
children d63faa81a5e4
line wrap: on
line diff
--- a/melee/melee.d	Fri Mar 27 16:25:17 2009 -0400
+++ b/melee/melee.d	Fri Mar 27 19:26:01 2009 -0400
@@ -58,7 +58,7 @@
 
 const ITERS_PER_SECOND = 100;
 const k_maxContactPoints = 100;
-const NUM_ASTROIDS = 15;
+const NUM_ASTROIDS = 12;
 
 alias LinkedList!(Ship) ObjectList;
 
@@ -137,7 +137,7 @@
         running = true;
         
         draw = new Render(world, ship1, ship2, settings);
-        human = new Human(ship1);
+        human = new Human(ship1, this);
         
         objectList.add(planet);
         objectList.add(ship1);
@@ -171,10 +171,10 @@
         jobHub.addPostFrameJob( {
             
             // Limit velocity
-            ship1.limitVelocity();
-            ship2.limitVelocity();
-            ship1.updateState();
-            ship2.updateState();
+            foreach(o; objectList) {
+                o.limitVelocity();
+                o.updateState();
+            }
             
             gui.begin(cfg);
             gui.push(`main`);
@@ -182,7 +182,7 @@
                 running = false;
             }
 
-            if(human.thrust) {
+            if(human.thrust && ship1) {
                 ship1.thrust();
             }
 
@@ -210,7 +210,6 @@
 		ship1 = new Orz(world);
         ship2.rBody.angle = 3.14159265/4;
         planet = new Planet(world);
-        
         for(int i; i < NUM_ASTROIDS; i++) {
             auto asteroid = new Asteroid(world);
             objectList.add(asteroid);