Advertisement
Guest User

dfsfs

a guest
Sep 17th, 2014
222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. #include <iostream> //pr2_4 mon
  2. #include <conio.h>
  3. #include <stdio.h>
  4. #include <stdlib.h>
  5. #include <console.h>
  6. #include <time.h>
  7.  
  8. ///////////////////////////////////
  9. int gameactive=1;
  10.  
  11.  
  12.  
  13. void HandleInput(){
  14. int key;
  15. key=0;
  16. if (kbhit()) key=getch();
  17. //if (key==KEY_UP) playery--;
  18. if (key==KEY_ESCAPE) gameactive = 0; //voorwaarde;
  19. }
  20.  
  21. int x, y, speedx, speedy;
  22.  
  23. int main() {
  24. x=20;y=10;
  25. gotoxy(x,y);
  26. printf("%c",219);
  27. speedx=1;speedy=1;
  28. do {
  29. clrscr();
  30. x=x+speedx;y=y+speedy;
  31. gotoxy(x,y);
  32. if (x> 78) speedx=-speedx;
  33. if (x<2) speedx=-speedx;
  34. printf("%c",219);
  35. delay(40);
  36.  
  37. HandleInput();
  38. }while (gameactive==1);
  39.  
  40. getch();
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement