Exemplo n.º 1
0
/* ==================================== */
static gboolean
animate_step()
{

  if(!gcomprisBoard)
    return FALSE;

  GooCanvasBounds bounds;
  goo_canvas_item_get_bounds(timer_item, &bounds);

  if(GOO_IS_CANVAS_SVG(timer_item))
    goo_canvas_item_translate(timer_item, timer_step_x1, timer_step_y1);
  else if(GOO_IS_CANVAS_RECT(timer_item))
    g_object_set(timer_item,
		 "x", bounds.x1 + timer_step_x1,
		 "y", bounds.y1 + timer_step_y1,
		 "height", bounds.y2 - bounds.y1 - timer_step_y1,
		 NULL);

  /* Special case for raising/lowering the boat */
  if(boat_position==BOAT_POS_MIDDLE && timer_item==canal_middle_item)
    {
      goo_canvas_item_translate(tuxboat_item, 0, timer_step_y1);
      gc_item_focus_remove(tuxboat_item, NULL);
    }

  if((bounds.y1 >= timer_item_limit_y && timer_step_y1 > 0) ||
     (bounds.y1 <= timer_item_limit_y && timer_step_y1 < 0))
    {
      gtk_timeout_remove (timer_id);
      timer_id = 0;
      animation = FALSE;
      update_water();
      gc_item_focus_init(tuxboat_item, NULL);
      g_object_set (tuxboat_item,
		    "svg-id", "#BOAT_NO_SAIL", NULL);
    }
  else if((bounds.x1 >= timer_item_limit_x && timer_step_x1 > 0) ||
     (bounds.x1 <= timer_item_limit_x && timer_step_x1 < 0))
    {
      gtk_timeout_remove (timer_id);
      timer_id = 0;
      animation = FALSE;
      update_water();
      if (gamewon)
        {
          gc_bonus_display(TRUE, GC_BONUS_FLOWER);
          gamewon = FALSE;
        }
      gc_item_focus_init(tuxboat_item, NULL);
      g_object_set (tuxboat_item,
		    "svg-id", "#BOAT_NO_SAIL", NULL);
    }

  return TRUE;
}
Exemplo n.º 2
0
static void
update(struct game_state *gs)
{
	if (inner_state.state != IS_LEVEL_CLEARED &&
	  inner_state.state != IS_LEVEL_TRANSITION)
		update_eye();

	update_crosshair();
	update_background();
	update_water();
	update_particles();
	update_explosions();

	if (ship_is_visible()) {
		update_ship();
		update_missiles();
		update_bombs();
		update_lasers();
		update_foes();
	}

	update_powerups();
	update_in_game_texts();

	if (inner_state.state == IS_IN_GAME) {
		update_multiplier();
		update_combo();
	}

	if (inner_state.state == IS_GAME_OVER) {
		if (inner_state.tics >= GAME_OVER_FADE_IN_TICS) {
			if (!update_stats_table()) {
				gc.score += game_over_stats.bonus;
				set_inner_state(IS_RANK);
			}
		}
	}

	if (inner_state.state == IS_LEVEL_CLEARED) {
		if (inner_state.tics >= LEVEL_CLEARED_FADE_IN_TICS) {
			if (!update_stats_table()) {
				gc.score += game_over_stats.bonus;
				set_inner_state(IS_LEVEL_TRANSITION);
			}
		}
	}

	update_level_tics();
	update_inner_state();

	if (serializing)
		serialize();
}