- Timestamp:
- 2012-07-06 10:14:10 (11 years ago)
- Location:
- 2012/27/DenisZ/TheDungeonGame/TheDungeonGame/TheDungeonGame
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
2012/27/DenisZ/TheDungeonGame/TheDungeonGame/TheDungeonGame/EntityTemplates.cs
r3628 r3633 70 70 public override bool hit(int damage) 71 71 { 72 TheDungeonGame.soundEffects[3].Play();72 TheDungeonGame.soundEffects[3].Play(); 73 73 return base.hit(damage); 74 74 } … … 102 102 public override bool hit(int damage) 103 103 { 104 TheDungeonGame.soundEffects[3].Play();104 TheDungeonGame.soundEffects[3].Play(); 105 105 return base.hit(damage); 106 106 } … … 203 203 Animation = normalWalkingAnimation; 204 204 Animation.Start(); 205 205 206 206 Collided += collided; 207 207 } … … 277 277 player.hit(2); 278 278 else player.hit(1); 279 turtle.Destroy(); 279 280 } 280 281 } -
2012/27/DenisZ/TheDungeonGame/TheDungeonGame/TheDungeonGame/InGameGui.cs
r3624 r3633 15 15 public IntMeter bossHealth; 16 16 private BarGauge bossMeterBar; 17 17 18 18 19 public InGameGui(TheDungeonGame game) … … 26 27 setupHealthMeter(); 27 28 // setupInventory(); 29 } 30 31 public void setupInfoMeters() 32 { 33 Label weaponSpeedText = new Label(); 34 weaponSpeedText.BindTo(game.Player.weaponSpeedMeter); 35 weaponSpeedText.Right += 200; 36 weaponSpeedText.Top += 30; 37 weaponSpeedText.TextColor = Color.White; 38 weaponSpeedText.Color = Color.Transparent; 39 Add(weaponSpeedText); 40 41 Label weaponSpeedInfo = new Label("Weapon's speed"); 42 weaponSpeedInfo.Top += 30; 43 weaponSpeedInfo.Right += 90; 44 weaponSpeedInfo.TextColor = Color.White; 45 weaponSpeedInfo.Color = Color.Transparent; 46 Add(weaponSpeedInfo); 47 48 Label weaponDamageText = new Label(); 49 weaponDamageText.BindTo(game.Player.weaponDamageMeter); 50 weaponDamageText.Right += 200; 51 weaponDamageText.Top += 10; 52 weaponDamageText.TextColor = Color.White; 53 weaponDamageText.Color = Color.Transparent; 54 Add(weaponDamageText); 55 56 Label weaponDamageInfo = new Label("Weapon's damage"); 57 weaponDamageInfo.Top += 10; 58 weaponDamageInfo.Right += 80; 59 weaponDamageInfo.TextColor = Color.White; 60 weaponDamageInfo.Color = Color.Transparent; 61 Add(weaponDamageInfo); 62 63 64 Label bulletLifeText = new Label(); 65 bulletLifeText.BindTo(game.Player.bulletLifeMeter); 66 bulletLifeText.Top -= 10; 67 bulletLifeText.Right += 200; 68 bulletLifeText.TextColor = Color.White; 69 bulletLifeText.Color = Color.Transparent; 70 Add(bulletLifeText); 71 72 Label bulletLifeInfo = new Label("Bullet's lifetime"); 73 bulletLifeInfo.Top -= 10; 74 bulletLifeInfo.Right += 95; 75 bulletLifeInfo.TextColor = Color.White; 76 bulletLifeInfo.Color = Color.Transparent; 77 Add(bulletLifeInfo); 78 79 28 80 } 29 81 … … 93 145 bossMeterBar.BarColor = Color.Green; 94 146 bossMeterBar.BorderColor = Color.White; 147 bossMeterBar.Right -= 40; 95 148 bossMeterBar.BindTo(bossHealth); 96 149 Add(bossMeterBar); -
2012/27/DenisZ/TheDungeonGame/TheDungeonGame/TheDungeonGame/Player.cs
r3628 r3633 27 27 private Item itemInInventory; 28 28 private AssaultRifle weapon; 29 private int damage; 29 30 30 31 private Angle UpAngle = Angle.FromDegrees(90); … … 40 41 private bool isAnimationRunning = false; 41 42 43 public DoubleMeter weaponSpeedMeter, bulletLifeMeter; 44 public IntMeter weaponDamageMeter; 45 42 46 private SoundEffect hitSound = TheDungeonGame.LoadSoundEffect("sound/robot_hit"); 43 47 … … 45 49 : base(playerWidth, playerHeight) 46 50 { 47 playerHealth = new IntMeter(10, 0, 50); 51 48 52 this.game = game; 49 53 keyboard = game.Keyboard; … … 59 63 walkingAnimation.FPS = 10; 60 64 Tag = "Player"; 65 66 playerHealth = new IntMeter(10, 0, 50); 61 67 } 62 68 63 69 public void setupWeapon() 64 70 { 71 weaponDamageMeter = new IntMeter(0, 0, 4); 72 weaponSpeedMeter = new DoubleMeter(0, 0.01, 2.0); 73 bulletLifeMeter = new DoubleMeter(0, 0.01, 2.0); 74 65 75 weapon = new AssaultRifle(playerWidth / 3, playerHeight / 3); 66 76 weapon.Top = Top; … … 73 83 weapon.ProjectileCollision = bulletCollided; 74 84 WeaponDamage = 1; 85 WeaponSpeed = weapon.TimeBetweenUse; 86 BulletLife = weapon.MaxAmmoLifetime; 75 87 Add(weapon); 88 76 89 } 77 90 … … 105 118 keyboard.Listen(Key.Left, ButtonState.Down, shootAmmo, "Shoot up", LeftAngle); 106 119 107 // keyboard.Listen(Key.Space, ButtonState.Pressed, useItemInInventory, "Use Item"); 120 keyboard.Listen(Key.F10, ButtonState.Pressed, playerCheat, null); 121 122 // keyboard.Listen(Key.Space, ButtonState.Pressed, useItemInInventory, "Use Item"); 123 } 124 125 private void playerCheat() 126 { 127 WeaponDamage = 5; 128 WeaponSpeed = TimeSpan.FromSeconds(0.2); 129 BulletLife = TimeSpan.FromSeconds(2); 130 playerHealth.Value = 50; 131 // game.gui.updatePlayerStats(); 108 132 } 109 133 … … 118 142 collidingObject.Destroy(); 119 143 } 120 else if (targetObject.Tag.Equals("Wall") || targetObject.Tag.Equals("ObjectRock") || targetObject.Tag.Equals("Item")) 144 else if (targetObject.Tag.Equals("Wall") || targetObject.Tag.Equals("ObjectRock") || targetObject.Tag.Equals("Item")) 121 145 collidingObject.Destroy(); 122 146 } … … 129 153 { 130 154 showLostScreen(); 131 } 155 } 132 156 } 133 157 … … 136 160 if (isDead) return; 137 161 isDead = true; 138 string[] buttonNames = { "Retry", "Exit Game"};162 string[] buttonNames = { "Retry", "Exit Game" }; 139 163 keyboard.DisableAll(); 140 164 MultiSelectWindow lostWindow = new MultiSelectWindow("Oh noes! You appear to be dead! \nBut, you can always start a new journey...", buttonNames); … … 152 176 set 153 177 { 178 if (value.TotalSeconds < 0.01 && value.TotalSeconds > 2.0) return; 179 weaponSpeedMeter.Value = value.TotalSeconds; 154 180 weapon.TimeBetweenUse = value; 155 181 } … … 164 190 set 165 191 { 192 if (value.TotalSeconds < 0.01 && value.TotalSeconds > 2.0) return; 193 bulletLifeMeter.Value = value.TotalSeconds; 166 194 weapon.MaxAmmoLifetime = value; 167 195 } … … 170 198 public int WeaponDamage 171 199 { 172 get; 173 set; 200 get 201 { 202 return damage; 203 } 204 set 205 { 206 if (value < 0 || value > 4) return; 207 weaponDamageMeter.Value = value; 208 damage = value; 209 } 174 210 } 175 211 … … 254 290 movementVector = Vector.Zero; 255 291 Stop(); 256 292 257 293 } 258 294 … … 261 297 if (currentRoom.EntityAmount == 0) 262 298 { 263 for (int i = 0; i < 4; i++)299 for (int i = 0; i < 4; i++) 264 300 { 265 301 if (currentRoom.doors[i] == null) continue; … … 270 306 else 271 307 { 272 273 274 275 276 277 308 for (int i = 0; i < 4; i++) 309 { 310 if (currentRoom.doors[i] == null) continue; 311 currentRoom.doors[i].IsLocked = true; 312 currentRoom.setDoorTexture(game.objectTextures[0], i); 313 } 278 314 } 279 315 … … 293 329 Animation.Start(); 294 330 isAnimationRunning = true; 295 } 331 } 296 332 Move(movementVector); 297 333 isMoving = true; -
2012/27/DenisZ/TheDungeonGame/TheDungeonGame/TheDungeonGame/TheDungeonGame.cs
r3628 r3633 72 72 Add(gui); 73 73 74 gui.setupInfoMeters(); 75 74 76 AddCollisionHandler(player, player.performCollision); 75 77 AddCollisionHandler(player, "Item", player.handleItemPickup);
Note: See TracChangeset
for help on using the changeset viewer.