Ejemplo n.º 1
0
void draw_enemies()
{
  Uint16 i;
  ENEMY *p;
  SIDE s;

  for( i = 0; i < num_enemies; i++ ) {

    p = get_enemy( i );

    /* Attempt to move the enemy. */
    if( move_enemy( p ) == 0 )
      continue;

    /* Do things for an active enemy. */
    if( IS_ACTIVE(p->flags) ) {
      draw_sprite( p->current );  /* Draw it. */

      /* Check for a collision with the ship. */
      s = sprite_collide( p->current, get_ship_sprite() );
      if( s.none == 0  ) {
        hit_enemy( p, 5 );
        ship_hit( s );
      }
    }
  }

}
Ejemplo n.º 2
0
        //Get color of a team
        sf::Color get_team_color(Team t) const
        {
            switch (t.get_t())
            {
                case Team::TEAM_GOOD:
                    return get_friendly();

                case Team::TEAM_BAD:
                    return get_enemy();

                default:
                    return get_neutral();
            }
        }
Ejemplo n.º 3
0
ENEMY *check_enemy_collide( SPRITE *s )
{
  Uint16 i;
  ENEMY *p;

  for( i = 0; i < num_enemies; i++ ) {

    p = get_enemy( i );
    
    if( sprite_collide( p->current, s ).none == 0 )
      return p;

  }

  return NULL;
}