Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/trunk/src/world_entities/npc.cc @ 4926

Last change on this file since 4926 was 4597, checked in by bensch, 19 years ago

orxonox/trunk: setClassID implemented in all files

File size: 1.4 KB
RevLine 
[1853]1
2
[4597]3/*
[1853]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
[4597]29NPC::NPC() : WorldEntity()
[1931]30{
[4597]31  this->setClassID(CL_NPC, "NPC");
[1931]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
[4597]43void NPC::getPosition(float* x, float* y, float* z)
[1858]44{
[4597]45  *x = xCor;
46  *y = yCor;
[1858]47  *z = zCor;
48}
49
[4597]50void NPC::setCollisionRadius(float r)
[1896]51{
52  collisionRadius = r;
53}
[1858]54
[4597]55float NPC::getCollisionRadius()
[1896]56{
57  return collisionRadius;
58}
59
60
[1904]61void NPC::addAI(AI* ai)
[2036]62{}
[1896]63
[2036]64void NPC::paint()
[1858]65{
[4597]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
[4597]77void NPC::drawNPC()
[2036]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.