Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/branches/shadows/src/npc.cc @ 4225

Last change on this file since 4225 was 2036, checked in by patrick, 21 years ago

orxonxo/trunk/src: extended framework: class inheritance, right including (had som bugs), framework not finished yet

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