Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/trunk/src/npc.cc @ 3288

Last change on this file since 3288 was 2036, checked in by patrick, 20 years ago

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

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