Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/branches/dave/core/player.cc @ 2102

Last change on this file since 2102 was 1994, checked in by dave, 20 years ago

orxonox/branches/dave:[test the Shit]

File size: 2.4 KB
Line 
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#include <stdlib.h>
22
23
24using namespace std;
25
26
27Player::Player () {
28  // cout << "Player::Player" << endl;
29  xCor = yCor = zCor = 0;
30  shootLaser = new ShootLaser;
31  shootRocket = new ShootRocket;
32}
33
34Player::~Player () 
35{
36  //delete shootLaser;
37}
38
39
40void Player::setPosition( float x, float y, float z)
41{
42  xCor = x; yCor = y; zCor = z;
43}
44
45
46void Player::getPosition(float* x, float* y, float* z)
47{
48  *x = xCor; *y = yCor; *z = zCor;
49}
50
51
52void Player::setCollisionRadius(float radius) 
53{
54  collisionRadius = radius;
55}
56
57
58void Player::goX(float x) 
59{
60  //cout << "Player::goX" << endl;
61  xCor += x;
62}
63
64
65void Player::goY(float y)
66{
67  yCor += y;
68}
69
70void Player::goZ(float z)
71{
72  zCor += z;
73}
74
75void Player::shoot(int n) 
76{
77    shootLaser->addShoot(xCor,yCor+1.0,5);
78    //shootLaser->addShootExt(xCor,yCor,zCor,.1,.4,.0);
79    //shootLaser->addShootdExt(xCor,yCor,zCor,-.1,.4,.0);
80    shootRocket->addBackParable(xCor,yCor,zCor);
81
82
83
84}
85
86//void Player::addIO(InputOutput *io) {}
87
88
89void Player::drawPlayer(float a, float b) 
90{
91 
92  /*glPushMatrix();
93  glTranslatef(xCor, yCor, 3.0);
94  glScalef(1.0, 3.0, 1.0);
95  glutWireCube(1.0);
96  glPopMatrix();*/ 
97  glPushMatrix();
98  //glEnable(GL_DEPTH_TEST);
99  glTranslatef(xCor,yCor,5.0);
100  glRotatef(3*a,1.0,0.0,0.0);
101  glRotatef(3*b,0.0,1.0,0.0);
102  //glTranslatef(xCor,yCor,3.0);
103  glBegin(GL_QUADS);
104  glColor3f(1.0,0.0,0.0);
105  glNormal3f(-1.0,0.0,0.0);
106  glVertex3f(-1.0,-1.0,-1.0);
107  glVertex3f(-1.0,-1.0,1.0);
108  glVertex3f(-.6,1.0,0.4);
109  glVertex3f(-.6,1.0,-0.4);
110 
111  glNormal3f(0.0,-1.0,0.0);
112  glColor3f(0.0,1.0,0.0);
113  glVertex3f(-.6,1.0,.4);
114  glVertex3f(-.6,1.0,-.4);
115  glVertex3f(.6,1.0,-.4);
116  glVertex3f(.6,1.0,.4);
117 
118  glNormal3f(-1.0,0.0,0.0);
119  glColor3f(0.0,0.0,1.0);
120  glVertex3f(.6,1.0,.4);
121  glVertex3f(.6,1.0,-.4);
122  glVertex3f(1.0,-1.0,-1.0);
123  glVertex3f(1.0,-1.0,1.0);
124 
125 
126 
127  glEnd();
128  glPopMatrix(); 
129 
130 
131 
132 
133 
134  /* draw all the shoots additionaly */
135  shootLaser->drawShoot();
136  shootRocket->drawShoot();
137  //cout << "Player::drawPlayer" << endl;
138}
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
Note: See TracBrowser for help on using the repository browser.