Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/world_entities/space_ships/collision_probe.cc @ 10305

Last change on this file since 10305 was 10114, checked in by patrick, 18 years ago

merged network back to trunk

File size: 2.1 KB
Line 
1/*
2   orxonox - the future of 3D-vertical-scrollers
3
4   Copyright (C) 2004 orx
5
6   This program is free software; you can redistribute it and/or modify
7   it under the terms of the GNU General Public License as published by
8   the Free Software Foundation; either version 2, or (at your option)
9   any later version.
10
11### File Specific:
12   main-programmer: Patrick Boenzli
13*/
14
15#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WORLD_ENTITY
16
17
18#include "collision_probe.h"
19
20#include "util/loading/factory.h"
21#include "util/loading/load_param.h"
22
23#include "md2/md2Model.h"
24
25
26
27ObjectListDefinition(CollisionProbe);
28
29CREATE_FACTORY(CollisionProbe);
30
31
32/**
33 *  destructs the spaceship, deletes alocated memory
34 */
35CollisionProbe::~CollisionProbe ()
36{}
37
38
39/**
40 *  creates a new Spaceship from Xml Data
41 * @param root the xml element containing spaceship data
42
43   @todo add more parameters to load
44*/
45CollisionProbe::CollisionProbe(const TiXmlElement* root)
46{
47  this->init();
48
49  if (root != NULL)
50    this->loadParams(root);
51}
52
53
54/**
55 * initializes a Spaceship
56 */
57void CollisionProbe::init()
58{
59  this->registerObject(this, CollisionProbe::_objectList);
60
61  bUp = bDown = bLeft = bRight = bAscend = bDescend = bRollL = bRollR = false;
62
63  this->setHealthMax(100);
64  this->setHealth(80);
65
66  this->toList(OM_GROUP_00);
67  this->loadMD2Texture("maps/dr_freak.pcx");
68  this->loadModel("models/dr_freak.md2");
69
70  this->localVelocity = Vector(0,0,0);
71}
72
73
74/**
75 * loads the Settings of a CollisionProbe from an XML-element.
76 * @param root the XML-element to load the Spaceship's properties from
77 */
78void CollisionProbe::loadParams(const TiXmlElement* root)
79{
80  Playable::loadParams(root);
81}
82
83
84
85/**
86 *  draws the spaceship after transforming it.
87*/
88void CollisionProbe::draw () const
89{
90  WorldEntity::draw();
91}
92
93
94/**
95 *  the function called for each passing timeSnap
96 * @param time The timespan passed since last update
97 */
98void CollisionProbe::tick (float time)
99{
100  if( likely(this->getModel(0) != NULL))
101    ((MD2Model*)this->getModel(0))->tick(time);
102
103  this->shiftCoor(this->localVelocity * time);
104}
105
106
107/**
108 * @todo switch statement ??
109 */
110void CollisionProbe::process(const Event &event)
111{
112
113}
114
115
116
117
Note: See TracBrowser for help on using the repository browser.