view spe/chara_state22.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_state22.h"
#include "tobject.h"

SchedDefineTask(STATE22);

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

      int sf;

      sf = rand() % 4;
      if((sf == 0) || (sf == 1))
      {
	  p->x = -35;
	  p->y = rand() % (120 - 35);
	  p->vx = (rand() % 4 + 1);
	  p->vy = rand() % 3 + 1;
	  p->task = STATE23;
      }
      if((sf == 2))
      {
	  p->x = rand() % 290;
	  p->y = -30;
	  p->vx = rand() % 3 - 1;
	  p->vy = (rand() % 4 + 1);
	  p->task = STATE23;
      }
      if(sf == 3)
      {
	  p->x = 320;
	  p->y = rand() % (120 - 35);
	  p->vx = (rand() % 4 + 1) * -1;
	  p->vy = rand() % 3 -1;
	  p->task = STATE23;
      }
      return 0;
}