Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream> //pr2_4 mon
- #include <conio.h>
- #include <stdio.h>
- #include <stdlib.h>
- #include <console.h>
- #include <time.h>
- ///////////////////////////////////
- int gameactive=1;
- void HandleInput(){
- int key;
- key=0;
- if (kbhit()) key=getch();
- //if (key==KEY_UP) playery--;
- if (key==KEY_ESCAPE) gameactive = 0; //voorwaarde;
- }
- int x, y, speedx, speedy;
- int main() {
- x=20;y=10;
- gotoxy(x,y);
- printf("%c",219);
- speedx=1;speedy=1;
- do {
- clrscr();
- x=x+speedx;y=y+speedy;
- gotoxy(x,y);
- if (x> 78) speedx=-speedx;
- if (x<2) speedx=-speedx;
- printf("%c",219);
- delay(40);
- HandleInput();
- }while (gameactive==1);
- getch();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement