283
|
1 #include <math.h>
|
|
2 #include "SceneGraph.h"
|
|
3 #include "enemy_action.h"
|
|
4
|
|
5 #define PI M_PI
|
|
6
|
|
7 double vx = 5.0;
|
|
8
|
|
9 void
|
|
10 enemy_move(SceneGraphPtr node, int screen_w, int screen_h)
|
|
11 {
|
|
12 double vxr = (node->xyz[0])*PI/180;
|
|
13 if(node->xyz[0] > screen_w/2 || node->xyz[0] < -screen_w/2)
|
|
14 {
|
|
15 vx *= -1;
|
|
16 }
|
|
17 //printf("%f\n", vx);
|
|
18 node->angle[1]+=vx;
|
|
19
|
|
20 node->xyz[0] += vx;
|
|
21 node->xyz[1] = -sin(vxr*2)*20*vx;
|
|
22 node->xyz[2] = sin(vxr*4)*2*vx;
|
|
23 }
|
|
24
|
|
25
|
|
26 void
|
|
27 enemy_collision(SceneGraphPtr node, int screen_w, int screen_h, SceneGraphPtr tree)
|
|
28 {
|
|
29 #if 0
|
|
30 int judge = square_judge(E_PLANE, BULEBULLET, tree);
|
|
31 if(judge == HIT)
|
|
32 {
|
|
33 E_PLANE->set_move_collision(null_move, enemy_collision);
|
299
|
34 printf("ENEMY_hit!!!\n");
|
283
|
35 //scene_graph->delete_object(node, node->next,node->prev);
|
|
36 }
|
|
37 #endif
|
|
38 }
|