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
|
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 | #include <iostream> |
---|
19 | #include <GL/glut.h> |
---|
20 | |
---|
21 | #include "ai.h" |
---|
22 | #include "data_tank.h" |
---|
23 | |
---|
24 | #include "npc.h" |
---|
25 | |
---|
26 | using namespace std; |
---|
27 | |
---|
28 | |
---|
29 | NPC::NPC() |
---|
30 | : WorldEntity() |
---|
31 | { |
---|
32 | hasDied = 0; |
---|
33 | } |
---|
34 | |
---|
35 | NPC::~NPC () {} |
---|
36 | |
---|
37 | |
---|
38 | void NPC::setPosition(float x, float y, float z) |
---|
39 | { |
---|
40 | xCor = x; yCor = y; zCor = z; |
---|
41 | } |
---|
42 | |
---|
43 | void NPC::getPosition(float* x, float* y, float* z) |
---|
44 | { |
---|
45 | *x = xCor; |
---|
46 | *y = yCor; |
---|
47 | *z = zCor; |
---|
48 | } |
---|
49 | |
---|
50 | void NPC::setCollisionRadius(float r) |
---|
51 | { |
---|
52 | collisionRadius = r; |
---|
53 | } |
---|
54 | |
---|
55 | float NPC::getCollisionRadius() |
---|
56 | { |
---|
57 | return collisionRadius; |
---|
58 | } |
---|
59 | |
---|
60 | |
---|
61 | void NPC::addAI(AI* ai) |
---|
62 | {} |
---|
63 | |
---|
64 | void NPC::paint() |
---|
65 | { |
---|
66 | //cout << "WorldEntity::WorldEntity();" << endl; |
---|
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 | } |
---|
75 | } |
---|
76 | |
---|
77 | void NPC::drawNPC() |
---|
78 | { |
---|
79 | |
---|
80 | } |
---|
81 | |
---|
82 | |
---|
83 | /* define the reaction, if the ship is been hit */ |
---|
84 | int NPC::hit() |
---|
85 | { |
---|
86 | die(); |
---|
87 | return 0; |
---|
88 | } |
---|
89 | |
---|
90 | |
---|
91 | void NPC::die() |
---|
92 | { |
---|
93 | hasDied = 1; |
---|
94 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.