-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathentities.cpp
57 lines (44 loc) · 1.37 KB
/
entities.cpp
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/**
* Copyright 2011 by Benjamin J. Land (a.k.a. BenLand100)
*
* This file is part of the CppCraft.
*
* CppCraft is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* CppCraft is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with CppCraft. If not, see <http://www.gnu.org/licenses/>.
*/
#include "entities.h"
#include <cmath>
Entity::Entity() : eid(0), x(0.0), y(0.0), z(0.0), height(0.0), vx(0.0), vy(0.0), vz(0.0), pitch(0.0), yaw(0.0) {
}
Entity::~Entity() {
}
Player::Player(char *name) : Entity(), apothem(0.40) {
int len = strlen(name);
this->name = new char[len+1];
strcpy(this->name,name);
}
Player::~Player() {
delete name;
}
void Player::boundingBox(int &sx,int &sy,int &sz,int &ex,int &ey,int &ez) {
sx = floor(x-apothem);
sy = floor(y);
sz = floor(z-apothem);
ex = floor(x+apothem);
ey = floor(y+1.74);
ez = floor(z+apothem);
}
Mob::Mob() : Entity() {
}
Mob::~Mob() {
}