-
Notifications
You must be signed in to change notification settings - Fork 1
/
rtsmovable.h
40 lines (32 loc) · 838 Bytes
/
rtsmovable.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// rtsmovable.h
//
// Class for a movable object that has a target
// and animates in sequence as it walks. Descended
// from RTSDrawable. Will be base class for RTSSoldier,
// RTSAnimal, and RTSProjectile.
#pragma once
#include <SFML/Graphics.hpp>
#include "animationhelper.h"
#include "rtsdrawable.h"
using namespace sf;
class RTSMovable : public RTSDrawable {
public:
RTSMovable(RenderWindow *window);
void draw(int frameCount);
void move();
void setTarget(double targetX, double targetY);
protected:
double walkSpeed;
double runSpeed;
double targetX;
double targetY;
double direction;
// For shared RTSSoldier and RTSAnimal classes
double health;
bool frame;
bool atTarget;
bool running;
AnimationHelper::spriteDesc lastFrame;
AnimationHelper::spriteDir lastDir;
AnimationHelper::spriteColor teamColor;
};