}
/* Break a brick: */
-
-void trybreakbrick(float x, float y)
+void trybreakbrick(float x, float y, bool small)
{
Tile* tile = gettile(x, y);
if (tile->brick)
score = score + SCORE_DISTRO;
distros++;
}
- else
+ else if (!small)
{
/* Get rid of it: */
level_change(¤t_level,x, y, TM_IA, tile->next_tile);
+
+ /* Replace it with broken bits: */
+ add_broken_brick(((int)(x + 1) / 32) * 32,
+ (int)(y / 32) * 32);
+
+ /* Get some score: */
+ play_sound(sounds[SND_BRICK], SOUND_CENTER_SPEAKER);
+ score = score + SCORE_BRICK;
}
-
-
- /* Replace it with broken bits: */
-
- add_broken_brick(((int)(x + 1) / 32) * 32,
- (int)(y / 32) * 32);
-
-
- /* Get some score: */
-
- play_sound(sounds[SND_BRICK], SOUND_CENTER_SPEAKER);
- score = score + SCORE_BRICK;
}
}
void drawshape(float x, float y, unsigned int c);
unsigned int shape(float x, float y);
void bumpbrick(float x, float y);
+
+/** Try to grab the coin at the given coordinates */
void trygrabdistro(float x, float y, int bounciness);
-void trybreakbrick(float x, float y);
+
+/** Try to break the brick at the given coordinates */
+void trybreakbrick(float x, float y, bool small);
+
+/** Try to get the content out of a bonus box, thus emptying it */
void tryemptybox(float x, float y, int col_side);
+
+/** Try to bumb a badguy that might we walking above Tux, thus shaking
+ the tile which the badguy is walking on an killing him this way */
void trybumpbadguy(float x, float y);
#endif /*SUPERTUX_GAMELOOP_H*/
trygrabdistro(base.x, base.y - 32,BOUNCE);
trybumpbadguy(base.x, base.y - 64);
- if(size == BIG)
- trybreakbrick(base.x, base.y);
+ trybreakbrick(base.x, base.y, size == SMALL);
bumpbrick(base.x, base.y);
tryemptybox(base.x, base.y, RIGHT);
trybumpbadguy(base.x+ 31, base.y - 64);
if(size == BIG)
- trybreakbrick(base.x+ 31, base.y);
+ trybreakbrick(base.x+ 31, base.y, size == SMALL);
bumpbrick(base.x+ 31, base.y);
tryemptybox(base.x+ 31, base.y, LEFT);
}
-
-
- if(size == SMALL)
- {
- Tile* tile = gettile(base.x, base.y);
- /* Get a distro from a brick? */
- if (tile->brick)
- {
- add_bouncy_distro((((int)base.x)
- / 32) * 32,
- ((int)base.y / 32) * 32);
-
- if (counting_distros == false)
- {
- counting_distros = true;
- distro_counter = 100;
- }
-
- if (distro_counter <= 0)
- level_change(¤t_level,base.x,base.y - 1, TM_IA, tile->next_tile);
-
- play_sound(sounds[SND_DISTRO], SOUND_CENTER_SPEAKER);
- score = score + SCORE_DISTRO;
- distros++;
- }
- }
- else
- {
- Tile* tile2 = gettile(base.x + 31, base.y);
- if (tile2->brick)
- {
- add_bouncy_distro((((int)base.x + 31)
- / 32) * 32,
- ((int)base.y / 32) * 32);
- if (counting_distros == false)
- {
- counting_distros = true;
- distro_counter = 100;
- }
-
- if (distro_counter <= 0)
- level_change(¤t_level,base.x+ 31, base.y, TM_IA, tile2->next_tile);
-
- play_sound(sounds[SND_DISTRO], SOUND_CENTER_SPEAKER);
- score = score + SCORE_DISTRO;
- distros++;
- }
- }
}
grabdistros();
tile->fullbox = false;
tile->distro = false;
tile->data = 0;
- tile->alpha = 0;
tile->next_tile = 0;
tile->anim_speed = 25;
reader.read_bool("ice", &tile->ice);
reader.read_bool("fullbox", &tile->fullbox);
reader.read_bool("distro", &tile->distro);
- reader.read_int("data", (int*)&tile->data);
- reader.read_int("alpha", (int*)&tile->alpha);
+ reader.read_int("data", &tile->data);
reader.read_int("anim-speed", &tile->anim_speed);
reader.read_int("next-tile", &tile->next_tile);
reader.read_string_vector("images", &tile->filenames);
int next_tile;
int anim_speed;
- unsigned char alpha;
};