Mercurial > hg > Members > koba > t_dandy
view ppe/asteroid.cc @ 69:1c57e38fb9b5
fix xml files ( model /c_xyz )
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Sun, 22 May 2011 10:19:58 +0900 |
parents | 21ac9f57a6d4 |
children |
line wrap: on
line source
#include "task_base.h" #include "task_object.h" SchedDefineTask1(Asteroid, asteroid_task); static int asteroid_task(SchedTask *smanager, void *rbuf, void *wbuf) { long asteroidi = (long)smanager->get_param(0); CHARACTER *p = (CHARACTER*)smanager->get_input(rbuf, 0); p->x += p->vx; p->y += p->vy; if (asteroidi > 0) { CHARACTER* asteroiddt = (CHARACTER*)smanager->get_input(rbuf, 1); for (int i = 0; i < asteroidi; i++) { if ((asteroiddt[i].x + 32 > p->x) && (p->x + 32 > asteroiddt[i].x) && (asteroiddt[i].y + 32 > p->y) && (asteroiddt[i].y < p->y + 32)) { p->vx *= -1; p->vy *= -1; } } } CHARACTER *q = (CHARACTER*)smanager->get_output(wbuf, 0); *q = *p; return 0; }