Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 2032 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
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
18
19#include "npc.h"
20
[1858]21#include <iostream>
[1853]22
[1896]23
[1858]24using namespace std;
[1853]25
[1858]26
[1931]27NPC::NPC () 
28{
29  hasDied = 0;
30}
[1853]31
32NPC::~NPC () {}
33
34
[1899]35void NPC::setPosition(float x, float y, float z)
[1858]36{
37  xCor = x; yCor = y; zCor = z;
38}
39
[1899]40void NPC::getPosition(float* x, float* y, float* z) 
[1858]41{
42  *x = xCor; 
43  *y = yCor; 
44  *z = zCor;
45}
46
[1899]47void NPC::setCollisionRadius(float r) 
[1896]48{
49  collisionRadius = r;
50}
[1858]51
[1896]52float NPC::getCollisionRadius() 
53{
54  return collisionRadius;
55}
56
57
[1904]58void NPC::addAI(AI* ai)
59{
[1896]60
[1904]61}
62
[1858]63void NPC::drawNPC(void) 
64{
[1931]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  }
[1858]73}
[1931]74
75
76/* define the reaction, if the ship is been hit */
77int NPC::hit()
78{
79  die();
80  return 0;
81}
82
83void NPC::die()
84{
85  hasDied = 1;
86}
Note: See TracBrowser for help on using the repository browser.