source: 2011/26/JaakkoL/Rogue Agent 2372/Rogue Agent 2372/Rogue Agent 2372/GenCharacter.cs @ 2219

Revision 2219, 1.4 KB checked in by teeevasa, 8 years ago (diff)

Talletus.

RevLine 
[2205]1using System;
2using Jypeli;
3using Jypeli.Assets;
4using Jypeli.Controls;
5using Jypeli.Effects;
6using Jypeli.Widgets;
7
8public class GenCharacter : PlatformCharacter
9{
[2217]10    // The amount of hit points the player/enemy has. Will be defined in their respective classes later on.
[2206]11    protected int hitPoints
12    {
13        get { return hitPoints; }
14        set { hitPoints = value; }
15    }
16
[2217]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.
[2206]19    protected int maxHP
20    {
21        get { return maxHP; }
22    }
23
[2217]24    // The constructor that just relays the variables forward
[2205]25    public GenCharacter(double width, double height, Shape shape)
26        : base(width, height, shape)
27    {
28
29    }
[2206]30
[2219]31    // Players and enemies have different ways of attacking
32    private abstract void attack();
33
[2217]34    // A particlular method for reducing hit points. It also handles death, when it
[2206]35    private void reduceHitPointsBy(int reduction)
36    {
[2217]37        if (hitPoints > reduction)
38        {
39            hitPoints -= reduction;
40        }
41        else
42        {
43            deathOccurred();
44        }
[2206]45    }
[2217]46
47    // A method for handling death, i.e., removing the player, saving scores or whatever
48    private void deathOccurred()
49    {
50       
51    }
[2205]52}
Note: See TracBrowser for help on using the repository browser.