Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/trunk/core/player.cc @ 1904

Last change on this file since 1904 was 1900, checked in by patrick, 20 years ago

orxonox/trunk: hardware independant game speed, more shoots, more speed - see mail

File size: 1.6 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
22
23using namespace std;
24
25
26Player::Player () {
27  // cout << "Player::Player" << endl;
28  xCor = yCor = zCor = 0;
29  shootLaser = new ShootLaser;
30}
31
32Player::~Player () 
33{
34  //delete shootLaser;
35}
36
37
38void Player::setPosition( float x, float y, float z)
39{
40  xCor = x; yCor = y; zCor = z;
41}
42
43
44void Player::getPosition(float* x, float* y, float* z)
45{
46  *x = xCor; *y = yCor; *z = zCor;
47}
48
49
50void Player::setCollisionRadius(float radius) 
51{
52  collisionRadius = radius;
53}
54
55
56void Player::goX(float x) 
57{
58  //cout << "Player::goX" << endl;
59  xCor += x;
60}
61
62
63void Player::goY(float y)
64{
65  yCor += y;
66}
67
68void Player::goZ(float z)
69{
70  zCor += z;
71}
72
73void 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
85void 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
Note: See TracBrowser for help on using the repository browser.