added blocks

This commit is contained in:
Seth Samuel 2024-10-11 17:44:29 +13:00
parent e76901b567
commit 0405287481
4 changed files with 11 additions and 3 deletions

Binary file not shown.

View file

@ -4,7 +4,7 @@
<ActiveTarget name="Debug" />
<File name="main.c" open="1" top="1" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1370" topLine="86" />
<Cursor1 position="1467" topLine="50" />
</Cursor>
</File>
</CodeBlocks_layout_file>

12
main.c
View file

@ -55,7 +55,7 @@ int main() {
//struct ballStruct ball;
time_t UNIXTIME = time(NULL);
srand(UNIXTIME); //seed random number with time at run time
int noXBlocks = SCREEN_WIDTH /2;
int noXBlocks = SCREEN_WIDTH;
Block_t blockArr[noXBlocks][Y_BLOCK_LAYERS];
for (int x=0;x< noXBlocks;x++) {
for (int y=0; y<Y_BLOCK_LAYERS; y++){
@ -73,7 +73,13 @@ int main() {
clearScreen();
//draw blocks
for (int x = 0;x<noXBlocks;x++){
for (int y =0;y<Y_BLOCK_LAYERS;y++){
if(blockArr[x][y].visable==true){
screen[x][y]=PIXEL_BLOCK;
}
}
}
//draw paddel
screen[paddle.location][PADDLE_HEIGHT]=PIXEL_PADDLE;
@ -98,6 +104,8 @@ int main() {
printf("<>");
} else if(screen[x][y]==PIXEL_PADDLE) {
printf("==");
} else if(screen[x][y]==PIXEL_BLOCK){
printf("[]");
}
}
printf("|\n");

Binary file not shown.