mirror of
https://gitlab.com/dosowisko.net/libsuperderpy.git
synced 2025-02-01 11:06:44 +01:00
hide muffin when eated, tweaks for level length and hardness
This commit is contained in:
parent
fe8fbcb425
commit
836eaedc41
2 changed files with 13 additions and 6 deletions
15
src/level.c
15
src/level.c
|
@ -144,8 +144,11 @@ void Level_Draw(struct Game *game) {
|
||||||
/*PrintConsole(game, "DRAWING %f %f", tmp->x, tmp->y);*/
|
/*PrintConsole(game, "DRAWING %f %f", tmp->x, tmp->y);*/
|
||||||
int x = (tmp->x/100.0)*al_get_display_width(game->display);
|
int x = (tmp->x/100.0)*al_get_display_width(game->display);
|
||||||
int y = (tmp->y/100.0)*al_get_display_height(game->display);
|
int y = (tmp->y/100.0)*al_get_display_height(game->display);
|
||||||
int w = al_get_bitmap_width(*(tmp->bitmap))/tmp->cols;
|
int w = 0, h = 0;
|
||||||
int h = al_get_bitmap_height(*(tmp->bitmap))/tmp->rows;
|
if (tmp->bitmap) {
|
||||||
|
w = al_get_bitmap_width(*(tmp->bitmap))/tmp->cols;
|
||||||
|
h = al_get_bitmap_height(*(tmp->bitmap))/tmp->rows;
|
||||||
|
}
|
||||||
if (x > -w) {
|
if (x > -w) {
|
||||||
/*if (!tmp->hit)*/
|
/*if (!tmp->hit)*/
|
||||||
if ((((x>=derpyx+0.38*derpyw+derpyo) && (x<=derpyx+0.94*derpyw+derpyo)) || ((x+w>=derpyx+0.38*derpyw+derpyo) && (x+w<=derpyx+0.94*derpyw+derpyo))) &&
|
if ((((x>=derpyx+0.38*derpyw+derpyo) && (x<=derpyx+0.94*derpyw+derpyo)) || ((x+w>=derpyx+0.38*derpyw+derpyo) && (x+w<=derpyx+0.94*derpyw+derpyo))) &&
|
||||||
|
@ -153,7 +156,7 @@ void Level_Draw(struct Game *game) {
|
||||||
tmp->hit=true;
|
tmp->hit=true;
|
||||||
}
|
}
|
||||||
|
|
||||||
al_draw_bitmap_region(*(tmp->bitmap),w*(tmp->pos%tmp->cols), h*(tmp->pos/tmp->cols),w,h,x,y,0);
|
if (tmp->bitmap) al_draw_bitmap_region(*(tmp->bitmap),w*(tmp->pos%tmp->cols), h*(tmp->pos/tmp->cols),w,h,x,y,0);
|
||||||
|
|
||||||
if (tmp->anim_speed) {
|
if (tmp->anim_speed) {
|
||||||
tmp->tmp_pos+=tps(game, 60);
|
tmp->tmp_pos+=tps(game, 60);
|
||||||
|
@ -168,11 +171,15 @@ void Level_Draw(struct Game *game) {
|
||||||
if (game->level.debug_show_sprite_frames) al_draw_rectangle(x, y, x+w, y+h, al_map_rgba(255,0,0,255), 3);
|
if (game->level.debug_show_sprite_frames) al_draw_rectangle(x, y, x+w, y+h, al_map_rgba(255,0,0,255), 3);
|
||||||
|
|
||||||
if (tmp->hit) {
|
if (tmp->hit) {
|
||||||
colision = true;
|
if (tmp->points<0) colision = true;
|
||||||
|
else tmp->bitmap = NULL;
|
||||||
game->level.hp+=tps(game, 60*0.0002*tmp->points*(((1-game->level.speed_modifier)/2.0)+1));
|
game->level.hp+=tps(game, 60*0.0002*tmp->points*(((1-game->level.speed_modifier)/2.0)+1));
|
||||||
|
if (game->level.hp>1) game->level.hp=1;
|
||||||
PrintConsole(game, "POINTS: %d, %f", tmp->points, tps(game, 60*0.0002*tmp->points*game->level.speed_modifier));
|
PrintConsole(game, "POINTS: %d, %f", tmp->points, tps(game, 60*0.0002*tmp->points*game->level.speed_modifier));
|
||||||
if ((game->level.hp<=0) && (!game->level.failed)) {
|
if ((game->level.hp<=0) && (!game->level.failed)) {
|
||||||
game->level.failed = true;
|
game->level.failed = true;
|
||||||
|
game->level.handle_input = false;
|
||||||
|
game->level.speed_modifier = 1;
|
||||||
TM_AddBackgroundAction(&LevelFailed, NULL, 0, "levelfailed");
|
TM_AddBackgroundAction(&LevelFailed, NULL, 0, "levelfailed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -100,7 +100,7 @@ bool GenerateObstacles(struct Game *game, struct TM_Action *action, enum TM_Acti
|
||||||
*in = true;*/
|
*in = true;*/
|
||||||
}
|
}
|
||||||
else if (state == TM_ACTIONSTATE_RUNNING) {
|
else if (state == TM_ACTIONSTATE_RUNNING) {
|
||||||
if (rand()%(10000/(int)tps(game, 60*85))<=2) {
|
if (rand()%(10000/(int)tps(game, 60*85*game->level.speed_modifier))<=2) {
|
||||||
PrintConsole(game, "OBSTACLE %d", *count);
|
PrintConsole(game, "OBSTACLE %d", *count);
|
||||||
(*count)++;
|
(*count)++;
|
||||||
struct Obstacle *obst = malloc(sizeof(struct Obstacle));
|
struct Obstacle *obst = malloc(sizeof(struct Obstacle));
|
||||||
|
@ -143,7 +143,7 @@ bool GenerateObstacles(struct Game *game, struct TM_Action *action, enum TM_Acti
|
||||||
obst->next = NULL;
|
obst->next = NULL;
|
||||||
}
|
}
|
||||||
game->level.obstacles = obst;
|
game->level.obstacles = obst;
|
||||||
if (*count > 64) return true;
|
if (*count > 128) return true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
free(action->arguments->value);
|
free(action->arguments->value);
|
||||||
|
|
Loading…
Reference in a new issue