void BadGuy::action_fish(double frame_ratio) { static const float JUMPV = 6; static const int WAITTIME = 1000; // go in wait mode when back in water if(dying == DYING_NOT && gettile(base.x, base.y+ base.height)->water && physic.get_velocity_y() <= 0 && mode == NORMAL) { mode = FISH_WAIT; set_sprite(0, 0); physic.set_velocity(0, 0); physic.enable_gravity(false); timer.start(WAITTIME); } else if(mode == FISH_WAIT && !timer.check()) { // jump again set_sprite(img_fish, img_fish); mode = NORMAL; physic.set_velocity(0, JUMPV); physic.enable_gravity(true); } physic.apply(frame_ratio, base.x, base.y); if(dying == DYING_NOT) collision_swept_object_map(&old_base, &base); if(physic.get_velocity_y() < 0) set_sprite(img_fish_down, img_fish_down); }
void CannonNPC::reset() { if(move_direction == -1) { set_sprite(CANNON_W); } else { set_sprite(CANNON_E); } }
void init_laser(Laser* laser, Laser_Color color, Entity* shooter, f32 angle) { set_sprite(laser->entity, get_laser_sprite(color), 0.75f, 0, make_vector2(0.0f, -0.3f)); laser->shooter_id = shooter->id; laser->entity->position = shooter->position + (get_direction(angle) * 0.75f); laser->entity->orientation = angle; }
void BadGuy::kill_me(int score) { if(kind == BAD_BOMB || kind == BAD_STALACTITE || kind == BAD_FLAME) return; dying = DYING_FALLING; if(kind == BAD_MRICEBLOCK) { set_sprite(img_mriceblock_falling_left, img_mriceblock_falling_right); if(mode == HELD) { mode = NORMAL; Player& tux = *World::current()->get_tux(); tux.holding_something = false; } } physic.enable_gravity(true); /* Gain some points: */ World::current()->add_score(base.x - scroll_x, base.y, score * player_status.score_multiplier); /* Play death sound: */ play_sound(sounds[SND_FALL], SOUND_CENTER_SPEAKER); }
void draw_arm_rechts() { word SpriteOffs; SpriteOffs=(arm_rechts_status-1)*ArmBreiteRechts*ArmHoeheRechts; set_sprite(ArmXRechts,ArmYRechts,ArmBreiteRechts,ArmHoeheRechts,arm_rechts + SpriteOffs); draw_arm_rechts_msk(); }
void draw_arm_links() { word SpriteOffs; SpriteOffs=(arm_links_status-1)*ArmBreiteLinks*ArmHoeheLinks; set_sprite(ArmXLinks,ArmYLinks,ArmBreiteLinks,ArmHoeheLinks, arm_links + SpriteOffs); draw_arm_links_msk(); }
void BadGuy::action_jumpy(double frame_ratio) { const float vy = physic.get_velocity_y(); // XXX: These tests *should* use location from ground, not velocity if (fabsf(vy) > 5.6f) set_sprite(img_jumpy_left_down, img_jumpy_left_down); else if (fabsf(vy) > 5.3f) set_sprite(img_jumpy_left_middle, img_jumpy_left_middle); else set_sprite(img_jumpy_left_up, img_jumpy_left_up); Player& tux = *World::current()->get_tux(); static const float JUMPV = 6; fall(); // jump when on ground if(dying == DYING_NOT && issolid(base.x, base.y+32)) { physic.set_velocity_y(JUMPV); physic.enable_gravity(true); mode = JUMPY_JUMP; } else if(mode == JUMPY_JUMP) { mode = NORMAL; } // set direction based on tux if(tux.base.x > base.x) dir = RIGHT; else dir = LEFT; // move physic.apply(frame_ratio, base.x, base.y); if(dying == DYING_NOT) collision_swept_object_map(&old_base, &base); }
bool PARTICLE_DATA::set_data(const char * s) { switch(field) { case 0 : set_sprite(s); break; default: puts("warning: bad particle_data config block"); return false; break; } field++; return true; }
/** * \brief Constructor. * \param parent The parent window. * \param env The workspace environment to use. * \param spr The sprite to display. */ bf::sprite_view_ctrl::sprite_view_ctrl ( wxWindow& parent, workspace_environment& env, const sprite& spr ) : wxPanel(&parent), m_sprite_view(NULL), m_workspace(env) { create_controls(); create_sizers(); set_sprite(spr); m_combo_zoom->SetSelection( m_combo_zoom->FindString(wxT("100")) ); adjust_scrollbars(); } // sprite_view_ctrl::sprite_view_ctrl()
void AndrosynthGuardian::calculate() { STACKTRACE; Ship::calculate(); if (specialActive && (batt == -1)) { set_sprite(shipSprite); damage_factor = 0; specialActive = FALSE; vel = 0; turn_rate = shipTurnRate; recharge_amount = shipRechargeAmount; batt = 0; mass = normalMass; } return; }
void BadGuy::action_stalactite(double frame_ratio) { Player& tux = *World::current()->get_tux(); static const int SHAKETIME = 800; static const int RANGE = 40; if(mode == NORMAL) { // start shaking when tux is below the stalactite and at least 40 pixels // near if(tux.base.x + 32 > base.x - RANGE && tux.base.x < base.x + 32 + RANGE && tux.base.y + tux.base.height > base.y) { timer.start(SHAKETIME); mode = STALACTITE_SHAKING; } } if(mode == STALACTITE_SHAKING) { base.x = old_base.x + (rand() % 6) - 3; // TODO this could be done nicer... if(!timer.check()) { mode = STALACTITE_FALL; } } else if(mode == STALACTITE_FALL) { fall(); /* Destroy if we collides with land */ if(issolid(base.x+base.width/2, base.y+base.height)) { timer.start(2000); dying = DYING_SQUISHED; mode = FLAT; set_sprite(img_stalactite_broken, img_stalactite_broken); } } else if(mode == FLAT) { fall(); } // move physic.apply(frame_ratio, base.x, base.y); if(dying == DYING_SQUISHED && !timer.check()) remove_me(); }
void set_background( image_res_t *img ) { int i; SDL_Surface* old = background; image_res_t *old_img = background_img; // hide all sprites for ( i = 0; i < 0x20; i ++ ) set_sprite( i, NULL ); SDL_mutexP(sdl_mutex); if ( img ) { SDL_Surface* temp_surf; temp_surf = SDL_CreateRGBSurfaceFrom( img->data, img->width, img->height, img->bpp, img->width * (img->bpp / 8), 0, 0, 0, 0); background = SDL_DisplayFormat( temp_surf ); background_img = img; SDL_FreeSurface( temp_surf ); } else background = NULL; if ( old ) { SDL_FreeSurface( old ); free( old_img->data ); free( old_img ); } SDL_mutexV(sdl_mutex); SDL_ExposeEvent expose = { SDL_VIDEOEXPOSE }; SDL_PushEvent( &expose ); }
int AndrosynthGuardian::activate_special() { STACKTRACE; if (specialActive) return(FALSE); if (batt < 1) return(FALSE); set_sprite(specialSprite); normalMass = mass; shipTurnRate = turn_rate; shipRechargeAmount = recharge_amount; damage_factor = specialDamage; specialActive = TRUE; turn_rate = specialTurnRate; recharge_step = recharge_rate; recharge_amount = -1; mass = specialMass; return(TRUE); }
void BadGuy::action_bomb(double frame_ratio) { static const int TICKINGTIME = 1000; static const int EXPLODETIME = 1000; fall(); if(mode == NORMAL) { mode = BOMB_TICKING; timer.start(TICKINGTIME); } else if(!timer.check()) { if(mode == BOMB_TICKING) { mode = BOMB_EXPLODE; set_sprite(img_mrbomb_explosion, img_mrbomb_explosion); dying = DYING_NOT; // now the bomb hurts timer.start(EXPLODETIME); /* play explosion sound */ // FIXME: is the stereo all right? maybe we should use player cordinates... if (base.x < scroll_x + screen->w/2 - 10) play_sound(sounds[SND_EXPLODE], SOUND_LEFT_SPEAKER); else if (base.x > scroll_x + screen->w/2 + 10) play_sound(sounds[SND_EXPLODE], SOUND_RIGHT_SPEAKER); else play_sound(sounds[SND_EXPLODE], SOUND_CENTER_SPEAKER); } else if(mode == BOMB_EXPLODE) { remove_me(); return; } } // move physic.apply(frame_ratio, base.x, base.y); collision_swept_object_map(&old_base,&base); }
void Player::move(Level * level) { int speedx, speedy; int maxx; int momentumx_old; SDL_Rect rect; if(is_dead) return; last_position->x = position->x; last_position->y = position->y; last_position->w = position->w; last_position->h = position->h; if(is_duck) { last_position->y = last_position->y + (PLAYER_H - PLAYER_DUCK_H); last_position->h = PLAYER_DUCK_H; } speedx = 0; speedy = 0; if(is_hit) { // The player has been hit long enough if(Gameplay::frame > hit_start + hit_delay) { is_hit = false; } } if(is_frozen) { if(Gameplay::frame > freeze_start + PLAYER_FREEZE_FRAMES) { is_frozen = false; } } if(is_shielded) { if(Gameplay::frame > shield_start + PLAYER_SHIELD_FRAMES) { is_shielded = false; } if(Gameplay::frame == (shield_start + PLAYER_SHIELD_FRAMES - 60)) { Main::audio->play(SND_SHIELD, position->x + (position->w / 2)); } } speedx = SPEED_HORIZ; momentumx_old = momentumx; // Are we running? if(input->is_pressed(A_RUN)) { is_running = true; //maxx = MAX_MOMENTUM_RUN; maxx = SPEEDCLASSES[speedclass].run_speed; } else { is_running = false; maxx = MAX_MOMENTUM_HORIZ; } // Are we ducking? if(input->is_pressed(A_DOWN)) { is_duck = true; } else { is_duck = false; } // Are we forced to being ducked? if(is_duck_forced) { if(Gameplay::frame - duck_force_start > DUCK_FORCE_FRAMES) { is_duck_forced = false; } else { is_duck = true; } } // Force the player to duck when bumping the head if(!is_duck && level->is_intersecting(position)) { is_duck = true; } if(is_duck) { if(is_jumping || is_falling) { // The player can move when jumping and ducking at the same time maxx = MAX_MOMENTUM_HORIZ_DUCKJUMP; } else { // The player cannot move when ducking and standing on the ground maxx = 0; } } if(!is_frozen && input->is_pressed(A_LEFT)) { // Move more to the left if(momentumx > 0) momentumx -= MOMENTUM_INTERV_HORIZ; if(momentumx >= -maxx) momentumx -= MOMENTUM_INTERV_HORIZ; else momentumx += MOMENTUM_INTERV_HORIZ; } if(!is_frozen && input->is_pressed(A_RIGHT)) { // Move more to the right if(momentumx < 0) momentumx += MOMENTUM_INTERV_HORIZ; if(momentumx <= maxx) momentumx += MOMENTUM_INTERV_HORIZ; else momentumx -= MOMENTUM_INTERV_HORIZ; } if(is_frozen || (!input->is_pressed(A_LEFT) && !input->is_pressed(A_RIGHT))) { // Slide until we're standing still if(momentumx < 0) momentumx += MOMENTUM_INTERV_HORIZ; if(momentumx > 0) momentumx -= MOMENTUM_INTERV_HORIZ; } // Move the player horizontally speedx = (int)((double)speedx * ((double)momentumx / 10)); position->x += speedx; // Which sprite do we want to show? if(momentumx == 0) { // Standing still if(!input->is_pressed(A_LEFT) && !input->is_pressed(A_RIGHT)) { if(current_sprite >= SPR_L && current_sprite <= SPR_L_DUCK) { if(is_duck) { set_sprite(SPR_L_DUCK); } else if(is_jumping || is_falling) { set_sprite(SPR_L_JUMP); } else { set_sprite(SPR_L); } } if(current_sprite >= SPR_R && current_sprite <= SPR_R_DUCK) { if(is_duck) { set_sprite(SPR_R_DUCK); } else if(is_jumping || is_falling) { set_sprite(SPR_R_JUMP); } else { set_sprite(SPR_R); } } } else { if(input->is_pressed(A_LEFT) && !input->is_pressed(A_RIGHT)) { if(is_duck) set_sprite(SPR_L_DUCK); else set_sprite(SPR_L_WALK1); } if(!input->is_pressed(A_LEFT) && input->is_pressed(A_RIGHT)) { if(is_duck) set_sprite(SPR_R_DUCK); else set_sprite(SPR_R_WALK1); } } distance_walked = 0; } if(momentumx < 0) { // Moving left if(is_duck) { set_sprite(SPR_L_DUCK); } else if((is_jumping || is_falling) && !is_duck) { set_sprite(SPR_L_JUMP); } else { if(is_running) { if(current_sprite < SPR_L_RUN1 || current_sprite > SPR_L_RUN3) { set_sprite(SPR_L_RUN1); } } else { if(current_sprite < SPR_L_WALK1 || current_sprite > SPR_L_WALK3) { set_sprite(SPR_L_WALK1); } } if(input->is_pressed(A_RIGHT)) { set_sprite(SPR_L_BRAKE); distance_walked = 0; } if(distance_walked < -FRAME_CYCLE_DISTANCE) { if(is_running) cycle_sprite(SPR_L_RUN1, SPR_L_RUN3); else cycle_sprite(SPR_L_WALK1, SPR_L_WALK3); distance_walked = 0; } distance_walked += speedx; } } else if(momentumx > 0) { // Moving right if(is_duck) { set_sprite(SPR_R_DUCK); } else if(is_jumping || is_falling) { set_sprite(SPR_R_JUMP); } else { if(is_running) { if(current_sprite < SPR_R_RUN1 || current_sprite > SPR_R_RUN3) { set_sprite(SPR_R_RUN1); } } else { if(current_sprite < SPR_R_WALK1 || current_sprite > SPR_R_WALK3) { set_sprite(SPR_R_WALK1); } } if(input->is_pressed(A_LEFT)) { set_sprite(SPR_R_BRAKE); distance_walked = 0; } if(distance_walked > FRAME_CYCLE_DISTANCE) { if(is_running) cycle_sprite(SPR_R_RUN1, SPR_R_RUN3); else cycle_sprite(SPR_R_WALK1, SPR_R_WALK3); distance_walked = 0; } distance_walked += speedx; } } rect.x = position->x; rect.y = position->y; rect.w = position->w; rect.h = position->h; if(is_duck) { // If the player is ducking, the top should be lower rect.y = position->y + (PLAYER_H - PLAYER_DUCK_H); rect.h = PLAYER_DUCK_H; } if(level->is_intersecting(&rect)) { // Stop if colliding with the level position->x -= speedx; momentumx = 0; } // Move through the sides // If we went too far to the right, appear at the far left (and vica versa) if(position->x >= WINDOW_WIDTH) position->x -= WINDOW_WIDTH; if(position->x < 0) position->x += WINDOW_WIDTH; // Jumping if(input->is_pressed(A_JUMP) && !is_falling && !is_jumping && !is_frozen) { // Start the jump momentumy = MAX_MOMENTUM_JUMP; is_jumping = true; Main::instance->audio->play(SND_JUMP, position->x); } if(!input->is_pressed(A_JUMP) && is_jumping) { // The up key is released, so fall faster is_jumping = false; is_falling = true; } if(is_falling || is_jumping) { speedy = SPEED_VERT; // Increase downward momentum (= decrease upward momentum) if(momentumy > -MAX_MOMENTUM_FALL) { momentumy -= MOMENTUM_INTERV_VERT; // Falling is faster than jumping (also.. we start to fall faster when the // up key is not held down) if(is_falling) momentumy -= MOMENTUM_INTERV_VERT; } } speedy = (int)((double)speedy * ((double)momentumy / 10)); // Move the player vertically position->y -= speedy; rect.x = position->x; rect.y = position->y; rect.w = position->w; rect.h = position->h; if(is_duck) { // If the player is ducking, the top should be lower rect.y = position->y + (PLAYER_H - PLAYER_DUCK_H); rect.h = PLAYER_DUCK_H; } // Did we hit something? if(level->is_intersecting(&rect)) { if(speedy > 0) { level->bounce_tile(&rect); } // Put the player back into the previous position position->y += speedy; if(speedy > 0) { // Bounce off the top (bump head) is_jumping = false; is_falling = true; momentumy = 0; } else { // Stop at the bottom is_jumping = false; is_falling = false; momentumy = 0; } } if(!is_jumping && !is_falling && !level->is_on_bottom(position)) { // start falling when there is no bottom is_falling = true; } // Die when we fall out of the level if(position->y + position->h > (14 * TILE_H)) { hitpoints = 0; } }
PARTICLE_DATA::PARTICLE_DATA(const char * sprite_path, int life, double speed) : life(life), speed(speed), field(0), type(0), frame_rate(0), particle_type(0) { set_sprite(sprite_path); }
BadGuy::BadGuy(float x, float y, BadGuyKind kind_, bool stay_on_platform_) : removable(false), squishcount(0) { base.x = x; base.y = y; base.width = 0; base.height = 0; base.xm = 0; base.ym = 0; stay_on_platform = stay_on_platform_; mode = NORMAL; dying = DYING_NOT; kind = kind_; old_base = base; dir = LEFT; seen = false; animation_offset = 0; sprite_left = sprite_right = 0; physic.reset(); timer.init(true); if(kind == BAD_MRBOMB) { physic.set_velocity(-BADGUY_WALK_SPEED, 0); set_sprite(img_mrbomb_left, img_mrbomb_right); } else if (kind == BAD_MRICEBLOCK) { physic.set_velocity(-BADGUY_WALK_SPEED, 0); set_sprite(img_mriceblock_left, img_mriceblock_right); } else if(kind == BAD_JUMPY) { set_sprite(img_jumpy_left_up, img_jumpy_left_up); } else if(kind == BAD_BOMB) { set_sprite(img_mrbomb_ticking_left, img_mrbomb_ticking_right); // hack so that the bomb doesn't hurt until it expldes... dying = DYING_SQUISHED; } else if(kind == BAD_FLAME) { base.ym = 0; // we misuse base.ym as angle for the flame physic.enable_gravity(false); set_sprite(img_flame, img_flame); } else if(kind == BAD_BOUNCINGSNOWBALL) { physic.set_velocity(-1.3, 0); set_sprite(img_bouncingsnowball_left, img_bouncingsnowball_right); } else if(kind == BAD_STALACTITE) { physic.enable_gravity(false); set_sprite(img_stalactite, img_stalactite); } else if(kind == BAD_FISH) { set_sprite(img_fish, img_fish); physic.enable_gravity(true); } else if(kind == BAD_FLYINGSNOWBALL) { set_sprite(img_flyingsnowball, img_flyingsnowball); physic.enable_gravity(false); } else if(kind == BAD_SPIKY) { physic.set_velocity(-BADGUY_WALK_SPEED, 0); set_sprite(img_spiky_left, img_spiky_right); } else if(kind == BAD_SNOWBALL) { physic.set_velocity(-BADGUY_WALK_SPEED, 0); set_sprite(img_snowball_left, img_snowball_right); } // if we're in a solid tile at start correct that now if(kind != BAD_FLAME && kind != BAD_FISH && collision_object_map(base)) { std::cout << "Warning: badguy started in wall: kind: " << badguykind_to_string(kind) << " pos: (" << base.x << ", " << base.y << ")" << std::endl; while(collision_object_map(base)) --base.y; } }
void BadGuy::action_mriceblock(double frame_ratio) { Player& tux = *World::current()->get_tux(); if(mode != HELD) fall(); /* Move left/right: */ if (mode != HELD) { // move physic.apply(frame_ratio, base.x, base.y); if (dying != DYING_FALLING) collision_swept_object_map(&old_base,&base); } else if (mode == HELD) { /* FIXME: The pbad object shouldn't know about pplayer objects. */ /* If we're holding the iceblock */ dir = tux.dir; if(dir==RIGHT) { base.x = tux.base.x + 16; base.y = tux.base.y + tux.base.height/1.5 - base.height; } else /* facing left */ { base.x = tux.base.x - 16; base.y = tux.base.y + tux.base.height/1.5 - base.height; } if(collision_object_map(base)) { base.x = tux.base.x; base.y = tux.base.y + tux.base.height/1.5 - base.height; } if(tux.input.fire != DOWN) /* SHOOT! */ { if(dir == LEFT) base.x -= 24; else base.x += 24; old_base = base; mode=KICK; tux.kick_timer.start(KICKING_TIME); set_sprite(img_mriceblock_flat_left, img_mriceblock_flat_right); physic.set_velocity_x((dir == LEFT) ? -3.5 : 3.5); play_sound(sounds[SND_KICK],SOUND_CENTER_SPEAKER); } } if (!dying) { int changed = dir; check_horizontal_bump(); if(mode == KICK && changed != dir) { /* handle stereo sound (number 10 should be tweaked...)*/ if (base.x < scroll_x + screen->w/2 - 10) play_sound(sounds[SND_RICOCHET], SOUND_LEFT_SPEAKER); else if (base.x > scroll_x + screen->w/2 + 10) play_sound(sounds[SND_RICOCHET], SOUND_RIGHT_SPEAKER); else play_sound(sounds[SND_RICOCHET], SOUND_CENTER_SPEAKER); } } /* Handle mode timer: */ if (mode == FLAT) { if(!timer.check()) { mode = NORMAL; set_sprite(img_mriceblock_left, img_mriceblock_right); physic.set_velocity( (dir == LEFT) ? -.8 : .8, 0); } } }
void BadGuy::collision(void *p_c_object, int c_object, CollisionType type) { BadGuy* pbad_c = NULL; if(type == COLLISION_BUMP) { bump(); return; } if(type == COLLISION_SQUISH) { Player* player = static_cast<Player*>(p_c_object); squish(player); return; } /* COLLISION_NORMAL */ switch (c_object) { case CO_BULLET: kill_me(10); break; case CO_BADGUY: pbad_c = (BadGuy*) p_c_object; /* If we're a kicked mriceblock, kill any badguys we hit */ if(kind == BAD_MRICEBLOCK && mode == KICK) { pbad_c->kill_me(25); } // a held mriceblock gets kills the enemy too but falls to ground then else if(kind == BAD_MRICEBLOCK && mode == HELD) { pbad_c->kill_me(25); kill_me(0); } /* Kill badguys that run into exploding bomb */ else if (kind == BAD_BOMB && dying == DYING_NOT) { if (pbad_c->kind == BAD_MRBOMB) { // mrbomb transforms into a bomb now explode(pbad_c); return; } else if (pbad_c->kind != BAD_MRBOMB) { pbad_c->kill_me(50); } } /* Kill any badguys that get hit by stalactite */ else if (kind == BAD_STALACTITE && dying == DYING_NOT) { if (pbad_c->kind == BAD_MRBOMB) { // mrbomb transforms into a bomb now explode(pbad_c); return; } else pbad_c->kill_me(50); } /* When enemies run into eachother, make them change directions */ else { // Jumpy, fish, flame, stalactites are exceptions if (pbad_c->kind == BAD_JUMPY || pbad_c->kind == BAD_FLAME || pbad_c->kind == BAD_STALACTITE || pbad_c->kind == BAD_FISH) break; // Bounce off of other badguy if we land on top of him if (base.y + base.height < pbad_c->base.y + pbad_c->base.height) { if (pbad_c->dir == LEFT) { dir = RIGHT; physic.set_velocity(fabsf(physic.get_velocity_x()), 2); } else if (pbad_c->dir == RIGHT) { dir = LEFT; physic.set_velocity(-fabsf(physic.get_velocity_x()), 2); } break; } else if (base.y + base.height > pbad_c->base.y + pbad_c->base.height) break; if (pbad_c->kind != BAD_FLAME) { if (dir == LEFT) { dir = RIGHT; physic.set_velocity_x(fabsf(physic.get_velocity_x())); } else if (dir == RIGHT) { dir = LEFT; physic.set_velocity_x(-fabsf(physic.get_velocity_x())); } } } break; case CO_PLAYER: Player* player = static_cast<Player*>(p_c_object); /* Get kicked if were flat */ if (mode == FLAT && !dying) { play_sound(sounds[SND_KICK], SOUND_CENTER_SPEAKER); // Hit from left side if (player->base.x < base.x) { physic.set_velocity_x(5); dir = RIGHT; } // Hit from right side else { physic.set_velocity_x(-5); dir = LEFT; } mode = KICK; player->kick_timer.start(KICKING_TIME); set_sprite(img_mriceblock_flat_left, img_mriceblock_flat_right); } break; } }
void BadGuy::squish(Player* player) { static const int MAX_ICEBLOCK_SQUICHES = 10; if(kind == BAD_MRBOMB) { // mrbomb transforms into a bomb now World::current()->add_bad_guy(base.x, base.y, BAD_BOMB); make_player_jump(player); World::current()->add_score(base.x - scroll_x, base.y, 50 * player_status.score_multiplier); play_sound(sounds[SND_SQUISH], SOUND_CENTER_SPEAKER); player_status.score_multiplier++; remove_me(); return; } else if (kind == BAD_MRICEBLOCK) { if (mode == NORMAL || mode == KICK) { /* Flatten! */ play_sound(sounds[SND_STOMP], SOUND_CENTER_SPEAKER); mode = FLAT; set_sprite(img_mriceblock_flat_left, img_mriceblock_flat_right); physic.set_velocity_x(0); timer.start(4000); } else if (mode == FLAT) { /* Kick! */ play_sound(sounds[SND_KICK], SOUND_CENTER_SPEAKER); if (player->base.x < base.x + (base.width/2)) { physic.set_velocity_x(5); dir = RIGHT; } else { physic.set_velocity_x(-5); dir = LEFT; } mode = KICK; player->kick_timer.start(KICKING_TIME); set_sprite(img_mriceblock_flat_left, img_mriceblock_flat_right); } make_player_jump(player); player_status.score_multiplier++; // check for maximum number of squiches squishcount++; if(squishcount >= MAX_ICEBLOCK_SQUICHES) { kill_me(50); return; } return; } else if(kind == BAD_FISH) { // fish can only be killed when falling down if(physic.get_velocity_y() >= 0) return; make_player_jump(player); World::current()->add_score(base.x - scroll_x, base.y, 25 * player_status.score_multiplier); player_status.score_multiplier++; // simply remove the fish... remove_me(); return; } else if(kind == BAD_BOUNCINGSNOWBALL) { squish_me(player); set_sprite(img_bouncingsnowball_squished,img_bouncingsnowball_squished); return; } else if(kind == BAD_FLYINGSNOWBALL) { squish_me(player); set_sprite(img_flyingsnowball_squished,img_flyingsnowball_squished); return; } else if(kind == BAD_SNOWBALL) { squish_me(player); set_sprite(img_snowball_squished_left, img_snowball_squished_right); return; } }