Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/branches/john/src/player.cc @ 3028

Last change on this file since 3028 was 2034, checked in by john, 20 years ago

Ich habe die 3ds Model Funktion hinzugefügt.

Funktioniert bislang nur, falls sich eine Datei test.3ds im gleichen Verzeichnis befindet!!!

File size: 2.3 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  // Loads the 3ds Model, John
33  TestModel.Import3ds();
34}
35
36Player::~Player () 
37{
38  //delete shootLaser;
39}
40
41
42void Player::setPosition( float x, float y, float z)
43{
44  xCor = x; yCor = y; zCor = z;
45}
46
47
48void Player::getPosition(float* x, float* y, float* z)
49{
50  *x = xCor; *y = yCor; *z = zCor;
51}
52
53
54void Player::setCollisionRadius(float radius) 
55{
56  collisionRadius = radius;
57}
58
59
60void Player::goX(float x) 
61{
62  //cout << "Player::goX" << endl;
63  xCor += x;
64}
65
66
67void Player::goY(float y)
68{
69  yCor += y;
70}
71
72void Player::goZ(float z)
73{
74  zCor += z;
75}
76
77void Player::shoot(int n) 
78{
79  //  if (shootLaser->inhibitor++ <= 100)
80    shootLaser->addShoot(xCor, yCor, zCor);
81    // else if (shootLaser->inhibitor++ <= 200)
82    shootLaser->addShootExt(xCor, yCor, zCor, .1, .4, .0);
83    //  else if (shootLaser->inhibitor++ <= 300)
84    shootLaser->addShootExt(xCor, yCor, zCor, -0.1, .4, .0);
85    //  else
86    shootLaser->inhibitor =0;
87 
88    //  if (shootRocket->inhibitor++ >=80)
89    {
90      shootRocket->addBackParable(xCor, yCor, zCor);
91      shootRocket->addSideAcc(xCor, yCor, zCor, RIGHT);
92      shootRocket->addSideAcc(xCor, yCor, zCor, LEFT);
93      shootRocket->addRotater(xCor, yCor, zCor);
94      //  if (shootRocket->inhibitor >=90)
95      //        shootRocket->inhibitor =0;
96    }
97  //cout << "Player::shoot" << endl;
98}
99
100
101//void Player::addIO(InputOutput *io) {}
102
103
104void Player::drawPlayer(void) 
105{
106  glPushMatrix();
107  glTranslatef(xCor, yCor, 3.0);
108  glScalef(1.0, 3.0, 1.0);
109  // Draws the TestModel as a Wireframe, John
110  TestModel.Draw( GL_LINE_STRIP );
111  glPopMatrix();
112  /* draw all the shoots additionaly */
113  shootLaser->drawShoot();
114  shootRocket->drawShoot();
115  //cout << "Player::drawPlayer" << endl;
116}
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
Note: See TracBrowser for help on using the repository browser.