Beispiel #1
0
void menu_change_item_done (Menu * menu)
{
  menu->items[menu->active_item].priv_must_anim = 1;
  if (menu->sound_move) {
    audio_sound_play (menu->sound_move);
  }
}
Beispiel #2
0
  void
menu_validate (Menu * menu)
{
  if (menu->sound_valid)
    audio_sound_play (menu->sound_valid);
  menu->items[menu->active_item].priv_must_anim = 1;
}
void FallingAnimation::cycle()
{
    Y += step++;
    if (Y >= (attachedPuyo.getPuyoY()*TSIZE) + yOffset)
    {
        bouncing--;
        if (bouncing < 0) {
            finishedFlag = true;
            audio_sound_play(sound_bam1);
            attachedPuyo.getAttachedView()->allowCycle();
        }
        else {
            if (BOUNCING_OFFSET[bouncing] == 0)
                audio_sound_play(sound_bam1);
        }
        Y = (attachedPuyo.getPuyoY()*TSIZE) + yOffset;
    }
}
void TurningAnimation::cycle()
{
    if (cpt == 0) {
        audio_sound_play(sound_fff);
    }
    cpt++;
    angle += step;
    if (cpt == 4)
        finishedFlag = true;
}
Beispiel #5
0
static void collision_detection_coins() {
  
  /* We simply check if the player intersects with the coins */
  
  character* main_char = entity_get("main_char");
  
  vec2 top_left = vec2_add(main_char->position, vec2_new(-TILE_SIZE, -TILE_SIZE));
  vec2 bottom_right = vec2_add(main_char->position, vec2_new(TILE_SIZE, TILE_SIZE));
  
  /* Again we collect pointers to all the coin type entities */
  int num_coins = 0;
  coin* coins[COIN_COUNT];
  entities_get(coins, &num_coins, coin); 
  
  for(int i = 0; i < num_coins; i++) {
    /* Check if they are within the main char bounding box */
    if ((coins[i]->position.x > top_left.x) &&
        (coins[i]->position.x < bottom_right.x) &&
        (coins[i]->position.y > top_left.y) && 
        (coins[i]->position.y < bottom_right.y)) {
      
      /* Remove them from the entity manager and delete */
      char* coin_name = entity_name(coins[i]);
      entity_delete(coin_name);
      
      /* Play a nice twinkle sound */
      audio_sound_play(asset_get_as(P("./sounds/coin.wav"), sound), 0);
      
      /* Add some score! */
      level_score += 10;
      
      /* Update the ui text */
      ui_button* score = ui_elem_get("score");
      sprintf(score->label->string, "Score %06i", level_score);
      ui_text_draw(score->label);
    }
  }
  
  
  ui_button* victory = ui_elem_get("victory");
  
  /* if all the coins are gone and the victory rectangle isn't disaplayed then show it */
  if ((entity_type_count(coin) == 0) && (!victory->active)) {
    ui_button* victory = ui_elem_get("victory");
    ui_button* new_game = ui_elem_get("new_game");
    victory->active = true;
    new_game->active = true;
  }
  
}
void VanishSoundAnimation::cycle()
{
    if (once == false) {
        once = true;
        synchronizer->pop();
    }
    else if (synchronizer->isSynchronized()) {
        step++;
        if (step == 1) {
            audio_sound_play(sound_splash[phase>7?7:phase]);
            finishedFlag = true;
        }
    }
}
void NeutralAnimation::cycle()
{
    if (delay >=0) {
        delay--;
    }
    else {
        currentY += (int)step;
        step += 0.5;
        if (currentY >= Y) {
            audio_sound_play(sound_bim[random() % 2]);
            finishedFlag = true;
            attachedPuyo.getAttachedView()->allowCycle();
        }
    }
}