Mercurial > hg > Members > kono > Cerium
comparison TaskManager/Test/test_render/Application/ieshoot.cc @ 539:7b4434d6f078
SGList isn't used
author | tkaito@henri.cr.ie.u-ryukyu.ac.jp |
---|---|
date | Wed, 21 Oct 2009 19:56:00 +0900 |
parents | d47c5d865970 |
children | e40b32f0f71e |
comparison
equal
deleted
inserted
replaced
535:f8d56635efb8 | 539:7b4434d6f078 |
---|---|
1 #include "SceneGraphRoot.h" | 1 #include "SceneGraphRoot.h" |
2 #include "SGList.h" | |
3 | 2 |
4 static const float jiki_speed = 6.0f; | 3 static const float jiki_speed = 6.0f; |
5 static const float jiki_radius = 32.0f; | 4 static const float jiki_radius = 32.0f; |
6 | 5 |
7 static const float tama_speed = 10.0f; | 6 static const float tama_speed = 10.0f; |
36 | 35 |
37 static void | 36 static void |
38 ieboss_collision(SceneGraphPtr node, int screen_w, int screen_h, | 37 ieboss_collision(SceneGraphPtr node, int screen_w, int screen_h, |
39 SceneGraphPtr tree) | 38 SceneGraphPtr tree) |
40 { | 39 { |
40 #if 0 | |
41 SceneGraphIteratorPtr it = sgroot->getIterator(tree); | 41 SceneGraphIteratorPtr it = sgroot->getIterator(tree); |
42 static int damage = 0; | 42 static int damage = 0; |
43 | 43 |
44 for (; it->hasNext(IETAMA);) { | 44 for (; it->hasNext(IETAMA);) { |
45 it->next(IETAMA); | 45 it->next(IETAMA); |
50 && node->xyz[1] + boss_radius_y > tama->xyz[1] - tama_radius) { | 50 && node->xyz[1] + boss_radius_y > tama->xyz[1] - tama_radius) { |
51 tama->remove(); | 51 tama->remove(); |
52 | 52 |
53 node->set_move_collision(ieboss_move, ieboss_collision_invincibil); | 53 node->set_move_collision(ieboss_move, ieboss_collision_invincibil); |
54 | 54 |
55 SceneGraphPtr iebosstama = sgroot->createSceneGraph(Earth); | 55 SceneGraphPtr iebosstama = sgroot->createSceneGraph("Earth"); |
56 iebosstama->set_move_collision(iebosstama_move, ietama_collision); | 56 iebosstama->set_move_collision(iebosstama_move, ietama_collision); |
57 iebosstama->xyz[0] = node->xyz[0]; | 57 iebosstama->xyz[0] = node->xyz[0]; |
58 iebosstama->xyz[1] = node->xyz[1] + boss_radius_y; | 58 iebosstama->xyz[1] = node->xyz[1] + boss_radius_y; |
59 //iebosstama->xyz[2] = 50.0f; | 59 //iebosstama->xyz[2] = 50.0f; |
60 node->addBrother(iebosstama); | 60 node->addBrother(iebosstama); |
64 } | 64 } |
65 | 65 |
66 if (damage > 10) { | 66 if (damage > 10) { |
67 node->remove(); | 67 node->remove(); |
68 } | 68 } |
69 #endif | |
69 } | 70 } |
70 | 71 |
71 static void | 72 static void |
72 ieboss_move(SceneGraphPtr node, int screen_w, int screen_h) | 73 ieboss_move(SceneGraphPtr node, int screen_w, int screen_h) |
73 { | 74 { |
95 } else if (node->xyz[2] <= -100.0f) { | 96 } else if (node->xyz[2] <= -100.0f) { |
96 node->xyz[2] = -99.99f; | 97 node->xyz[2] = -99.99f; |
97 z_speed = -z_speed; | 98 z_speed = -z_speed; |
98 } | 99 } |
99 } | 100 } |
100 | 101 #if 0 |
101 static void | 102 static void |
102 ieboss_collision_invincibil(SceneGraphPtr node, int screen_w, int screen_h, | 103 ieboss_collision_invincibil(SceneGraphPtr node, int screen_w, int screen_h, |
103 SceneGraphPtr tree) | 104 SceneGraphPtr tree) |
104 { | 105 { |
105 static int frame = 0; | 106 static int frame = 0; |
123 // 描画領域から抜けたら削除 | 124 // 描画領域から抜けたら削除 |
124 if (node->xyz[1] > screen_h) { | 125 if (node->xyz[1] > screen_h) { |
125 node->remove(); | 126 node->remove(); |
126 } | 127 } |
127 } | 128 } |
129 #endif | |
128 | 130 |
129 static void | 131 static void |
130 ietama_move(SceneGraphPtr node, int screen_w, int screen_h) | 132 ietama_move(SceneGraphPtr node, int screen_w, int screen_h) |
131 { | 133 { |
132 node->xyz[1] -= tama_speed; | 134 node->xyz[1] -= tama_speed; |
177 node->xyz[1] = screen_h - jiki_radius; | 179 node->xyz[1] = screen_h - jiki_radius; |
178 } | 180 } |
179 } | 181 } |
180 | 182 |
181 if (pad->circle.isPush()) { | 183 if (pad->circle.isPush()) { |
182 SceneGraphPtr ietama = sgroot->createSceneGraph(IETAMA); | 184 SceneGraphPtr ietama = sgroot->createSceneGraph("IETAMA"); |
183 ietama->set_move_collision(ietama_move, ietama_collision); | 185 ietama->set_move_collision(ietama_move, ietama_collision); |
184 ietama->xyz[0] = node->xyz[0]; | 186 ietama->xyz[0] = node->xyz[0]; |
185 ietama->xyz[1] = node->xyz[1]; | 187 ietama->xyz[1] = node->xyz[1]; |
186 node->addBrother(ietama); | 188 node->addBrother(ietama); |
187 } | 189 } |
193 { | 195 { |
194 SceneGraphPtr iejiki; | 196 SceneGraphPtr iejiki; |
195 SceneGraphPtr enemy; | 197 SceneGraphPtr enemy; |
196 SceneGraphPtr back; | 198 SceneGraphPtr back; |
197 | 199 |
198 sgroot->createFromXMLfile(manager, "xml_file/ietama.xml"); | 200 sgroot->createFromXMLmemory(manager, "xml_file/ietama.xml"); |
199 sgroot->createFromXMLfile(manager, "xml_file/ieboss.xml"); | 201 sgroot->createFromXMLmemory(manager, "xml_file/ieboss.xml"); |
200 sgroot->createFromXMLfile(manager, "xml_file/iejiki.xml"); | 202 sgroot->createFromXMLmemory(manager, "xml_file/iejiki.xml"); |
201 sgroot->createFromXMLfile(manager, "xml_file/universe.xml"); | 203 sgroot->createFromXMLmemory(manager, "xml_file/universe.xml"); |
202 | 204 |
203 back = sgroot->createSceneGraph(); | 205 back = sgroot->createSceneGraph(); |
204 | 206 |
205 iejiki = sgroot->createSceneGraph(IEJIKI); | 207 iejiki = sgroot->createSceneGraph("IEJIKI"); |
206 iejiki->set_move_collision(iejiki_move, iejiki_collision); | 208 iejiki->set_move_collision(iejiki_move, iejiki_collision); |
207 iejiki->xyz[2] = 20; | 209 iejiki->xyz[2] = 20; |
208 back->addChild(iejiki); | 210 back->addChild(iejiki); |
209 | 211 |
210 enemy = sgroot->createSceneGraph(IEBOSS); | 212 enemy = sgroot->createSceneGraph("IEBOSS"); |
211 enemy->set_move_collision(ieboss_move, ieboss_collision); | 213 enemy->set_move_collision(ieboss_move, ieboss_collision); |
212 enemy->xyz[1] = boss_radius_y; | 214 enemy->xyz[1] = boss_radius_y; |
213 back->addChild(enemy); | 215 back->addChild(enemy); |
214 | 216 |
215 sgroot->setSceneData(back); | 217 sgroot->setSceneData(back); |