diff --git a/README.md b/README.md
new file mode 100644
index 0000000..e69de29
diff --git a/bin/Debug/blockBreaker b/bin/Debug/blockBreaker
new file mode 100755
index 0000000..2d12b1a
Binary files /dev/null and b/bin/Debug/blockBreaker differ
diff --git a/bin/Debug/cTest b/bin/Debug/cTest
new file mode 100755
index 0000000..a5f5fbb
Binary files /dev/null and b/bin/Debug/cTest differ
diff --git a/blockBreaker.cbp b/blockBreaker.cbp
new file mode 100644
index 0000000..19e944f
--- /dev/null
+++ b/blockBreaker.cbp
@@ -0,0 +1,39 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/blockBreaker.depend b/blockBreaker.depend
new file mode 100644
index 0000000..2f0e6c0
--- /dev/null
+++ b/blockBreaker.depend
@@ -0,0 +1,9 @@
+# depslib dependency file v1.0
+1729498522 source:/home/fluffy/codeBlocks/blockBreaker/main.c
+
+
+
+
+
+
+
diff --git a/blockBreaker.ino b/blockBreaker.ino
deleted file mode 100644
index cbd2ecd..0000000
--- a/blockBreaker.ino
+++ /dev/null
@@ -1,31 +0,0 @@
-#include
-#include //for screen
-#include //for screen
-#include
-#define ADC_PIN 26
-
-int adcVal = 0;
-float xLocation = 0;
-
-//screen setup
-U8G2_SH1106_128X64_NONAME_F_4W_HW_SPI u8g2(U8G2_R2, 17, 20, 21);
-//uint8_t *buf;
-char outString[99];
-
-void setup() {
- //setup screen
- u8g2.begin();
- u8g2.setFont(u8g2_font_ncenB14_tr);
- //setup ADC
- analogReadResolution(10);
- digitalWriteFast(23, 1);
-}
-
-void loop() {
- adcVal = analogRead(ADC_PIN);
- xLocation = (((float)adcVal/1024)*100);
- u8g2.clearBuffer();
- sprintf(outString, "helloworld");
- u8g2.drawStr(xLocation, 35, outString);
- u8g2.sendBuffer();
-}
diff --git a/blockBreaker.layout b/blockBreaker.layout
new file mode 100644
index 0000000..7b92b03
--- /dev/null
+++ b/blockBreaker.layout
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/main.c b/main.c
new file mode 100644
index 0000000..d91a53e
--- /dev/null
+++ b/main.c
@@ -0,0 +1,224 @@
+#include
+#include
+#include
+#include
+#include
+#include
+#define SCREEN_WIDTH 11 //set the width of the game screen
+#define SCREEN_HEIGHT 20 //set the height of the game screen
+#define PADDLE_SIZE 2 //set the paddle size. the blocks are added this amount either size of a central block.
+#define SLEEP_TIME_MS 100 * 1000 //set the time to sleep between frames
+#define PADDLE_HEIGHT SCREEN_HEIGHT-4 //the negative number is distance from the bottom
+#define Y_BLOCK_LAYERS 10 //add the amount of layers of blocks from the top of the screen
+#define X_BLOCK_LAYERS SCREEN_WIDTH
+
+uint8_t screen[SCREEN_WIDTH][SCREEN_HEIGHT]; //this is the array the game lives in
+int moveArr[] = {-2,-1,0,1,2};
+
+enum PIXEL_TYPE { //used to set what kind of pixel is shown on the screen array
+ PIXEL_EMPTY=0u,
+ PIXEL_BALL=1u,
+ PIXEL_BLOCK=2u,
+ PIXEL_PADDLE_MIDDLE=3u,
+ PIXEL_PADDLE_LEFT=4u,
+ PIXEL_PADDLE_RIGHT=5u
+} PIXEL_TYPE;
+
+void clearScreen() { //clears the screen of all pixels to redraw the screen
+ for (int y = 0; y < SCREEN_HEIGHT; y++) {
+ for (int x=0; xlocation-Paddle->paddleSize+dir<=0) return false;
+ Paddle->location = Paddle->location+dir;
+ return true;
+ } else if (dir>=0) {
+ if (Paddle->location+Paddle->paddleSize+dir>= SCREEN_WIDTH-1) return false;
+ Paddle->location= Paddle->location+dir;
+ return true;
+ }
+}
+
+int main() {
+ Ball_t ball = {.xPOS=0,.yPOS=0,.xVEL=0,.yVEL=0}; //setup game ball
+ Paddle_t paddle= {.location=(SCREEN_WIDTH/2),.paddleSize=PADDLE_SIZE};
+ time_t UNIXTIME = time(NULL); //create UNIXTIME struct
+ srand(UNIXTIME); //seed random number with time at run time
+ Block_t blockArr[X_BLOCK_LAYERS][Y_BLOCK_LAYERS];
+ bool blockFlushHit = false; //used to show if the ball has hit a block vertically or horizontally
+
+ //init blockArr array
+ for (int x=0; x< X_BLOCK_LAYERS; x++) {
+ for (int y=0; y");
+ } else if(screen[x][y]==PIXEL_PADDLE_MIDDLE) {
+ printf("==");
+ } else if(screen[x][y]==PIXEL_PADDLE_LEFT){
+ printf("<=");
+ } else if(screen[x][y]==PIXEL_PADDLE_RIGHT){
+ printf("=>");
+ }
+ }
+ printf("|\n");
+ }
+ for (int x =0; x<=SCREEN_WIDTH; x++) {
+ printf("--");
+ }
+ printf("\n");
+
+ //detect when ball hits the edge of the screen
+ if (ball.xPOS==0||ball.xPOS==(SCREEN_WIDTH-1)) {
+ ball.xVEL=ball.xVEL*-1;
+ }
+ if (ball.yPOS==0||ball.yPOS==(SCREEN_HEIGHT-1)) {
+ ball.yVEL=ball.yVEL*-1;
+ }
+ //detect when ball hits a block
+ if (screen[ball.xPOS+ball.xVEL][ball.yPOS]==PIXEL_BLOCK) {
+ blockArr[ball.xPOS+ball.xVEL][ball.yPOS].visable=false;
+ ball.xVEL = ball.xVEL *-1;
+ blockFlushHit=true;
+ }
+ if (screen[ball.xPOS][ball.yPOS+ball.yVEL]==PIXEL_BLOCK) {
+ blockArr[ball.xPOS][ball.yPOS+ball.yVEL].visable=false;
+ ball.yVEL = ball.yVEL *-1;
+ blockFlushHit=true;
+ }
+ if (screen[ball.xPOS+ball.xVEL][ball.yPOS+ball.yVEL]==PIXEL_BLOCK&&blockFlushHit==false) {
+ blockArr[ball.xPOS+ball.xVEL][ball.yPOS+ball.yVEL].visable=false;
+ if(ballOnXEdge(ball)==false) {
+ ball.xVEL = ball.xVEL *-1;
+ }
+ if (ball.yPOS!=0) {
+ ball.yVEL=ball.yVEL *-1;
+ }
+ }
+
+ //detect when ball hits paddle
+ if(screen[ball.xPOS+ball.xVEL][ball.yPOS]==PIXEL_PADDLE_MIDDLE) {
+ ball.xVEL = ball.xVEL *-1;
+ }
+ if (screen[ball.xPOS][ball.yPOS+ball.yVEL]== PIXEL_PADDLE_MIDDLE) { //hit detection y direction
+ ball.yVEL= ball.yVEL*-1;
+ }
+ if (screen[ball.xPOS+ball.xVEL][ball.yPOS+ball.yVEL]==PIXEL_PADDLE_MIDDLE) { //diagonal hit detection
+ ball.xVEL = ball.xVEL *-1;
+ ball.yVEL=ball.yVEL *-1;
+ }
+ //paddle left
+ if (screen[ball.xPOS+ball.xVEL][ball.yPOS+ball.yVEL]==PIXEL_PADDLE_LEFT) { //diagonal hit detection
+ if(ball.xVEL==-1){
+ ball.xVEL=-1;
+ } else if (ball.xVEL==0){
+ ball.xVEL=-1;
+ } else {
+ ball.xVEL=-1;
+ }
+ ball.yVEL=ball.yVEL *-1;
+ }
+
+ //paddle right
+ if (screen[ball.xPOS+ball.xVEL][ball.yPOS+ball.yVEL]==PIXEL_PADDLE_RIGHT) { //diagonal hit detection
+ if (ball.xVEL==-1){ //moving left
+ ball.xVEL=1;
+ } else if (ball.xVEL==0){ //moving straight down
+ ball.xVEL=1;
+ } else { //moving right
+ ball.xVEL=1;
+ }
+ ball.yVEL=ball.yVEL *-1;
+ }
+
+
+ //update ball position
+ ball.xPOS=ball.xPOS+ball.xVEL;
+ ball.yPOS= ball.yPOS+ball.yVEL;
+
+
+ //move paddle
+ movePaddle(&paddle,moveArr[rand()%6]);
+
+ }
+}
diff --git a/obj/Debug/main.o b/obj/Debug/main.o
new file mode 100644
index 0000000..7b82947
Binary files /dev/null and b/obj/Debug/main.o differ