Changeset 83
- Timestamp:
- 12/04/07 17:45:16 (1 year ago)
- Files:
-
- trunk/src/bullet.d (modified) (1 diff)
- trunk/src/engine.d (modified) (3 diffs)
- trunk/src/player.d (modified) (4 diffs)
- trunk/src/tilemap.d (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/src/bullet.d
r81 r83 34 34 // if a laserbolt hits something, remove it 35 35 36 // TODO: if the Bullet collides with something, do something36 // TODO: if the Bullet collides with something, remove the bullet 37 37 void onCollideStart(Body a, Body b) 38 38 { trunk/src/engine.d
r74 r83 55 55 arc.input.open(); 56 56 arc.time.open(); 57 arc.sound.open(); 57 58 58 59 logger.info("Starting GUI..."); … … 84 85 arc.input.close(); 85 86 arc.window.close(); 87 arc.sound.close(); 86 88 } 87 89 … … 163 165 arc.scenegraph.drawable.drawScenegraph(); 164 166 arc.time.limitFPS(60); 167 arc.sound.process(); 165 168 } 166 169 trunk/src/player.d
r81 r83 12 12 arc.window, 13 13 arc.input; 14 15 import tank; 14 16 15 17 … … 40 42 //setParent(null); 41 43 //physics.sigSustainedPostCollide.detach(&onCollide); 44 45 // kill player if it touches the tank 46 if(cast(Tank)b.getParent() !is null) 47 { 48 w.removeChild(this); 49 alive = false; 50 } 42 51 } 43 52 … … 108 117 //image.draw(); 109 118 }*/ 119 120 void playFire() 121 { 122 fireSound.play(); 123 } 124 125 bool alive=true; 110 126 111 127 private: 112 128 //8. Laser bolt vars 113 World w;129 World w; 114 130 Body physics; 115 131 Frame image; 132 Sound fireSound; 116 133 // Bullet[] bullets; 117 134 … … 123 140 // for all instances of LaserBolt 124 141 image = new Frame(Texture("images/Player-standing.png")); 142 fireSound = new Sound(new SoundFile("sound/machine_gun.wav")); 143 fireSound.setLoop(false); 144 registerAutoProcessSound(fireSound); 125 145 } 126 146 trunk/src/tilemap.d
r81 r83 368 368 } 369 369 370 if (arc.input.keyPressed(' ') )370 if (arc.input.keyPressed(' ') && player.alive) 371 371 { 372 372 bullets ~= Bullet.addBullet(playerLoc + Point.fromPolar(32, player.transform.rotation - PI/2), player.transform.rotation, this); 373 player.playFire(); 373 374 } 374 375 375 376 foreach (inout Bullet b; bullets) 376 377 b.process(); 378 } 379 380 void resetGame() 381 { 382 bullets.length=0; 383 tanks.length=0; 384 helicopters.length=0; 385 rootNode.deleteAllChildTrees(); 386 loadLevel(); 377 387 } 378 388
