mirror of
https://gitlab.com/dosowisko.net/libsuperderpy.git
synced 2025-02-08 06:06:43 +01:00
rotating muffins
This commit is contained in:
parent
2fc3ac1a9a
commit
d0f2ab8575
7 changed files with 23 additions and 6 deletions
|
@ -264,7 +264,7 @@ void Intro_Unload(struct Game *game) {
|
|||
for(fadeloop=255; fadeloop>=0; fadeloop-=tps(game, 600)){
|
||||
al_wait_for_event(game->event_queue, &ev);
|
||||
if (game->intro.in_animation) {
|
||||
al_draw_tinted_bitmap(game->intro.table, al_map_rgba_f(fadeloop/255.0,fadeloop/255.0,fadeloop/255.0,1), -1*al_get_display_width(game->display) + (cos(((-1*((game->intro.position)%al_get_display_width(game->display)))/(float)al_get_display_width(game->display))*(3.1415))/2.0)*al_get_display_width(game->display) + al_get_display_width(game->display)/2.0, 0, 0);
|
||||
al_draw_tinted_bitmap(game->intro.table, al_map_rgba_f(fadeloop/255.0,fadeloop/255.0,fadeloop/255.0,1), -1*al_get_display_width(game->display) + (cos(((-1*((game->intro.position)%al_get_display_width(game->display)))/(float)al_get_display_width(game->display))*(ALLEGRO_PI))/2.0)*al_get_display_width(game->display) + al_get_display_width(game->display)/2.0, 0, 0);
|
||||
AnimPage(game, game->intro.page, al_map_rgba_f(fadeloop/255.0,fadeloop/255.0,fadeloop/255.0,1));
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -156,7 +156,11 @@ void Level_Draw(struct Game *game) {
|
|||
tmp->hit=true;
|
||||
}
|
||||
|
||||
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->bitmap) {
|
||||
ALLEGRO_BITMAP* subbitmap = al_create_sub_bitmap(*(tmp->bitmap),w*(tmp->pos%tmp->cols), h*(tmp->pos/tmp->cols),w,h);
|
||||
al_draw_rotated_bitmap(subbitmap,w/2.0, h/2.0, x+w/2.0,y+h/2.0, tmp->angle, 0);
|
||||
al_destroy_bitmap(subbitmap);
|
||||
}
|
||||
|
||||
if (tmp->anim_speed) {
|
||||
tmp->tmp_pos+=tps(game, 60);
|
||||
|
|
|
@ -116,9 +116,11 @@ bool GenerateObstacles(struct Game *game, struct TM_Action *action, enum TM_Acti
|
|||
obst->blanks = 0;
|
||||
obst->anim_speed = 0;
|
||||
obst->tmp_pos = 0;
|
||||
if (rand()%100<=10) {
|
||||
obst->callback = NULL;
|
||||
obst->data = NULL;
|
||||
obst->angle = 0;
|
||||
if (rand()%100<=15) {
|
||||
obst->callback= &Obst_RotateSin;
|
||||
obst->data = malloc(sizeof(float));
|
||||
*((float*)obst->data) = 0;
|
||||
obst->points = 5;
|
||||
obst->bitmap = &(game->level.obst_bmps.muffin);
|
||||
} else if (rand()%100<=75) {
|
||||
|
|
|
@ -36,6 +36,13 @@ void Obst_MoveUpDown(struct Game *game, struct Obstacle *obstacle) {
|
|||
}
|
||||
}
|
||||
|
||||
void Obst_RotateSin(struct Game *game, struct Obstacle *obstacle) {
|
||||
float* a = (float*)obstacle->data;
|
||||
/*PrintConsole(game, "%p - %f", obstacle, obstacle->y);*/
|
||||
obstacle->angle = sin(*a)/2.0;
|
||||
*a+=tps(game, 4.5);
|
||||
}
|
||||
|
||||
void Obst_MoveSin(struct Game *game, struct Obstacle *obstacle) {
|
||||
float* a = (float*)obstacle->data;
|
||||
/*PrintConsole(game, "%p - %f", obstacle, obstacle->y);*/
|
||||
|
|
|
@ -26,3 +26,6 @@ void Obst_MoveUpDown(struct Game *game, struct Obstacle *obstacle);
|
|||
|
||||
/*! \brief Move in sinusoidal way in Y-axis relative to position at beginning. */
|
||||
void Obst_MoveSin(struct Game *game, struct Obstacle *obstacle);
|
||||
|
||||
/*! \brief Rotate in sinusoidal way. */
|
||||
void Obst_RotateSin(struct Game *game, struct Obstacle *obstacle);
|
||||
|
|
|
@ -227,7 +227,7 @@ ALLEGRO_BITMAP* LoadScaledBitmap(char* filename, int width, int height) {
|
|||
al_set_new_bitmap_flags(ALLEGRO_MEMORY_BITMAP);
|
||||
|
||||
source = al_load_bitmap( origfn );
|
||||
al_set_new_bitmap_flags(ALLEGRO_MAG_LINEAR | ALLEGRO_MIN_LINEAR);
|
||||
al_set_new_bitmap_flags(ALLEGRO_MIN_LINEAR | ALLEGRO_MAG_LINEAR);
|
||||
|
||||
ScaleBitmap(source, width, height);
|
||||
/*al_save_bitmap(cachefn, target);
|
||||
|
|
|
@ -66,6 +66,7 @@ struct Obstacle {
|
|||
float x; /*!< Horizontal position on the screen, in range 0-100. */
|
||||
float y; /*!< Vertical position on the screen, in range 0-100. */
|
||||
float speed; /*!< Horizontal speed of obstracle. */
|
||||
float angle; /*!< Angle of bitmap rotation in radians. */
|
||||
int points; /*!< Number of points given when hit by player. Positive gives HP to power, negative takes it. */
|
||||
bool hit; /*!< Indicates if this obstacle was already hit by the player or not. */
|
||||
|
||||
|
|
Loading…
Reference in a new issue