Last change
on this file since 2167 was
1956,
checked in by bensch, 20 years ago
|
orxonox/trunk: now the Trunk should be merged with the new Makefile. Hopefully it works
|
File size:
1.2 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 "npc.h" |
---|
20 | |
---|
21 | #include <iostream> |
---|
22 | |
---|
23 | |
---|
24 | using namespace std; |
---|
25 | |
---|
26 | |
---|
27 | NPC::NPC () |
---|
28 | { |
---|
29 | hasDied = 0; |
---|
30 | } |
---|
31 | |
---|
32 | NPC::~NPC () {} |
---|
33 | |
---|
34 | |
---|
35 | void NPC::setPosition(float x, float y, float z) |
---|
36 | { |
---|
37 | xCor = x; yCor = y; zCor = z; |
---|
38 | } |
---|
39 | |
---|
40 | void NPC::getPosition(float* x, float* y, float* z) |
---|
41 | { |
---|
42 | *x = xCor; |
---|
43 | *y = yCor; |
---|
44 | *z = zCor; |
---|
45 | } |
---|
46 | |
---|
47 | void NPC::setCollisionRadius(float r) |
---|
48 | { |
---|
49 | collisionRadius = r; |
---|
50 | } |
---|
51 | |
---|
52 | float NPC::getCollisionRadius() |
---|
53 | { |
---|
54 | return collisionRadius; |
---|
55 | } |
---|
56 | |
---|
57 | |
---|
58 | void NPC::addAI(AI* ai) |
---|
59 | { |
---|
60 | |
---|
61 | } |
---|
62 | |
---|
63 | void NPC::drawNPC(void) |
---|
64 | { |
---|
65 | /* fix: died flag approach is very stupid, just to show @ convention */ |
---|
66 | if( hasDied == 0 ) { |
---|
67 | glPushMatrix(); |
---|
68 | glTranslatef(xCor, yCor, 3.0); |
---|
69 | //glScalef(1.0, 3.0, 1.0); |
---|
70 | glutWireSphere(1.0, 10, 10); |
---|
71 | glPopMatrix(); |
---|
72 | } |
---|
73 | } |
---|
74 | |
---|
75 | |
---|
76 | /* define the reaction, if the ship is been hit */ |
---|
77 | int NPC::hit() |
---|
78 | { |
---|
79 | die(); |
---|
80 | return 0; |
---|
81 | } |
---|
82 | |
---|
83 | void NPC::die() |
---|
84 | { |
---|
85 | hasDied = 1; |
---|
86 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.