Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/trunk/src/player.cc @ 2105

Last change on this file since 2105 was 2036, checked in by patrick, 20 years ago

orxonxo/trunk/src: extended framework: class inheritance, right including (had som bugs), framework not finished yet

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