Mercurial > hg > Members > koba > t_dandy
comparison spe/asteroid.cc @ 18:c330ded6d728
add task file.
author | koba <koba@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 17 Dec 2010 22:18:11 +0900 |
parents | |
children | cfd42ee2ad28 |
comparison
equal
deleted
inserted
replaced
17:927401604461 | 18:c330ded6d728 |
---|---|
1 #include "asteroid.h" | |
2 #include "tobject.h" | |
3 | |
4 SchedDefineTask(ASTEROID); | |
5 | |
6 static int | |
7 run(SchedTask *smanager, void *rbuf, void *wbuf) | |
8 { | |
9 CHARACTER *p = (CHARACTER*)smanager->get_input(rbuf, 0); | |
10 int i; | |
11 | |
12 asteroiddt[asteroidi] = p; | |
13 // if(asteroidi==0) | |
14 // { | |
15 p->x += p->vx; | |
16 p->y += p->vy; | |
17 // } | |
18 if (asteroidi > 0) { | |
19 for (i = 0; i < asteroidi; i++) { | |
20 if ((asteroiddt[i]->x + 32 > p->x) | |
21 && (p->x + 32 > asteroiddt[i]->x) | |
22 && (asteroiddt[i]->y + 32 > p->y) | |
23 && (asteroiddt[i]->y < p->y + 32)) { | |
24 p->vx *= -1; | |
25 p->vy *= -1; | |
26 } | |
27 } | |
28 } | |
29 asteroidi++; | |
30 return 0; | |
31 } |