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

Revision 2234, 1.3 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 { get; set; }
12
13    // The maximum amount of hit points a player can have, which is currently defined as 100.
14    // This is done so that when/if a player receives a health replenishment, it won't go over the limit.
15    protected int maxHP
16    {
17        get { return maxHP; }
18    }
19
20    // The constructor that just relays the variables forward
21    public GenCharacter(double width, double height, Shape shape)
22        : base(width, height, shape)
23    {
24
25    }
26
27    // Players and enemies have different ways of attacking
28    //public abstract void attack();
29
30    // A particlular method for reducing hit points. It also handles death, when it
31    private void reduceHitPointsBy(int reduction)
32    {
33        if (hitPoints > reduction)
34        {
35            hitPoints -= reduction;
36        }
37        else
38        {
39            deathOccurred();
40        }
41    }
42
43    // A method for handling death, i.e., removing the player, saving scores or whatever
44    private void deathOccurred()
45    {
46       
47    }
48}
Note: See TracBrowser for help on using the repository browser.