Added some graphics, changed score system for other ball sizes
This commit is contained in:
parent
eb0341bd3d
commit
f64af0d0d9
@ -13,6 +13,8 @@
|
|||||||
|
|
||||||
#define BG_Path_1 "assets/images/bg/bg1.png"
|
#define BG_Path_1 "assets/images/bg/bg1.png"
|
||||||
#define BG_Path_2 "assets/images/bg/bg2.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_BoxWidth, BACKGROUND_BoxHeight;
|
||||||
int BACKGROUND_TextureCount;
|
int BACKGROUND_TextureCount;
|
||||||
@ -25,12 +27,13 @@ void BACKGROUND_Initialize(SDL_Renderer * renderer, int width, int height){
|
|||||||
printf("Initializing Background...\n");
|
printf("Initializing Background...\n");
|
||||||
BACKGROUND_BoxWidth = width;
|
BACKGROUND_BoxWidth = width;
|
||||||
BACKGROUND_BoxHeight = height;
|
BACKGROUND_BoxHeight = height;
|
||||||
BACKGROUND_TextureCount = 2;
|
BACKGROUND_TextureCount = 4;
|
||||||
BACKGROUND_TotalRect = (SDL_Rect) {.x = 0, .y = 0, .w = 1920, .h = 1080 };
|
BACKGROUND_TotalRect = (SDL_Rect) {.x = 0, .y = 0, .w = 1920, .h = 1080 };
|
||||||
BACKGROUND_Textures = malloc(BACKGROUND_TextureCount * sizeof(SDL_Texture *));
|
BACKGROUND_Textures = malloc(BACKGROUND_TextureCount * sizeof(SDL_Texture *));
|
||||||
BACKGROUND_Textures[0] = IMG_LoadTexture(renderer, BG_Path_1);
|
BACKGROUND_Textures[0] = IMG_LoadTexture(renderer, BG_Path_1);
|
||||||
BACKGROUND_Textures[1] = IMG_LoadTexture(renderer, BG_Path_2);
|
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");
|
printf("Background initialized!\n");
|
||||||
BACKGROUND_IsInit = true;
|
BACKGROUND_IsInit = true;
|
||||||
} else
|
} else
|
||||||
|
BIN
bin/assets/images/bg/bg3.png
Normal file
BIN
bin/assets/images/bg/bg3.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.0 MiB |
BIN
bin/assets/images/bg/bg4.png
Normal file
BIN
bin/assets/images/bg/bg4.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 81 KiB |
@ -511,7 +511,7 @@ void BALL_Update(Ball * obj, Scenery * scenery){
|
|||||||
BLOCK_DealDamage(blocks + i, 1);
|
BLOCK_DealDamage(blocks + i, 1);
|
||||||
if (blocks[i].HP <= 0) {
|
if (blocks[i].HP <= 0) {
|
||||||
(scenery->DestroyedBlocks)++;
|
(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));
|
(obj->Location) = VECTOR_Add(oldLocation, (obj->Momentum));
|
||||||
BALL_MoveAwayFromBoundaries(obj);
|
BALL_MoveAwayFromBoundaries(obj);
|
||||||
|
@ -40,7 +40,7 @@ bool Settings_IsInit = false;
|
|||||||
bool IsLock = false;
|
bool IsLock = false;
|
||||||
|
|
||||||
void Settings_Initialize(SDL_Renderer * renderer, Scenery * scenery) {
|
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, 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, 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);
|
// 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 };
|
Circle_rect = (SDL_Rect) {.x = 1250, .y = 500, .w = 75, .h = 75 };
|
||||||
|
|
||||||
Settings_IsInit = true;
|
Settings_IsInit = true;
|
||||||
}
|
} /* Settings_Initialize */
|
||||||
|
|
||||||
void Settings_Draw(SDL_Renderer * renderer, Scenery * scenery, int * backgroundcount) {
|
void Settings_Draw(SDL_Renderer * renderer, Scenery * scenery, int * backgroundcount) {
|
||||||
double x;
|
double x;
|
||||||
|
|
||||||
if (!(Mousestate & SDL_BUTTON(SDL_BUTTON_LEFT))) {
|
if (!(Mousestate & SDL_BUTTON(SDL_BUTTON_LEFT))) {
|
||||||
IsLock = BG.IsLock = BS.IsLock = BT.IsLock = false;
|
IsLock = BG.IsLock = BS.IsLock = BT.IsLock = false;
|
||||||
} else {
|
} else {
|
||||||
@ -97,7 +98,7 @@ void Settings_Draw(SDL_Renderer * renderer, Scenery * scenery,int *backgroundcou
|
|||||||
mapping(&x, &BG);
|
mapping(&x, &BG);
|
||||||
x = round(x);
|
x = round(x);
|
||||||
*backgroundcount = x;
|
*backgroundcount = x;
|
||||||
}
|
} /* Settings_Draw */
|
||||||
|
|
||||||
void Settings_Deinitialize(){
|
void Settings_Deinitialize(){
|
||||||
if (Settings_IsInit) {
|
if (Settings_IsInit) {
|
||||||
|
Loading…
Reference in New Issue
Block a user