Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 2756 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
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;
[2034]31  shootRocket = new ShootRocket; 
32  // Loads the 3ds Model, John
33  TestModel.Import3ds();
[1872]34}
[1853]35
[1896]36Player::~Player () 
37{
38  //delete shootLaser;
39}
[1853]40
41
[1879]42void Player::setPosition( float x, float y, float z)
[1858]43{
44  xCor = x; yCor = y; zCor = z;
45}
46
[1896]47
48void Player::getPosition(float* x, float* y, float* z)
[1872]49{
50  *x = xCor; *y = yCor; *z = zCor;
51}
[1858]52
[1900]53
54void Player::setCollisionRadius(float radius) 
55{
56  collisionRadius = radius;
57}
58
59
[1879]60void Player::goX(float x) 
[1872]61{
[1896]62  //cout << "Player::goX" << endl;
[1872]63  xCor += x;
64}
65
66
[1879]67void Player::goY(float y)
[1872]68{
69  yCor += y;
70}
71
[1879]72void Player::goZ(float z)
[1872]73{
74  zCor += z;
75}
76
[1896]77void Player::shoot(int n) 
78{
[1957]79  //  if (shootLaser->inhibitor++ <= 100)
[1941]80    shootLaser->addShoot(xCor, yCor, zCor);
[1957]81    // else if (shootLaser->inhibitor++ <= 200)
[1941]82    shootLaser->addShootExt(xCor, yCor, zCor, .1, .4, .0);
[1957]83    //  else if (shootLaser->inhibitor++ <= 300)
[1941]84    shootLaser->addShootExt(xCor, yCor, zCor, -0.1, .4, .0);
[1957]85    //  else
[1941]86    shootLaser->inhibitor =0;
87 
[1957]88    //  if (shootRocket->inhibitor++ >=80)
[1941]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);
[1957]94      //  if (shootRocket->inhibitor >=90)
95      //        shootRocket->inhibitor =0;
[1941]96    }
[1896]97  //cout << "Player::shoot" << endl;
[1872]98}
99
100
101//void Player::addIO(InputOutput *io) {}
102
103
[1858]104void Player::drawPlayer(void) 
105{
[1879]106  glPushMatrix();
[1896]107  glTranslatef(xCor, yCor, 3.0);
[1879]108  glScalef(1.0, 3.0, 1.0);
[2034]109  // Draws the TestModel as a Wireframe, John
110  TestModel.Draw( GL_LINE_STRIP );
[1879]111  glPopMatrix();
[1896]112  /* draw all the shoots additionaly */
113  shootLaser->drawShoot();
[1920]114  shootRocket->drawShoot();
[1896]115  //cout << "Player::drawPlayer" << endl;
116}
[1879]117
118
[1896]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.