Example #1
0
void update(objectmachine_t *obj, player_t **team, int team_size, brick_list_t *brick_list, item_list_t *item_list, object_list_t *object_list)
{
    objectdecorator_t *dec = (objectdecorator_t*)obj;
    objectdecorator_enemy_t *me = (objectdecorator_enemy_t*)obj;
    objectmachine_t *decorated_machine = dec->decorated_machine;
    object_t *object = obj->get_object_instance(obj);
    int i, score;

    score = (int)expression_evaluate(me->score);

    /* player x object collision */
    for(i=0; i<team_size; i++) {
        player_t *player = team[i];
        if(actor_pixelperfect_collision(object->actor, player->actor)) {
            if(player_is_attacking(player) || player->invincible) {
                /* I've been defeated */
                player_bounce(player, object->actor);
                level_add_to_score(score);
                level_create_item(IT_EXPLOSION, v2d_add(object->actor->position, v2d_new(0,-15)));
                level_create_animal(object->actor->position);
                sound_play( soundfactory_get("destroy") );
                object->state = ES_DEAD;
            }
            else {
                /* The player has been hit by me */
                player_hit(player, object->actor);
            }
        }
    }

    decorated_machine->update(decorated_machine, team, team_size, brick_list, item_list, object_list);
}
Example #2
0
/* objectmachine_t 캐릭터 위치 */
void update(objectmachine_t *obj, player_t **team, int team_size, brick_list_t *brick_list, item_list_t *item_list, object_list_t *object_list)
{
    objectdecorator_t *dec = (objectdecorator_t*)obj;
    objectmachine_t *decorated_machine = dec->decorated_machine;
    player_t *player = enemy_get_observed_player(obj->get_object_instance(obj));

    player_bounce(player);

    decorated_machine->update(decorated_machine, team, team_size, brick_list, item_list, object_list);
}
Example #3
0
void marsmove(void)
{
    /***** Start The Code Here *****/

    me->p_ghostbuster = 0;         /* keep ghostbuster away */

#ifdef DOGDEBUG
    ERROR(2,("Enter marsmove\n"));
#endif

    /* Check that I'm alive */
    /* Messages are not checked when puck is not alive! */

    if (me->p_status != PALIVE){  /*So I'm not alive now...*/
      ERROR(2,("ERROR: Mars died??\n"));
      cleanup();    /*Mars is dead for some unpredicted reason like xsg */
    }

    roboclock++;
    player_maint();   			/* update necessary stats and info */
					/* Moved is up from after mars_rules */

    if (!(roboclock % (PERSEC*2))) do_msg_check();
    if (!(roboclock % (PERSEC*WARFUSE)))
      {
	do_war();
	checkstatus();
      }
    if (!(roboclock % (PERSEC*120))) mars_rules();


    
/* 
  first priority:  is this faceoff mode?

  For the dogfight server, faceoff mode is defined as the
  state where no contests are scheduled to occur, before
  anything has really started.
*/

    if (!inprogress)
      {
#ifdef DOGDEBUG
	ERROR(2,("Exit marsmove 1\n"));
#endif

	return;
      }

    if (faceoff > 0) {
	faceoff--;
	if (faceoff == 0) {
	    start_tourney();
	}
	else if ((faceoff % (10*PERSEC)) == 0) 
	{
	    messAll(255,roboname,"The tournament begins in %d seconds.", faceoff/PERSEC);
	}

        player_bounce();
#ifdef DOGDEBUG
	ERROR(2,("Exit marsmove 2\n"));
#endif
	return;           /* Do nothing else during faceoff mode */
    }



    /* keep all players in the rink */
    /* and do some other bouncing   */
    player_bounce();


    /* Some useful bookkeeping stuff here */
    if (!(roboclock % (PERSEC*120)))
      do_score();
    else if (!(roboclock % (PERSEC*10))) 
      recompute_all_kills();

    if (!(roboclock % (PERSEC*5))) udschedule();

#ifdef DOGDEBUG
      ERROR(2,("Exit marsmove 3\n"));
#endif

    update_sys_defaults();

}  /* End of marsmove, the main dogfight overseeing program */