Added some graphics, changed score system for other ball sizes

This commit is contained in:
Michael Chen 2018-02-01 17:55:15 +01:00
parent eb0341bd3d
commit f64af0d0d9
5 changed files with 74 additions and 70 deletions

View File

@ -13,6 +13,8 @@
#define BG_Path_1 "assets/images/bg/bg1.png"
#define BG_Path_2 "assets/images/bg/bg2.png"
#define BG_Path_3 "assets/images/bg/bg3.png"
#define BG_Path_4 "assets/images/bg/bg4.png"
int BACKGROUND_BoxWidth, BACKGROUND_BoxHeight;
int BACKGROUND_TextureCount;
@ -25,12 +27,13 @@ void BACKGROUND_Initialize(SDL_Renderer * renderer, int width, int height){
printf("Initializing Background...\n");
BACKGROUND_BoxWidth = width;
BACKGROUND_BoxHeight = height;
BACKGROUND_TextureCount = 2;
BACKGROUND_TextureCount = 4;
BACKGROUND_TotalRect = (SDL_Rect) {.x = 0, .y = 0, .w = 1920, .h = 1080 };
BACKGROUND_Textures = malloc(BACKGROUND_TextureCount * sizeof(SDL_Texture *));
BACKGROUND_Textures[0] = IMG_LoadTexture(renderer, BG_Path_1);
BACKGROUND_Textures[1] = IMG_LoadTexture(renderer, BG_Path_2);
// BACKGROUND_Textures[2] = IMG_LoadTexture(renderer, BG_Path_3);
BACKGROUND_Textures[2] = IMG_LoadTexture(renderer, BG_Path_3);
BACKGROUND_Textures[3] = IMG_LoadTexture(renderer, BG_Path_4);
printf("Background initialized!\n");
BACKGROUND_IsInit = true;
} else

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 81 KiB

View File

@ -511,7 +511,7 @@ void BALL_Update(Ball * obj, Scenery * scenery){
BLOCK_DealDamage(blocks + i, 1);
if (blocks[i].HP <= 0) {
(scenery->DestroyedBlocks)++;
BREAKOUT_IncreaseScoreBy(scenery, (int)round((((scenery->ball).Speed) * ((scenery->ball).Speed) / 5.0f)));
BREAKOUT_IncreaseScoreBy(scenery, (int)round((15.0f / ((scenery->ball).Size)) * (((scenery->ball).Speed) * ((scenery->ball).Speed) / 5.0f)));
}
(obj->Location) = VECTOR_Add(oldLocation, (obj->Momentum));
BALL_MoveAwayFromBoundaries(obj);

View File

@ -40,7 +40,7 @@ bool Settings_IsInit = false;
bool IsLock = false;
void Settings_Initialize(SDL_Renderer * renderer, Scenery * scenery) {
Initialize_Slider(400,300,Scalar_width,Bar_width,Slider_height,0,1,&BG,0);
Initialize_Slider(400, 300, Scalar_width, Bar_width, Slider_height, 0, 3, &BG, 0);
Initialize_Slider(400, 500, Scalar_width, Bar_width, Slider_height, 10, 100, &BS, scenery->ball.TargetRect.w);
Initialize_Slider(400, 700, Scalar_width, Bar_width, Slider_height, 0, 8, &BT, scenery->ball.TextureIndex);
// Initialize_Slider(400,300,Scalar_width,Bar_width,Slider_height,0,8,&BT,scenery->paddle.TextureIndex);
@ -63,10 +63,11 @@ void Settings_Initialize (SDL_Renderer* renderer,Scenery* scenery) {
Circle_rect = (SDL_Rect) {.x = 1250, .y = 500, .w = 75, .h = 75 };
Settings_IsInit = true;
}
} /* Settings_Initialize */
void Settings_Draw(SDL_Renderer * renderer, Scenery * scenery, int * backgroundcount) {
double x;
if (!(Mousestate & SDL_BUTTON(SDL_BUTTON_LEFT))) {
IsLock = BG.IsLock = BS.IsLock = BT.IsLock = false;
} else {
@ -97,7 +98,7 @@ void Settings_Draw(SDL_Renderer * renderer, Scenery * scenery,int *backgroundcou
mapping(&x, &BG);
x = round(x);
*backgroundcount = x;
}
} /* Settings_Draw */
void Settings_Deinitialize(){
if (Settings_IsInit) {