Last change
on this file since 2624 was
2058,
checked in by chris, 21 years ago
|
orxonox/branches/chris: Trunk remerged into my branch started on SDL reconfiguration
|
File size:
1.4 KB
|
Rev | Line | |
---|
[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. |
---|
[1855] | 12 | |
---|
| 13 | ### File Specific: |
---|
| 14 | main-programmer: Patrick Boenzli |
---|
| 15 | co-programmer: |
---|
[1853] | 16 | */ |
---|
| 17 | |
---|
[2058] | 18 | #include <iostream> |
---|
| 19 | #include <GL/glut.h> |
---|
[1853] | 20 | |
---|
[2058] | 21 | #include "ai.h" |
---|
| 22 | #include "data_tank.h" |
---|
| 23 | |
---|
[1853] | 24 | #include "npc.h" |
---|
| 25 | |
---|
[1858] | 26 | using namespace std; |
---|
[1853] | 27 | |
---|
[1858] | 28 | |
---|
[2058] | 29 | NPC::NPC() |
---|
| 30 | : WorldEntity() |
---|
[1931] | 31 | { |
---|
| 32 | hasDied = 0; |
---|
| 33 | } |
---|
[1853] | 34 | |
---|
| 35 | NPC::~NPC () {} |
---|
| 36 | |
---|
| 37 | |
---|
[1899] | 38 | void NPC::setPosition(float x, float y, float z) |
---|
[1858] | 39 | { |
---|
| 40 | xCor = x; yCor = y; zCor = z; |
---|
| 41 | } |
---|
| 42 | |
---|
[1899] | 43 | void NPC::getPosition(float* x, float* y, float* z) |
---|
[1858] | 44 | { |
---|
| 45 | *x = xCor; |
---|
| 46 | *y = yCor; |
---|
| 47 | *z = zCor; |
---|
| 48 | } |
---|
| 49 | |
---|
[1899] | 50 | void NPC::setCollisionRadius(float r) |
---|
[1896] | 51 | { |
---|
| 52 | collisionRadius = r; |
---|
| 53 | } |
---|
[1858] | 54 | |
---|
[1896] | 55 | float NPC::getCollisionRadius() |
---|
| 56 | { |
---|
| 57 | return collisionRadius; |
---|
| 58 | } |
---|
| 59 | |
---|
| 60 | |
---|
[1904] | 61 | void NPC::addAI(AI* ai) |
---|
[2058] | 62 | {} |
---|
[1896] | 63 | |
---|
[2058] | 64 | void NPC::paint() |
---|
[1858] | 65 | { |
---|
[2058] | 66 | //cout << "WorldEntity::WorldEntity();" << endl; |
---|
[1931] | 67 | /* fix: died flag approach is very stupid, just to show @ convention */ |
---|
| 68 | if( hasDied == 0 ) { |
---|
| 69 | glPushMatrix(); |
---|
| 70 | glTranslatef(xCor, yCor, 3.0); |
---|
| 71 | //glScalef(1.0, 3.0, 1.0); |
---|
| 72 | glutWireSphere(1.0, 10, 10); |
---|
| 73 | glPopMatrix(); |
---|
| 74 | } |
---|
[1858] | 75 | } |
---|
[1931] | 76 | |
---|
[2058] | 77 | void NPC::drawNPC() |
---|
| 78 | { |
---|
[1931] | 79 | |
---|
[2058] | 80 | } |
---|
| 81 | |
---|
| 82 | |
---|
[1931] | 83 | /* define the reaction, if the ship is been hit */ |
---|
| 84 | int NPC::hit() |
---|
| 85 | { |
---|
| 86 | die(); |
---|
| 87 | return 0; |
---|
| 88 | } |
---|
| 89 | |
---|
[2058] | 90 | |
---|
[1931] | 91 | void NPC::die() |
---|
| 92 | { |
---|
| 93 | hasDied = 1; |
---|
| 94 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.