539
|
1 #include "SceneGraphRoot.h"
|
|
2 #include "SGList.h"
|
|
3 #include "player_action.h"
|
|
4 #include "enemy_action.h"
|
|
5 #include "camera_action.h"
|
|
6
|
|
7 void
|
|
8 init_position(TaskManager *manager, int w, int h)
|
|
9 {
|
|
10 SceneGraphPtr back;
|
|
11 SceneGraphPtr player;
|
|
12 SceneGraphPtr enemy;
|
|
13 //SceneGraphPtr bullet;
|
|
14
|
|
15 sgroot->createFromXMLfile(manager, "xml_file/player.xml");
|
|
16 back = sgroot->createSceneGraph(BACK);
|
|
17 //back = sgroot->createSceneGraph();
|
|
18 player = sgroot->createSceneGraph(IDLE);
|
|
19 //bullet = sgroot->createSceneGraph(BULEBULLET);
|
|
20
|
|
21 camera_init(back, w, h);
|
|
22 back->set_move_collision(camera_init, camera_collision);
|
|
23 player->set_move_collision(player_move_all, player_collision);
|
|
24
|
|
25
|
|
26 back->addChild(player);
|
|
27
|
|
28 for (int i = 0; i < 10; i++) {
|
|
29 enemy = sgroot->createSceneGraph(E_PLANE);
|
|
30 enemy->set_move_collision(enemy_move, enemy_collision);
|
|
31 enemy->xyz[0] = 50.0*i;
|
|
32 back->addChild(enemy);
|
|
33 }
|
|
34
|
|
35 sgroot->setSceneData(back);
|
|
36 }
|