annotate Renderer/test_render/enemy_action.cpp @ 299:3cb2530b4ca4 draft

UTF-8
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sun, 07 Jun 2009 15:20:10 +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 <math.h>
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
2 #include "SceneGraph.h"
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
3 #include "enemy_action.h"
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
4
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
5 #define PI M_PI
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
6
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
7 double vx = 5.0;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
8
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
9 void
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
10 enemy_move(SceneGraphPtr node, int screen_w, int screen_h)
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
11 {
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
12 double vxr = (node->xyz[0])*PI/180;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
13 if(node->xyz[0] > screen_w/2 || node->xyz[0] < -screen_w/2)
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
14 {
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
15 vx *= -1;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
16 }
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
17 //printf("%f\n", vx);
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
18 node->angle[1]+=vx;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
19
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
20 node->xyz[0] += vx;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
21 node->xyz[1] = -sin(vxr*2)*20*vx;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
22 node->xyz[2] = sin(vxr*4)*2*vx;
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 void
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
27 enemy_collision(SceneGraphPtr node, int screen_w, int screen_h, SceneGraphPtr tree)
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
28 {
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
29 #if 0
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
30 int judge = square_judge(E_PLANE, BULEBULLET, tree);
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
31 if(judge == HIT)
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
32 {
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
33 E_PLANE->set_move_collision(null_move, enemy_collision);
299
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 283
diff changeset
34 printf("ENEMY_hit!!!\n");
283
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
35 //scene_graph->delete_object(node, node->next,node->prev);
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
36 }
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
37 #endif
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
38 }