Last change
on this file since 6040 was
6040,
checked in by manuel, 18 years ago
|
hopefully we see some colored spheres arounf powerups now
|
File size:
1.3 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: Manuel Leuenberger |
---|
13 | co-programmer: ... |
---|
14 | */ |
---|
15 | |
---|
16 | #define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WORLD_ENTITY |
---|
17 | |
---|
18 | |
---|
19 | #include "power_up.h" |
---|
20 | #include "extendable.h" |
---|
21 | #include "primitive_model.h" |
---|
22 | |
---|
23 | using namespace std; |
---|
24 | |
---|
25 | Model* PowerUp::sphereModel = new PrimitiveModel(PRIM_SPHERE, 7, 5); |
---|
26 | |
---|
27 | PowerUp::PowerUp(float r, float g, float b) |
---|
28 | { |
---|
29 | this->sphereMaterial = new Material; |
---|
30 | this->sphereMaterial->setTransparency(.1); |
---|
31 | this->sphereMaterial->setDiffuse(r, g, b); |
---|
32 | } |
---|
33 | |
---|
34 | PowerUp::~PowerUp () |
---|
35 | { |
---|
36 | delete this->sphereMaterial; |
---|
37 | } |
---|
38 | |
---|
39 | |
---|
40 | void PowerUp::loadParams(const TiXmlElement* root) |
---|
41 | { |
---|
42 | static_cast<WorldEntity*>(this)->loadParams(root); |
---|
43 | } |
---|
44 | |
---|
45 | |
---|
46 | void PowerUp::collidesWith (WorldEntity* entity, const Vector& location) |
---|
47 | { |
---|
48 | if(entity->isA(CL_EXTENDABLE)) |
---|
49 | { |
---|
50 | if(dynamic_cast<Extendable*>(entity)->pickup(this)) |
---|
51 | { |
---|
52 | this->hide(); |
---|
53 | } |
---|
54 | } |
---|
55 | } |
---|
56 | |
---|
57 | void PowerUp::hide() |
---|
58 | { |
---|
59 | this->setVisibiliy(false); |
---|
60 | } |
---|
61 | |
---|
62 | void PowerUp::draw() |
---|
63 | { |
---|
64 | WorldEntity::draw(); |
---|
65 | this->sphereMaterial->select(); |
---|
66 | sphereModel->draw(); |
---|
67 | } |
---|
68 | |
---|
Note: See
TracBrowser
for help on using the repository browser.