annotate Renderer/test_render/boss1_action.cpp @ 503:516d5c91d5b4 draft double-linked-task-list

comment
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sun, 11 Oct 2009 19:35:33 +0900
parents 15bfacccde99
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
283
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
1 #include "boss1_action.h"
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
2
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
3 static void
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
4 null_collision(SceneGraphPtr node, int screen_w, int screen_h,
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
5 SceneGraphPtr tree)
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
6 {
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
7 }
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
8
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
9 static void
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
10 boss1_move_right(SceneGraphPtr node, int screen_w, int screen_h) {
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
11 node->xyz[0] += node->stack_xyz[0];
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
12 if(node->xyz[0] > (screen_w - boss_radius_x)) {
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
13 node->set_move_collision(boss1_move_left, null_collision);
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
14 }
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
15 }
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
16
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
17 //ボスが左に移動する動作
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
18 static void
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
19 boss1_move_left(SceneGraphPtr node, int screen_w, int screen_h) {
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
20 node->xyz[0] -= node->stack_xyz[0];
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
21 if(node->xyz[0] < boss_radius_x) {
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
22 node->set_move_collision(boss1_move_right, null_collision);
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
23 }
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
24 }
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
25
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
26 static void
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
27 player_move(SceneGraphPtr node, int screen_w, int screen_h)
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
28 {
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
29 Pad *pad = sgroot->getController();
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
30
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
31 if (pad->left.isPush()
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
32 || pad->left.isHold()) {
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
33 #if 0
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
34 SceneGraphPtr player_left;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
35 player_left = sgroot->createSceneGraph(PLAYER_L);
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
36 player_left->set_move_collision(player_move_left, null_collision);
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
37 player_left->xyz[0] = node->xyz[0];
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
38 player_left->xyz[1] = node->xyz[1];
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
39 node->addChild(player_left);
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
40 node->flag_drawable = 1;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
41 #endif
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
42 node->xyz[0] -= player_speed;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
43
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
44 if (node->xyz[0] - player_radius< 0) {
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
45 node->xyz[0] = player_radius;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
46 }
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
47 }
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
48
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
49
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
50 if (pad->right.isPush()
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
51 || pad->right.isHold()) {
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
52 node->xyz[0] += player_speed;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
53
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
54 if (node->xyz[0] + player_radius > screen_w) {
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
55 node->xyz[0] = screen_w - player_radius;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
56 }
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
57 }
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
58
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
59 if (pad->up.isPush()
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
60 || pad->up.isHold()) {
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
61 node->xyz[1] -= player_speed;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
62
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
63 if (node->xyz[1] - player_radius < 0) {
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
64 node->xyz[1] = player_radius;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
65 }
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
66 }
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
67
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
68 if (pad->down.isPush()
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
69 || pad->down.isHold()) {
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
70 node->xyz[1] += player_speed;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
71
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
72 if (node->xyz[1] + player_radius > screen_h) {
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
73 node->xyz[1] = screen_h - player_radius;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
74 }
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
75 }
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
76
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
77 if (pad->circle.isPush()) {
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
78 SceneGraphPtr shot = sgroot->createSceneGraph(P_SHOT1);
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
79 shot->set_move_collision(shot_move, shot_collision);
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
80 shot->xyz[0] = node->xyz[0];
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
81 shot->xyz[1] = node->xyz[1] - player_radius;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
82 node->addBrother(shot);
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
83 }
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
84 }
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
85
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
86 static void
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
87 player_collision(SceneGraphPtr node, int screen_w, int screen_h,
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
88 SceneGraphPtr tree)
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
89 {
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
90 //自機とボスのx,y座標での距離と2点間の距離
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
91 static float x_distant, y_distant, distance;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
92 //ボスの四角形の四隅の座標
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
93 // static float boss_low_x, boss_low_y, boss_high_x, boss_high_y;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
94
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
95 SceneGraphIteratorPtr it = sgroot->getIterator(tree);
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
96
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
97
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
98 for (; it->hasNext(BOSS1);) {
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
99 it->next(BOSS1);
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
100 SceneGraphPtr enemy = it->get();
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
101
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
102 //各変数の初期化
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
103 x_distant = node->xyz[0] - enemy->xyz[0];
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
104 y_distant = node->xyz[1] - enemy->xyz[1];
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
105
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
106 //hypotfで2点間の距離を求める
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
107 distance = hypotf(x_distant, y_distant);
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
108
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
109 /*四角形と円のcollision
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
110 if( (fabs( node->xyz[1] - ( boss_low_y )))
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
111 */
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
112
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
113 //円同士のcollision
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
114 if(distance < (player_radius + boss_radius_y)) {
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
115 printf("!!!CAUTION!!!\n");
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
116 }
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
117 }
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
118 }
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
119
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
120 static void
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
121 shot_move(SceneGraphPtr node, int screen_w, int screen_h)
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
122 {
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
123 node->xyz[1] -= shot_speed;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
124
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
125 // 描画領域から抜けたら削除
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
126 if (node->xyz[1] < 0) {
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
127 node->remove();
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
128 }
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
129 }
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
130
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
131 static void
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
132 shot_collision(SceneGraphPtr node, int screen_2, int screen_h,
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
133 SceneGraphPtr tree)
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
134 {
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
135 //自機とボスのx,y座標での距離と2点間の距離
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
136 static float x_distant, y_distant, distance;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
137 //ボスの四角形の四隅の座標
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
138 // static float boss_low_x, boss_low_y, boss_high_x, boss_high_y;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
139
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
140 SceneGraphIteratorPtr it = sgroot->getIterator(tree);
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
141
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
142
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
143 for (; it->hasNext(BOSS1);) {
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
144 it->next(BOSS1);
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
145 SceneGraphPtr enemy = it->get();
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
146
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
147 x_distant = node->xyz[0] - enemy->xyz[0];
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
148 y_distant = node->xyz[1] - enemy->xyz[1];
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
149
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
150 //hypotfで2点間の距離を求める
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
151 distance = hypotf(x_distant, y_distant);
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
152
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
153 //円同士のcollision
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
154 if(distance < boss_radius_y) {
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
155 SceneGraphPtr blast = sgroot->createSceneGraph(BLAST1);
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
156
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
157 blast->set_move_collision(blast_move, null_collision);
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
158 blast->xyz[0] = node->xyz[0];
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
159 blast->xyz[1] = node->xyz[1];
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
160 node->addBrother(blast);
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
161 node->remove();
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
162 }
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
163 }
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
164 }
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
165
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
166 static void
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
167 blast_move(SceneGraphPtr node, int screen_w, int screen_h)
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
168 {
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
169 if(node->sgid > BLAST8) {
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
170 SceneGraphPtr blast = sgroot->createSceneGraph(node->sgid - 1);
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
171 blast->set_move_collision(blast_move, null_collision);
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
172 blast->xyz[0] = node->xyz[0];
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
173 blast->xyz[1] = node->xyz[1];
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
174 node->addBrother(blast);
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
175 }
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
176
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
177 if (node->sgid == BLAST8) {
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
178 node->flag_drawable = 1;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
179 }
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
180
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
181 if((node->frame > 1)) {
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
182 node->remove();
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
183 }
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
184 node->frame += 1;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
185 }
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
186
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
187 void
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
188 boss1_init(int screen_w, int screen_h)
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
189 {
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
190 SceneGraphPtr root;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
191 SceneGraphPtr player;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
192 SceneGraphPtr boss1;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
193 SceneGraphPtr left_parts;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
194 SceneGraphPtr right_parts;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
195
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
196 sgroot->createFromXMLfile("xml_file/boss1.xml");
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
197 sgroot->createFromXMLfile("xml_file/player.xml");
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
198 sgroot->createFromXMLfile("xml_file/p_shot.xml");
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
199 sgroot->createFromXMLfile("xml_file/blast.xml");
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
200
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
201 //rootとなるSceneGraphを生成
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
202 root = sgroot->createSceneGraph();
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
203
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
204 //自機の初期化
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
205 player = sgroot->createSceneGraph(PLAYER);
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
206 player->xyz[0] = screen_w/2;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
207 player->xyz[1] = screen_h - player_radius;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
208 root->addChild(player);
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
209
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
210 //ボスの初期化
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
211 boss1 = sgroot->createSceneGraph(BOSS1);
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
212 boss1->xyz[0] = screen_w/2;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
213 boss1->xyz[1] = boss_radius_y;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
214 // boss1->xyz[2] = first_boss1_depth;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
215 boss1->stack_xyz[0] = first_boss1_speed;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
216 root->addChild(boss1);
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
217
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
218 //ボスの左右パーツを追加
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
219 left_parts = sgroot->createSceneGraph(BOSS1_L);
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
220 boss1->addChild(left_parts);
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
221 right_parts = sgroot->createSceneGraph(BOSS1_R);
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
222 boss1->addChild(right_parts);
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
223
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
224 //各機体の動きと当たり判定をセット
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
225 player->set_move_collision(player_move, player_collision);
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
226 boss1->set_move_collision(boss1_move_left, null_collision);
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
227
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
228 //仕上げ
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
229 sgroot->setSceneData(root);
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
230 }