view spe/chara_state601.cc @ 70:cee55c8365e9 default tip

fix
author Kazuma
date Thu, 19 May 2016 18:52:26 +0900
parents c330ded6d728
children f4140672ef9f
line wrap: on
line source

#include "chara_state601.h"
#include "tobject.h"

SchedDefineTask(STATE601);

static int
run(SchedTask *smanager, void *rbuf, void *wbuf)
{
    CHARACTER *p = (CHARACTER*)smanager->get_input(rbuf, 0);

    p->dt2++;
    if (p->x < jiki.x)
	p->vx++;
    if (p->x > jiki.x)
	p->vx--;
    p->x += p->vx;
    Putenemy(6, p->x + 16 + rand() % 32,
	     p->y, 0, rand() % 4, chara_state400);
    if (p->x < 0)
	p->x = 0;
    if (p->x > 260)
	p->x = 260;
    if (p->y < 0)
	p->y = 0;
    if (p->y > 232)
	p->y = 232;
    if (p->dt2 > 800) {
	p->task = STATE602;
    }
    return 0;
}