Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/trunk/src/world_entities/test_gun.cc @ 3683

Last change on this file since 3683 was 3683, checked in by patrick, 19 years ago

orxonox/trunk: projectile speed issue: fixed some strange behaveour. still got the problem, that the the projectile have variable relative speeds to the player…

File size: 2.7 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   \todo: direction in which the projectile flights
19   \todo: a target to set/hit
20*/
21
22
23#include "test_gun.h"
24
25#include "stdincl.h"
26#include "world_entity.h"
27#include "model.h"
28#include "projectile.h"
29
30#include "vector.h"
31#include "list.h"
32
33using namespace std;
34
35
36/**
37   \brief standard constructor
38
39   creates a new weapon
40*/
41TestGun::TestGun (PNode* parent, Vector* coordinate, Quaternion* direction) 
42  :  Weapon (parent, coordinate, direction) 
43{
44}
45
46
47/**
48   \brief standard deconstructor
49*/
50TestGun::~TestGun () 
51{
52  // model will be deleted from WorldEntity-destructor
53}
54
55
56/**
57   \brief this activates the weapon
58
59   This is needed, since there can be more than one weapon on a ship. the
60   activation can be connected with an animation. for example the weapon is
61   been armed out.
62*/
63void TestGun::activate()
64{}
65
66
67/**
68   \brief this deactivates the weapon
69
70   This is needed, since there can be more than one weapon on a ship. the
71   activation can be connected with an animation. for example the weapon is
72   been armed out.
73*/
74void TestGun::deactivate()
75{}
76
77
78/**
79   \brief fires the weapon
80   
81   this is called from the player.cc, when fire-button is been pushed
82*/
83void TestGun::fire()
84{
85  //printf("TestGun::fire() - firing weapon now ---------------------------\n");
86  Projectile* pj = new Projectile(this);
87
88  Vector* v = new Vector();
89  *v = this->getAbsCoor();
90  pj->setAbsCoor(v);
91  Quaternion* q = new Quaternion();
92  *q = this->getAbsDir();
93  pj->setAbsDir(q);
94
95  pj->setFlightDirection(q);
96  pj->setSpeed(this->getSpeed());
97
98
99
100  this->worldEntities->add(pj);
101}
102
103
104/**
105   \brief is called, when the weapon gets hit (=collide with something)
106   \param from which entity it is been hit
107   \param where it is been hit
108
109   this may not be used, since it would make the game relay complicated when one
110   can destroy the weapons of enemies or vice versa.
111*/
112void TestGun::hit (WorldEntity* entity, Vector* position) 
113{}
114
115
116/**
117   \brief is called, when the weapon is destroyed
118
119   this is in conjunction with the hit function, so when a weapon is able to get
120   hit, it can also be destoryed.
121*/
122void TestGun::destroy () 
123{}
124
125
126/**
127   \brief tick signal for time dependent/driven stuff
128*/
129void TestGun::tick (float time) 
130{}
131
132
133/**
134   \brief is called, when there is no fire button pressed
135*/
136void TestGun::weaponIdle()
137{}
138
139
140/**
141   \brief this will draw the weapon
142*/
143void TestGun::draw () 
144{}
145
Note: See TracBrowser for help on using the repository browser.