Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <windows.h>
- #define A #define
- #define S(X,Y,C,A){b[Y][X][0]=C;b[Y][X][1]=A;}
- #define D(K)GetAsyncKeyState(K)&(1<<16)
- #define W while
- #define R int
- void* h;
- short b[70][90][2];
- R x, y, a, Z=37, V, B, L=0, E, G, e[15], K, k, X, Y, j, U, I;
- INT64 s[3]={0x42247E5AFFBDA542,0x183C7EDBFF245AA5,0x2418BDDBBD99C300};
- void d(R N, R M, INT64 g,R o=0) {
- W(g) {
- y=8;
- W(y--) {
- if(!o||g&1)S(N,M,g&1?219:32,a);
- N++;
- g>>=1;
- }
- N -= 8;
- M--;
- }
- }
- void t(R N, R M, char* T) {
- W(*T) {
- S(N, M, *T, a);
- N++;
- T++;
- }
- }
- void m() {
- SMALL_RECT r{0, 0, 90, 70};
- WriteConsoleOutput(h, (const CHAR_INFO*)&b, COORD{90, 70}, COORD(), &r);
- }
- R main() {
- h = GetStdHandle(-11);
- // Reset
- r:
- E=G=B=K=0;
- ZeroMemory(&e,60);
- W(1) {
- // ClearScreen
- x=6300;
- W(x--)
- S(x, 0, 0, 0);
- // HandleInput
- Z+=D(65)?-1:D(68)?1:0;
- Z = Z < 0 ? 0 : Z > 80 ? 80 : Z;
- W(D(32) && !B) {
- Beep(500, 30);
- V = Z + 2;
- B = 62;
- }
- !B?V=-1:B--;
- //if(!B)
- // V=-1;
- //else
- // B--;
- // DrawPlayer
- a = 10;
- d(Z, 65, 0x40E1F);
- if(B>=0)
- S(V, B, 64, 13);
- G++%2?E++:0;
- // DrawEnemies
- //if(G++ % 2)
- // E++;
- k=E/13,j=E%13;
- X = k % 2 ? (13 - j) : j;
- x=15;
- W(x--) {
- if(!e[x]) {
- a = x%2+14-L;
- U = X + x%5 * 16, I = k + 8 + x/5 * 10;
- d(U, I, s[(L+(a&1))%3]);
- if(V>U&&V<U+8&&B>I-8&&B<I) {
- e[x] = 1;
- B=0;
- if(++K==15) {
- // Win
- x=6300;
- W(x--)
- S(x, 0, 219, (x&(L+1)*4%15));
- a = 14;
- x=2;W(x--)d(35+x*5,35,0xE010D090E0,1);
- char h[7]="Lvl: ";
- h[5] =++L+48;
- t(40, 37, &h[0]);
- m();
- x=6;
- W(x--)
- Beep(x&1?200:300, 300);
- goto r;
- }
- }
- if(I > 62) {
- x=4;
- W(x--)
- Beep(210+x*10, x?300:1000);
- L=0;
- goto r;
- }
- }
- }
- if(L==0) {
- d(15,15,0xFFBD7E3C18183C);
- }
- m();
- Sleep(40-L*4);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment