annotate ppe/chara_state4.cc @ 70:cee55c8365e9 default tip

fix
author Kazuma
date Thu, 19 May 2016 18:52:26 +0900
parents 39e643fc4f90
children a80422eb44a9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
21
5f1abbe03b9a add new task.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 20
diff changeset
1 #include "task_base.h"
20
6487f54ba3d1 add new file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2 #include "task_object.h"
6487f54ba3d1 add new file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
3
33
39e643fc4f90 moving stage1.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 27
diff changeset
4 SchedDefineTask1(State4, state4);
20
6487f54ba3d1 add new file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
5
6487f54ba3d1 add new file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
6 static int
33
39e643fc4f90 moving stage1.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 27
diff changeset
7 state4(SchedTask *smanager, void *rbuf, void *wbuf)
20
6487f54ba3d1 add new file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
8 {
6487f54ba3d1 add new file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
9 CHARACTER *p = (CHARACTER*)smanager->get_input(rbuf, 0);
6487f54ba3d1 add new file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
10 CHARACTER *q = (CHARACTER*)smanager->get_output(wbuf, 0);
6487f54ba3d1 add new file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
11 player *jiki = (player*)smanager->get_input(rbuf, 1);
6487f54ba3d1 add new file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
12
6487f54ba3d1 add new file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
13 p->y += p->vy;
6487f54ba3d1 add new file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
14 p->x += p->vx;
6487f54ba3d1 add new file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
15 if(p->y < jiki->y && p->y + 16 > jiki->y)
6487f54ba3d1 add new file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
16 {
6487f54ba3d1 add new file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
17 p->vy = -2;
6487f54ba3d1 add new file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
18 p->vx = ((jiki->x > p->x) ? 4 : -4);
27
871f7d9a2f35 running.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 21
diff changeset
19 p->task = STATE7;
20
6487f54ba3d1 add new file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
20 }
6487f54ba3d1 add new file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
21 else p->task = STATE4;
6487f54ba3d1 add new file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
22
6487f54ba3d1 add new file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
23 *q = *p;
6487f54ba3d1 add new file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
24 return 0;
6487f54ba3d1 add new file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
25 }