Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 2007 was 1957, checked in by bensch, 20 years ago

orxonox/truk: now the rockets are frame-rate-driven

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