comparison examples/tank/tank_main.c @ 117:e4e47d2cdbcd

Tank
author Thinker K.F. Li <thinker@branda.to>
date Sun, 14 Sep 2008 18:51:16 +0800
parents 3895d2224e67
children 5df7403b6fbc
comparison
equal deleted inserted replaced
116:1d74eb3861b7 117:e4e47d2cdbcd
33 typedef struct _tank_rt tank_rt_t; 33 typedef struct _tank_rt tank_rt_t;
34 34
35 struct _tank_rt { 35 struct _tank_rt {
36 tank1_t *tank1; 36 tank1_t *tank1;
37 tank2_t *tank2; 37 tank2_t *tank2;
38 tank_en_t *tank_en; 38 int n_enemy;
39 tank_en_t *tank_enemies[10];
39 void *map[12][16]; 40 void *map[12][16];
40 X_MB_runtime_t *mb_rt; 41 X_MB_runtime_t *mb_rt;
41 }; 42 };
42 43
43 #define CHANGE_POS(g, x, y) do { \ 44 #define CHANGE_POS(g, x, y) do { \
86 } 87 }
87 } 88 }
88 } 89 }
89 90
90 tank_rt->tank1 = tank1_new(rdman); 91 tank_rt->tank1 = tank1_new(rdman);
92 CHANGE_POS(tank_rt->tank1, 5 * 50, 11 * 50);
91 tank_rt->tank2 = tank2_new(rdman); 93 tank_rt->tank2 = tank2_new(rdman);
92 CHANGE_POS(tank_rt->tank2, 50, 0); 94 CHANGE_POS(tank_rt->tank2, 10 * 50, 11 * 50);
93 tank_rt->tank_en = tank_en_new(rdman); 95 for(i = 0; i < 3; i++) {
94 CHANGE_POS(tank_rt->tank_en, 100, 0); 96 tank_rt->tank_enemies[i] = tank_en_new(rdman);
97 CHANGE_POS(tank_rt->tank_enemies[i], (2 + i * 3) * 50, 0);
98 }
99 tank_rt->n_enemy = i;
95 } 100 }
96 101
97 int 102 int
98 main(int argc, char *const argv[]) { 103 main(int argc, char *const argv[]) {
99 X_MB_runtime_t rt; 104 X_MB_runtime_t rt;