implement owl :D

This commit is contained in:
Sebastian Krzyszkowiak 2012-05-20 23:17:52 +02:00
parent 836eaedc41
commit cd65b1d8e5
2 changed files with 24 additions and 2 deletions

View file

@ -183,7 +183,7 @@ void Level_Draw(struct Game *game) {
TM_AddBackgroundAction(&LevelFailed, NULL, 0, "levelfailed");
}
}
tmp->x -= tps(game, game->level.speed*game->level.speed_modifier*60*tmp->speed)*310;
tmp->x -= tps(game, game->level.speed*game->level.speed_modifier*60*tmp->speed)*100*al_get_bitmap_width(game->level.stage)/(float)al_get_display_width(game->display);
if (tmp->callback) tmp->callback(game, tmp);
tmp = tmp->next;
} else {
@ -310,6 +310,25 @@ void Level_Load(struct Game *game) {
*/
TM_AddAction(&PassLevel, NULL, "passlevel");
struct Obstacle *obst = malloc(sizeof(struct Obstacle));
obst->prev = NULL;
obst->next = NULL;
obst->x = 83.5;
obst->y = 55;
obst->speed = 1;
obst->points = 0;
obst->hit = false;
obst->rows = 1;
obst->cols = 1;
obst->pos = 0;
obst->blanks = 0;
obst->anim_speed = 0;
obst->tmp_pos = 0;
obst->callback = NULL;
obst->data = NULL;
obst->bitmap = &(game->level.owl);
game->level.obstacles = obst;
}
}
@ -433,7 +452,7 @@ void Level_UnloadBitmaps(struct Game *game) {
}
void Level_PreloadBitmaps(struct Game *game, void (*progress)(struct Game*, float)) {
PROGRESS_INIT(12);
PROGRESS_INIT(13);
int x = 0;
struct Spritesheet *tmp = game->level.derpy_sheets;
while (tmp) {
@ -473,6 +492,8 @@ void Level_PreloadBitmaps(struct Game *game, void (*progress)(struct Game*, floa
PROGRESS;
game->level.obst_bmps.muffin = LoadScaledBitmap("levels/muffin.png", al_get_display_width(game->display)*0.07, al_get_display_height(game->display)*0.1);
PROGRESS;
game->level.owl = LoadScaledBitmap("levels/owl.png", al_get_display_width(game->display)*0.08, al_get_display_width(game->display)*0.08);
PROGRESS;
game->level.welcome = al_create_bitmap(al_get_display_width(game->display), al_get_display_height(game->display)/2);
PROGRESS;
al_set_target_bitmap(game->level.welcome);

View file

@ -121,6 +121,7 @@ struct Level {
ALLEGRO_SAMPLE *sample; /*!< Sample with background music. */
ALLEGRO_SAMPLE_INSTANCE *music; /*!< Sample instance with background music. */
unsigned int music_pos; /*!< Position of sample instance. Used when pausing game. */
ALLEGRO_BITMAP *owl; /*!< Owlicious bitmap. */
ALLEGRO_BITMAP *background; /*!< Bitmap of the background layer of the scene. */
ALLEGRO_BITMAP *stage; /*!< Bitmap of the stage layer of the scene. */
ALLEGRO_BITMAP *foreground; /*!< Bitmap of the foreground layer of the scene. */