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.

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