Mudanca leve no oculos
[Projeto-PCG.git] / player.cpp
blob587de23b94b586263273c82c4d98286b1e83946d
1 #include "player.h"
2 #include "shot.h"
4 Player::Player(Game* agame, Ponto pos, Ponto speed): Shooter(agame, pos, speed) {
5 hp = MAXHP;
8 void Player::desenha() {
9 game->desenhaMira(aim);
10 Shooter::desenha();
13 void Player::collide(Thing *b) {
14 Shot* shot = dynamic_cast<Shot*>(b);
15 if (shot && shot->firedBy != this) {
16 shot->dead = true;
17 if (this->getPosition().x < shot->firedBy->getPosition().x)
18 addToAngle -= 0.5;
19 else
20 addToAngle += 0.5;
21 addToAngle = std::max(std::min(addToAngle, PI/2),-PI/2);
22 hp -= shot->damage;
23 if (hp <= 0) {
24 dead = true;
29 void Player::drawEquipment() {
30 glPushMatrix();
31 Ponto hip = cintura();
32 Ponto leftfeet = leftFeet();
33 Ponto rightfeet = rightFeet();
34 glTranslatef(hip.x,hip.y,0);
35 glRotatef(bodyAngle*180.0/PI,0,0,1);
36 glTranslatef(0,-11-30,0); //cabeca
37 if (crawl)
38 glRotatef(-bodyAngle*180.0/PI,0,0,1);
39 glBegin(GL_POLYGON);
40 glVertex3f(-11,-2,0);
41 glVertex3f( 11,-2,0);
42 glVertex3f( 11,-1,0);
43 glVertex3f(-11,-1,0);
44 glEnd();
45 glBegin(GL_POLYGON);
46 glVertex3f(11,-2,0);
47 glVertex3f(11, 2,0);
48 glVertex3f( 5, 2,0);
49 glVertex3f( 2,-2,0);
50 glEnd();
51 glPopMatrix();