root/enemy.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. onesteppm
  2. dispa
  3. bomba
  4. newenemy

   1 /* enemy.c */
   2 #include<enemy.h>
   3 #include<movingobject.h>
   4 #include<object.h>
   5 
   6 static object* objp[2];
   7 
   8 static void onesteppm(movingobject* mobj){
   9   if(((mobj->cnt)/6)%4){
  10     mobj->pos.y = mobj->pos.y +mobj->vel.y;
  11   }else{
  12     mobj->pos.y = mobj->pos.y -mobj->vel.y;
  13   }
  14   mobj->cnt = (mobj->cnt +1)%48;
  15   mobj->currentobj = (mobj->obj)[(mobj->cnt/12)%2];
  16 }
  17 
  18 static void dispa(movingobject* mobj){
  19   putobject(mobj->currentobj, mobj->id, mobj->pos.x, mobj->pos.y);
  20 }
  21 
  22 static int bomba(movingobject* mobj){
  23   return 1;
  24 }
  25 
  26 movingobject* newenemy(void){
  27   objp[0] = newobject(3,3," : ::: : ");
  28   objp[1] = newobject(3,3," : :*: : ");
  29   return newmovingobject(&objp[0], onesteppm, dispa, bomba, "enemy");
  30 }

/* [<][>][^][v][top][bottom][index][help] */