1 | |
---|
2 | |
---|
3 | /* |
---|
4 | orxonox - the future of 3D-vertical-scrollers |
---|
5 | |
---|
6 | Copyright (C) 2004 orx |
---|
7 | |
---|
8 | This program is free software; you can redistribute it and/or modify |
---|
9 | it under the terms of the GNU General Public License as published by |
---|
10 | the Free Software Foundation; either version 2, or (at your option) |
---|
11 | any later version. |
---|
12 | |
---|
13 | ### File Specific: |
---|
14 | main-programmer: Patrick Boenzli |
---|
15 | co-programmer: |
---|
16 | */ |
---|
17 | |
---|
18 | |
---|
19 | #include "player.h" |
---|
20 | #include <iostream> |
---|
21 | |
---|
22 | |
---|
23 | using namespace std; |
---|
24 | |
---|
25 | |
---|
26 | Player::Player () { |
---|
27 | // cout << "Player::Player" << endl; |
---|
28 | xCor = yCor = zCor = 0; |
---|
29 | shootLaser = new ShootLaser; |
---|
30 | } |
---|
31 | |
---|
32 | Player::~Player () |
---|
33 | { |
---|
34 | //delete shootLaser; |
---|
35 | } |
---|
36 | |
---|
37 | |
---|
38 | void Player::setPosition( float x, float y, float z) |
---|
39 | { |
---|
40 | xCor = x; yCor = y; zCor = z; |
---|
41 | } |
---|
42 | |
---|
43 | |
---|
44 | void Player::getPosition(float* x, float* y, float* z) |
---|
45 | { |
---|
46 | *x = xCor; *y = yCor; *z = zCor; |
---|
47 | } |
---|
48 | |
---|
49 | |
---|
50 | void Player::setCollisionRadius(float radius) |
---|
51 | { |
---|
52 | collisionRadius = radius; |
---|
53 | } |
---|
54 | |
---|
55 | |
---|
56 | void Player::goX(float x) |
---|
57 | { |
---|
58 | //cout << "Player::goX" << endl; |
---|
59 | xCor += x; |
---|
60 | } |
---|
61 | |
---|
62 | |
---|
63 | void Player::goY(float y) |
---|
64 | { |
---|
65 | yCor += y; |
---|
66 | } |
---|
67 | |
---|
68 | void Player::goZ(float z) |
---|
69 | { |
---|
70 | zCor += z; |
---|
71 | } |
---|
72 | |
---|
73 | void Player::shoot(int n) |
---|
74 | { |
---|
75 | shootLaser->addShoot(xCor, yCor, zCor); |
---|
76 | shootLaser->addShootExt(xCor, yCor, zCor, .1, .4, .0); |
---|
77 | shootLaser->addShootExt(xCor, yCor, zCor, -0.1, .4, .0); |
---|
78 | //cout << "Player::shoot" << endl; |
---|
79 | } |
---|
80 | |
---|
81 | |
---|
82 | //void Player::addIO(InputOutput *io) {} |
---|
83 | |
---|
84 | |
---|
85 | void Player::drawPlayer(void) |
---|
86 | { |
---|
87 | glPushMatrix(); |
---|
88 | glTranslatef(xCor, yCor, 3.0); |
---|
89 | glScalef(1.0, 3.0, 1.0); |
---|
90 | glutWireCube(1.0); |
---|
91 | glPopMatrix(); |
---|
92 | /* draw all the shoots additionaly */ |
---|
93 | shootLaser->drawShoot(); |
---|
94 | //cout << "Player::drawPlayer" << endl; |
---|
95 | } |
---|
96 | |
---|
97 | |
---|
98 | |
---|
99 | |
---|
100 | |
---|
101 | |
---|
102 | |
---|
103 | |
---|
104 | |
---|
105 | |
---|
106 | |
---|
107 | |
---|
108 | |
---|
109 | |
---|
110 | |
---|
111 | |
---|
112 | |
---|
113 | |
---|
114 | |
---|
115 | |
---|
116 | |
---|
117 | |
---|
118 | |
---|
119 | |
---|
120 | |
---|
121 | |
---|