Skip to content

Commit

Permalink
small fixes + rolling ball
Browse files Browse the repository at this point in the history
  • Loading branch information
tsupplis committed Dec 13, 2023
1 parent 9c0d355 commit ccea6c9
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 2 deletions.
39 changes: 37 additions & 2 deletions ball.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
#define BALL_WIDTH 8
#define BALL_HEIGHT 8

int ball[BALL_WIDTH*BALL_HEIGHT]= {
int seq=0;
int ball[4][BALL_WIDTH*BALL_HEIGHT]= {
{
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 1, 1, 1, 1, 0, 0,
0, 1, 2, 2, 3, 2, 1, 0,
Expand All @@ -18,6 +20,37 @@ int ball[BALL_WIDTH*BALL_HEIGHT]= {
0, 1, 2, 2, 2, 2, 1, 0,
0, 0, 1, 1, 1, 1, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0
},
{
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 1, 1, 1, 1, 0, 0,
0, 1, 2, 2, 2, 2, 1, 0,
0, 1, 2, 2, 2, 2, 1, 0,
0, 1, 2, 2, 3, 3, 1, 0,
0, 1, 2, 2, 3, 2, 1, 0,
0, 0, 1, 1, 1, 1, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0
},
{
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 1, 1, 1, 1, 0, 0,
0, 1, 2, 2, 2, 2, 1, 0,
0, 1, 2, 2, 2, 2, 1, 0,
0, 1, 3, 3, 2, 2, 1, 0,
0, 1, 2, 3, 2, 2, 1, 0,
0, 0, 1, 1, 1, 1, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0
},
{
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 1, 1, 1, 1, 0, 0,
0, 1, 2, 3, 2, 2, 1, 0,
0, 1, 3, 3, 2, 2, 1, 0,
0, 1, 2, 2, 2, 2, 1, 0,
0, 1, 2, 2, 2, 2, 1, 0,
0, 0, 1, 1, 1, 1, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0
}
};

#ifndef __STDC__
Expand All @@ -36,7 +69,7 @@ void draw_map(int x, int y, int *map, int width, int height)
int y_offset=0;
int length=width*height;
do {
gfx_pixel(x + x_offset, y + y_offset, ball[offset]);
gfx_pixel(x + x_offset, y + y_offset, ball[seq/4][offset]);
offset++;
x_offset++;
x_offset=x_offset%width;
Expand Down Expand Up @@ -106,6 +139,8 @@ void ball_demo()
else if (y <= BOX_Y+BOX_THICKNESS)
yinc = 1;
draw_map(x, y, ball, BALL_WIDTH, BALL_HEIGHT);
seq++;
if(seq>12) seq=0;
delay(1);
} while (!kbhit());
getch();
Expand Down
2 changes: 2 additions & 0 deletions conio.c
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ void scrmode(int m)
clrscr();
break;
case SCRMODE_COL80:
;
#asm
push ax
push bx
Expand All @@ -226,6 +227,7 @@ void scrmode(int m)
clrscr();
break;
case SCRMODE_COL40:
;
#asm
push ax
push bx
Expand Down

0 comments on commit ccea6c9

Please sign in to comment.