Changeset 2217
- Timestamp:
- 2011-06-28 12:53:04 (12 years ago)
- Location:
- 2011/26/JaakkoL/Rogue Agent 2372/Rogue Agent 2372/Rogue Agent 2372
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
2011/26/JaakkoL/Rogue Agent 2372/Rogue Agent 2372/Rogue Agent 2372/GenCharacter.cs
r2206 r2217 8 8 public class GenCharacter : PlatformCharacter 9 9 { 10 // The amount of hit points the player/enemy has. Will be defined in their respective classes later on. 10 11 protected int hitPoints 11 12 { … … 14 15 } 15 16 17 // The maximum amount of hit points a player can have, which is currently defined as 100. 18 // This is done so that when/if a player receives a health replenishment, it won't go over the limit. 16 19 protected int maxHP 17 20 { … … 19 22 } 20 23 24 // The constructor that just relays the variables forward 21 25 public GenCharacter(double width, double height, Shape shape) 22 26 : base(width, height, shape) … … 25 29 } 26 30 31 // A particlular method for reducing hit points. It also handles death, when it 27 32 private void reduceHitPointsBy(int reduction) 28 33 { 29 hitPoints -= reduction; 34 if (hitPoints > reduction) 35 { 36 hitPoints -= reduction; 37 } 38 else 39 { 40 deathOccurred(); 41 } 42 } 43 44 // A method for handling death, i.e., removing the player, saving scores or whatever 45 private void deathOccurred() 46 { 47 30 48 } 31 49 } -
2011/26/JaakkoL/Rogue Agent 2372/Rogue Agent 2372/Rogue Agent 2372/Player.cs
r2216 r2217 20 20 { 21 21 //Keyboard.Listen(Key.Right, ButtonState.Down, liikuta, "Liikkuu vasemmalle", pelaaja1, nopeus); 22 Keyboard.Listen(Key.Right, ButtonState.Down, moveRight, "Moves right", speed);22 Game.Keyboard.Listen(Key.Right, ButtonState.Down, moveRight, "Moves right", speed); 23 23 } 24 24
Note: See TracChangeset
for help on using the changeset viewer.