Changeset 2217


Ignore:
Timestamp:
2011-06-28 12:53:04 (12 years ago)
Author:
teeevasa
Message:

Talletus.

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  
    88public class GenCharacter : PlatformCharacter 
    99{ 
     10    // The amount of hit points the player/enemy has. Will be defined in their respective classes later on. 
    1011    protected int hitPoints 
    1112    { 
     
    1415    } 
    1516 
     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. 
    1619    protected int maxHP 
    1720    { 
     
    1922    } 
    2023 
     24    // The constructor that just relays the variables forward 
    2125    public GenCharacter(double width, double height, Shape shape) 
    2226        : base(width, height, shape) 
     
    2529    } 
    2630 
     31    // A particlular method for reducing hit points. It also handles death, when it  
    2732    private void reduceHitPointsBy(int reduction) 
    2833    { 
    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         
    3048    } 
    3149} 
  • 2011/26/JaakkoL/Rogue Agent 2372/Rogue Agent 2372/Rogue Agent 2372/Player.cs

    r2216 r2217  
    2020    { 
    2121        //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); 
    2323    } 
    2424 
Note: See TracChangeset for help on using the changeset viewer.