|
楼主 |
发表于 2020-7-11 16:31:49
|
显示全部楼层
IP:江苏苏州
???源码呢???
重发一下
- #include <bits/stdc++.h>
- #include <windows.h>
- #include <conio.h>
- using namespace std;
- int key, x = 0, y = 0;
- string name;
- void load(){
- cout << "loading";
- for(int i = 0; i < 10; i++){
- Sleep(300);
- cout << ".";
- }
- }
- void move(int &x, int &y, int key){
- if(key == 65){
- x -= 3;
- if(x < 0)
- x = 0;
- }else if(key == 68){
- x += 3;
- }else if(key == 87){
- y--;
- if(y < 0)
- y = 0;
- }else if(key == 83){
- y++;
- }
- }
- void printMap(int x, int y){
- system("cls");
- for(int i = 0; i < y; i++){
- cout << endl;
- }
- for(int i = 0; i < x; i++){
- cout << ' ';
- }
- cout << name;
- }
- void getName(string &name){
- cout << "请输入你的名字" << endl;
- cin >> name;
- Sleep(300);
- }
- void flicker(){
- Sleep(50);
- for (int i = 0; i < 3; i++){
- Sleep(50);
- system("color 60");
- Sleep(50);
- system("color 06");
- }
- Sleep(100);
- system("cls");
- }
- int main(){
- system("color 06");
- getName(name);
- flicker();
- load();
-
- system("cls");
- cout << name;
- while(true){
- if (_kbhit()){
- key = _getch();
- if(key == 43)
- break;
- move(x, y, key);
- printMap(x, y);
- }
- }
- return 0;
- }
复制代码 |
评分
-
查看全部评分
|