Started on a larger test
This commit is contained in:
parent
cdc802476d
commit
420b504016
2 changed files with 62 additions and 0 deletions
37
src/GC/tests/player.hpp
Normal file
37
src/GC/tests/player.hpp
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
#include <string>
|
||||
|
||||
using std::string;
|
||||
|
||||
class Player {
|
||||
|
||||
private:
|
||||
|
||||
string name;
|
||||
Point position;
|
||||
Point size;
|
||||
Point direction;
|
||||
|
||||
public:
|
||||
|
||||
Player(string n, Point pos, Point s, Point dir) {
|
||||
name = n;
|
||||
position = pos;
|
||||
size = s;
|
||||
direction = dir;
|
||||
}
|
||||
|
||||
void move() {
|
||||
position.x += direction.x;
|
||||
position.y += direction.y;
|
||||
}
|
||||
|
||||
void set_speed(int dx, int dy) {
|
||||
direction.x = dx;
|
||||
direction.y = dy;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
struct Point {
|
||||
int x, y;
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue