Пример #1
0
/* Called with items_lock locked */
static void wordsgame_next_level_unlocked()
{
  gcomprisBoard->number_of_sublevel = 10 +
    ((gcomprisBoard->level-1) * 5);
  gc_score_start(SCORESTYLE_NOTE,
		 BOARDWIDTH - 195,
		 BOARDHEIGHT - 30,
		 gcomprisBoard->number_of_sublevel);

  gc_bar_set_level(gcomprisBoard);
  gc_score_set(gcomprisBoard->sublevel);

  wordsgame_destroy_all_items();

  if (preedit_text){
    goo_canvas_item_remove(preedit_text);
    preedit_text=NULL;
  }
  gc_im_reset();

  items=g_ptr_array_new();
  items2del=g_ptr_array_new();


  /* Increase speed only after 5 levels */
  if(gcomprisBoard->level > 5)
    {
      gint temp = fallSpeed-gcomprisBoard->level*200;
      if (temp > MIN_FALLSPEED)	fallSpeed=temp;
    }

  pause_board(FALSE);
}
Пример #2
0
/* set initial values for the next level */
static void
imageid_next_level()
{
  gc_bar_set_level(gcomprisBoard);

  imageid_destroy_all_items();
  selected_button = NULL;
  gamewon = FALSE;

  destroy_board_list();
  init_xml(gcomprisBoard->level);

  gcomprisBoard->number_of_sublevel = g_list_length(board_list);

  gc_score_end();
  gc_score_start(SCORESTYLE_NOTE,
		 BOARDWIDTH - 195,
		 BOARDHEIGHT - 30,
		 gcomprisBoard->number_of_sublevel);

  gc_score_set(gcomprisBoard->sublevel);

  /* Try the next level */
  imageid_create_item(goo_canvas_get_root_item(gcomprisBoard->canvas));
}
Пример #3
0
/* Called with items_lock locked */
static void player_win(LettersItem *item)
{

  gc_sound_play_ogg ("sounds/flip.wav", NULL);

  g_assert(gcomprisBoard!=NULL);

  gcomprisBoard->sublevel++;
  gc_score_set(gcomprisBoard->sublevel);

  g_ptr_array_remove(items,item);
  g_ptr_array_add(items2del,item);

  g_object_set (item->rootitem, "visibility", GOO_CANVAS_ITEM_INVISIBLE, NULL);
  g_timeout_add (500,(GSourceFunc) wordsgame_delete_items, NULL);

  if(gcomprisBoard->sublevel > gcomprisBoard->number_of_sublevel)
    {

      /* Try the next level */
      gcomprisBoard->level++;
      gcomprisBoard->sublevel = 0;
      if(gcomprisBoard->level>gcomprisBoard->maxlevel)
	gcomprisBoard->level = gcomprisBoard->maxlevel;

      wordsgame_next_level_unlocked();
      gc_sound_play_ogg ("sounds/bonus.wav", NULL);
    }
  else
    {

      /* Drop a new item now to speed up the game */
      if(items->len==0)
        {

	  if ((fallSpeed-=INCREMENT_FALLSPEED) < MIN_FALLSPEED) fallSpeed+=INCREMENT_FALLSPEED;

	  if ((speed-=INCREMENT_SPEED) < MIN_SPEED) speed+=INCREMENT_SPEED;

          if (drop_items_id) {
            /* Remove pending new item creation to sync the falls */
            g_source_remove (drop_items_id);
            drop_items_id = 0;
          }

          if(!drop_items_id) {
            drop_items_id = g_timeout_add (0,
					   (GSourceFunc) wordsgame_drop_items,
					   NULL);
          }

        }
    }

}
Пример #4
0
static void
missing_letter_next_sublevel()
{
  missing_letter_destroy_all_items();
  selected_button = NULL;
  gamewon = FALSE;

  gc_score_set(gcomprisBoard_missing->sublevel);

  /* Try the next level */
  missing_letter_create_item(goo_canvas_get_root_item(gcomprisBoard_missing->canvas));
}
Пример #5
0
static void
imageid_next_sublevel()
{
  imageid_destroy_all_items();
  selected_button = NULL;
  gamewon = FALSE;

  gc_score_set(gcomprisBoard->sublevel);

  /* Try the next level */
  imageid_create_item(goo_canvas_get_root_item(gcomprisBoard->canvas));
}
Пример #6
0
/* set initial values for the next level */
static void
click_on_letter_next_level()
{
  gc_bar_set_level(gcomprisBoard);

  click_on_letter_destroy_all_items();
  gamewon = FALSE;
  selected_button = NULL;
  /* Try the next level */
  gc_sound_play_ogg("voices/$LOCALE/misc/click_on_letter.ogg", NULL);
  click_on_letter_create_item(goo_canvas_get_root_item(gcomprisBoard->canvas));
  gc_score_set_max(gcomprisBoard->number_of_sublevel);
  gc_score_set(gcomprisBoard->sublevel);
}
Пример #7
0
/* =====================================================================
 * set initial values for the next level
 * =====================================================================*/
static void colors_next_level() {
  gchar *str = NULL;
  int i, list_length;
  GList * list = NULL;
  int * item;

  colors_destroy_all_items();
  gamewon = FALSE;

  gc_score_set(gcomprisBoard->sublevel);
  gc_bar_set_level(gcomprisBoard);

  /* initialize board only once*/
  if (gcomprisBoard->sublevel == 1) {
    errors = MAX_ERRORS;
    // we generate a list of color indexes in a random order
    while (g_list_length(listColors) > 0)
      listColors = g_list_remove(listColors, g_list_nth_data(listColors,0));

    for (i=0; i<LAST_COLOR; i++)
      list = g_list_append(list, GINT_TO_POINTER(i));

    while((list_length = g_list_length(list))) {
      i = list_length == 1 ? 0 : g_random_int_range(0,g_list_length(list)-1);
      item = g_list_nth_data(list, i);
      listColors = g_list_append(listColors, item);
      list = g_list_remove(list, item);
    }

    /* set background */
    str = g_strdup_printf("%s/%s", gcomprisBoard->boarddir, backgroundFile);
    g_warning("background = %s\n", str);
    gc_set_background(goo_canvas_get_root_item(gcomprisBoard->canvas), str);
    g_free(str);
  }

  colors_create_item(goo_canvas_get_root_item(gcomprisBoard->canvas));

  /* show text of color to find */
  color_item = goo_canvas_text_new (boardRootItem,
				    colors[GPOINTER_TO_INT(g_list_nth_data(listColors,0))],
				    (color_x1+color_x2)/2,
				    (color_y1+color_y2)/2,
				    -1,
				    GTK_ANCHOR_CENTER,
				    "font", gc_skin_font_board_title_bold,
				    "fill-color", "darkblue",
				    NULL);

}
Пример #8
0
/* set initial values for the next level */
static void gletters_next_level()
{

  gamewon = FALSE;
  gc_bar_set_level(gcomprisBoard);

  gletters_destroy_all_items();

  /* Try the next level */
  speed=fallRateBase+(fallRateMult/gcomprisBoard->level);
  fallSpeed=dropRateBase+(dropRateMult/gcomprisBoard->level);

  gcomprisBoard->sublevel=1;
  gc_score_set(gcomprisBoard->sublevel);
}
Пример #9
0
static void planegame_cloud_colision(GooCanvasItem *item)
{
    GooCanvasBounds ib, pb;

    goo_canvas_item_get_bounds(planeitem,  &pb);
    goo_canvas_item_get_bounds(item, &ib);

    if(ib.x2<0)
    {
        goo_canvas_item_remove(item);
        return;
    }

    if(
        ISIN(ib.x1, ib.y1, pb.x1, pb.y1, pb.x2, pb.y2) ||
        ISIN(ib.x2, ib.y1, pb.x1, pb.y1, pb.x2, pb.y2) ||
        ISIN(ib.x1, ib.y2, pb.x1, pb.y1, pb.x2, pb.y2) ||
        ISIN(ib.x2, ib.y2, pb.x1, pb.y1, pb.x2, pb.y2)
    )
    {
        gint number = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (item),
                                       "cloud_number"));

        if(plane_target == number)
        {
            planegame_speak_number(number);
            plane_target++;

            goo_canvas_item_remove(item);

            if(gcomprisBoard->level==1)
                gc_score_set(plane_target);

            if(plane_target == plane_last_target)
            {
                /* Try the next level */
                gcomprisBoard->level++;
                if(gcomprisBoard->level>gcomprisBoard->maxlevel)
                    gcomprisBoard->level = gcomprisBoard->maxlevel;

                planegame_next_level();
                gc_sound_play_ogg ("sounds/bonus.wav", NULL);
            }
        }
    }
}
Пример #10
0
/* void gc_score_set(guint value); */
static PyObject*
py_gc_score_set(PyObject* self, PyObject* args)
{
  guint value;

  /* Parse arguments */
  if(!PyArg_ParseTuple(args, "i:gc_score_set", &value))
    return NULL;
  if(value<0) return NULL;

  /* Call the corresponding C function */
  gc_score_set(value);

  /* Create and return the result */
  Py_INCREF(Py_None);
  return Py_None;
}
Пример #11
0
static void player_win(GooCanvasItem *item)
{
  gletters_destroy_item(item);
  gc_sound_play_ogg ("sounds/flip.wav", NULL);

  gcomprisBoard->sublevel++;

  if(gcomprisBoard->sublevel > gcomprisBoard->number_of_sublevel)
    {
      /* Try the next level */
      gcomprisBoard->level++;
      if(gcomprisBoard->level>gcomprisBoard->maxlevel)
	gcomprisBoard->level = gcomprisBoard->maxlevel;

      gamewon = TRUE;
      gletters_destroy_all_items();
      gc_bonus_display(gamewon, GC_BONUS_SMILEY);
    }
  else
    {
      gc_score_set(gcomprisBoard->sublevel);

      /* Drop a new item now to speed up the game */
      if(g_list_length(item_list)==0)
	{
	  if (drop_items_id) {
	    /* Remove pending new item creation to sync the falls */
	    g_source_remove (drop_items_id);
	    drop_items_id = 0;
	  }
	  if(!drop_items_id) {
	    drop_items_id = g_timeout_add (0,
					   gletters_drop_items, NULL);
	  }
	}
    }
}
Пример #12
0
/* set initial values for the next level */
static void planegame_next_level()
{
    RsvgHandle *svg_handle = NULL;
    GooCanvasItem *item;

    gc_bar_set_level(gcomprisBoard);

    planegame_destroy_all_items();

    rootitem = goo_canvas_group_new (goo_canvas_get_root_item(gcomprisBoard->canvas),
                                     NULL);

    clouds_rootitem = goo_canvas_group_new (rootitem, NULL);

    /* Try the next level */
    speed=100+(40/(gcomprisBoard->level));
    fallSpeed=10000-gcomprisBoard->level*200;
    /* Make the images tend to 0.5 ratio */
    imageZoom=0.3+(0.5/(gcomprisBoard->level));

    /* Setup and Display the plane */
    planespeed_y = 0;
    planespeed_x = 0;
    svg_handle = gc_rsvg_load("planegame/tuxhelico.svgz");
    plane_x = 50;
    plane_y = 300;

    planeitem = goo_canvas_group_new (rootitem,
                                      NULL);

    goo_canvas_item_translate(planeitem, plane_x, plane_y);

    item = goo_canvas_svg_new (planeitem,
                               svg_handle,
                               NULL);

    goo_canvas_item_scale(item,
                          0.4 * imageZoom,
                          0.4 * imageZoom);

    g_object_unref(svg_handle);

    /* Game rules */
    plane_target = 1;
    plane_last_target = 10;

    gcomprisBoard->number_of_sublevel=plane_last_target;

    gcomprisBoard->sublevel=plane_target;

    if(gcomprisBoard->level>1)
    {
        /* No scoring after level 1 */
        gc_score_end();
    }
    else
    {
        gc_score_start(SCORESTYLE_NOTE,
                       BOARDWIDTH - 195,
                       BOARDHEIGHT - 30,
                       gcomprisBoard->number_of_sublevel);
        gc_score_set(gcomprisBoard->sublevel);
    }

}