Konsolen "Film"
-
Hey, ich habe den code noch einmal überarbeitet.
Vll gefällt einem von euch der Code, und es hilft ihm.
wer vll eine bessere variante oder tipps hat darf sie posten, würde mich freun.Quellcode:
#include <iostream> #include <Windows.h> #include <conio.h> using namespace std; void gotoxy(int x,int y) { COORD pos={x,y}; SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),pos); } int Border() { gotoxy(0,0); cout<<(char)201; //Linksoben gotoxy(79,0); cout<<(char)187; //Linksunten gotoxy(0,24); cout<<(char)200; //rechtsoben gotoxy(79,24); cout<<(char)188; //rechtsunten for(int a= 1; a<=78; ++a) //für X { for(int b=1; b<=23;++b) //für Y { gotoxy(a,0); cout<<(char)205; gotoxy(a,24); cout<<(char)205; gotoxy(0,b); cout<<(char)186; gotoxy(79,b); cout<<(char)186; } } return(0); } int Heart() { gotoxy(60,5); cout<< "Life:"<<(char)003<<(char)003<<(char)003; return(0); } int Floor() { for(int a= 1; a<=78; ++a) { gotoxy(a,21); cout<<(char)205; } return(0); } int charrun() { for(int c= 1; c<=30; ++c) { gotoxy(c,20); cout<< (char)001; Sleep(100); gotoxy(c,20); cout<< " "; } gotoxy(31,20); cout<<(char)001; gotoxy(31,20); cout<<" "; return(0); } int charjumphigh() { for(int d=30;d<=33;++d) { for(int e=3;e<=1;--e) { gotoxy(d,(20-e)); cout<< (char)001; Sleep(100); gotoxy(d,(20-e)); cout<< " "; } } for(int f=1; f<=3; ++f) { for(int g=33;g<=34;++g) { gotoxy(g,(17+f)); cout<< (char)001; Sleep(100); gotoxy(g,(17+f)); cout<< " "; } } gotoxy(34,20); cout<< (char)001; gotoxy(60,5); cout<< "Life:"<<(char)003<<(char)003<<(char)003<<(char)003; return(0); } int charrunagain() { for(int c= 34; c<=70; ++c) { gotoxy(c,20); cout<< (char)001; Sleep(100); gotoxy(c,20); cout<< " "; } gotoxy(70,20); cout<<(char)001; gotoxy(70,20); cout<<" "; gotoxy(70,20); cout<<(char)001; return(0); } int LiveHeart() { gotoxy(33,18); cout << (char)003; return(0); } int main() { Border(); Floor(); Heart(); LiveHeart(); charrun(); charjumphigh(); charrunagain(); getch(); return (0); }
neuster Quellcode
#include <iostream> #include <Windows.h> #include <conio.h> using namespace std; void gotoxy(int x,int y) { COORD pos={x,y}; SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),pos); } int Border() { gotoxy(0,0); cout<<(char)201; //Linksoben gotoxy(79,0); cout<<(char)187; //Linksunten gotoxy(0,24); cout<<(char)200; //rechtsoben gotoxy(79,24); cout<<(char)188; //rechtsunten for(int a= 1; a<=78; ++a) //für X { for(int b=1; b<=23;++b) //für Y { gotoxy(a,0); cout<<(char)205; gotoxy(a,24); cout<<(char)205; gotoxy(0,b); cout<<(char)186; gotoxy(79,b); cout<<(char)186; } } return(0); } int Heart() { gotoxy(60,5); cout<< "Life:"<<(char)003<<(char)003<<(char)003; return(0); } int Floor() { for(int a= 1; a<=70; ++a) { gotoxy(a,21); cout<<(char)205; } for(int b=75; b<=78; ++b) { gotoxy(b,21); cout<<(char)205; } return(0); } int charrun() { for(int c= 1; c<=30; ++c) { gotoxy(c,20); cout<< (char)001; Sleep(100); gotoxy(c,20); cout<< " "; } gotoxy(31,20); cout<<(char)001; gotoxy(31,20); cout<<" "; return(0); } int charjumphigh() { for(int d=30;d<=33;++d) { for(int e=3;e<=1;--e) { gotoxy(d,(20-e)); cout<< (char)001; Sleep(100); gotoxy(d,(20-e)); cout<< " "; } } for(int f=1; f<=3; ++f) { for(int g=33;g<=34;++g) { gotoxy(g,(17+f)); cout<< (char)001; Sleep(100); gotoxy(g,(17+f)); cout<< " "; } } gotoxy(34,20); cout<< (char)001; gotoxy(60,5); cout<< "Life:"<<(char)003<<(char)003<<(char)003<<(char)003; return(0); } int charrunagain() { for(int c= 34; c<=70; ++c) { gotoxy(c,20); cout<< (char)001; Sleep(100); gotoxy(c,20); cout<< " "; } gotoxy(70,20); cout<<(char)001; gotoxy(70,20); cout<<" "; return(0); } int charfall() { for(int a=1; a<=3; ++a) { gotoxy(72,20+a); cout<<(char)001; Sleep(100); gotoxy(72,20+a); cout<<" "; } return(0); } int LiveHeart() { gotoxy(33,18); cout << (char)003; return(0); } int KillFloor() { for(int a= 1; a<=70; ++a) { gotoxy(a,21); cout<<" "; } for(int b=75; b<=78; ++b) { gotoxy(b,21); cout<<" "; } return(0); } int LiftFloor() { gotoxy(72,23); cout<<(char)001; for(int c=1; c<=20; ++c) { for(int a= 1; a<=70; ++a) { for(int b=75; b<=77; ++b) { gotoxy(a,21-c); cout<<(char)205; gotoxy(b,21-c); cout<<(char)205; } } gotoxy(2,21-c); cout<<" "; for(int d=2; d<=22;++d) //für Y { gotoxy(0,d); cout<<(char)186; gotoxy(79,d); cout<<(char)186; gotoxy(60,5); cout<< "Life:"<<(char)003<<(char)003<<(char)003<<(char)003; } } for(int h = 0; h<=6;++h) //charac nach oben { gotoxy(72,(23-h)); cout<<" "; gotoxy(72,(23-h)); cout<<(char)001; Sleep(100); gotoxy(72,(23-h)); cout<<" "; for(int i = 66; i<=76; ++i) { gotoxy(i, 23-h+1); cout<<(char)205; } } for(int a= 1; a<=78; ++a) //zum schluss angezeigt { gotoxy(a,1); cout<<(char)205; gotoxy(79,1); cout<<(char)186; gotoxy(72,(17)); cout<<(char)001; } for(int n = 1; n<=1; ++n) { gotoxy(60,5); cout<< "Life:"<<(char)003<<(char)003<<(char)003<<(char)003; Sleep(350); gotoxy(60,5); cout<< "Life:"<<(char)003<<(char)003<<(char)003<<" "; Sleep(350); gotoxy(60,5); cout<< "Life:"<<(char)003<<(char)003<<" "; Sleep(350); gotoxy(60,5); cout<< "Life:"<<(char)003<<" "; Sleep(350); } gotoxy(60,5); cout<< "Life:"<<"----"; Sleep(500); gotoxy(72,(17)); cout<<" "; gotoxy(67,(17)); cout<<"Game Over"; return(0); } int main() { Border(); Floor(); Heart(); LiveHeart(); charrun(); charjumphigh(); charrunagain(); charfall(); KillFloor(); LiftFloor(); getch(); return (0); }
und das war wohl nun auch die entgülrige version des codes war genug arbeit