跳到正文

个人记录

火星降落3.2

Zilljy258约 7 分钟
原文
文章信息与版本

文章信息

发布
2022年4月7日
收录
2025年12月12日
更新
2026年11月20日
篇幅
约 7 分钟
获赞
4

版本

  1. v1当前

近日有dalao提出这个老游戏反应太灵敏,这个版本降低了灵敏度。

也去掉了密码。

操作见老版本

火星降落3.1

C++
#include<bits/stdc++.h>
#include <iostream>
#include <windows.h>
#include <cstdio>
#define KEY_DOWN(VK_NONAME) ((GetAsyncKeyState(VK_NONAME) & 0x8000) ? 1:0)
using namespace std;
int h=20,zy=0,h2=100,yin=1,cang=0,z=0,y=0,che=0,rw=0,mima,cang2=0,y2=0,rw2=0,che2=0;
double fuel=100;
void zuo();
void hh();
void hhh();
void zuo1();
void you1();
void you2();
int main(){
	cout<<"Are you ready?"<<endl;
	Sleep(1000);
	cout<<"space......"<<endl;
	while(1){
		if(KEY_DOWN(VK_SPACE)){
			break;
		}
	}
	system("CLS");
	while(h>0){
		_sleep(10);
		system("CLS");
		cout<<"high:"<<h<<endl;
		cout<<"fuel:"<<fuel<<endl;
		hhh();
		zuo();
		cout<<"/-\\ "<<endl;
		hh();
		cout<<"*--------------/-\\-____-_____/-\\--------------/-\\-__________/-\\*"<<endl;
		if(yin>=1){
			h2-=5;
	        yin=2; 
			fuel-=0.5;
		}
		else{
			yin--;
			if(yin<-10) h2-=15;
			else h2-=10;
		}
		if(h2<=0){
			h--;
			h2=100;
		}
		if(KEY_DOWN(VK_LEFT)){
			zy--;
			continue; 
		}
		if(KEY_DOWN(VK_RIGHT)){
			zy++;
			continue; 
		}
		if(KEY_DOWN(VK_SPACE)&&fuel>=1.0){
			if(yin<=0) yin=1;
			else yin=0;
			continue; 
		}
		if(fuel<=0) yin=0;
		z=zy-5;
	}
	if(yin==2&&((zy>=19&&zy<=28&&zy!=24)||(zy>=50&&zy<=58))){
		system("CLS");
		hhh();
		zuo();
		cout<<"/-\\ "<<endl;
		cout<<"*--------------/-\\-____-_____/-\\--------------/-\\-__________/-\\*"<<endl;
		cout<<"good!"<<endl;
	}
	else{
		system("CLS");
		hhh();
		zuo();
		cout<<"/-\\ "<<endl;
		cout<<"*--------------/-\\-____-_____/-\\--------------/-\\-__________/-\\*"<<endl;
		cout<<"a-ou!"<<endl;
		return 0;
	}
	_sleep(1000);
	while(1){
		system("CLS");
		hhh();
		zuo1();
		
		if(che==1){
			cout<<"o@o";
		}
		else{
			cout<<"   ";
		}
		you1();
		cout<<"/-\\ ";
		you2();
		if(che2==1){
			cout<<"o@o"<<endl;
		}
		else{
			cout<<endl;
		} 
		if(rw==0){
			cout<<"*";
		}
		else{
			cout<<"-";
		}
		cout<<"--------------/-\\-____-_____/-\\--------------/-\\-__________/-\\-";
		if(rw2==0){
			cout<<"*"<<endl;
		}
		else{
			cout<<"-"<<endl;
		}
		if(KEY_DOWN(VK_TAB)){
			cang=!cang;
			continue; 
		}
		if(KEY_DOWN(VK_BACK)&&y<=1&&cang==1&&che2==0){
			che=!che;
			continue; 
		}
		if(KEY_DOWN(VK_LEFT)&&((che==1&&z>=1)||(che2==1&&y2>=1))){
			if(che==1){
				y++;
			    z--;
			}
			else y2--;
			continue; 
		}
		if(KEY_DOWN(VK_RIGHT)&&((che==1&&y>=1)||che2==1)){
			if(che==1){
				y--;
			    z++;
			}
			else y2++;
			continue; 
		}
		if(rw==1&&che==0&&cang==0&&rw2==1&&che2==0&&cang2==0){
			break;
		}
		if(z==0&&che==1){
			rw=1;	
		}
		if(z+6+y+y2==60&&che2==1){
			rw2=1;
		}
		if(KEY_DOWN(VK_INSERT)){
			cang2=!cang2;
			continue; 
		}
		if(KEY_DOWN(VK_DELETE)&&che==0&&y2==0&&cang2==1){
			che2=!che2;
			continue; 
		}
	}
	system("CLS");
	hhh();
	zuo();
	cout<<"/-\\ "<<endl;
	cout<<"---------------/-\\-____-_____/-\\--------------/-\\-__________/-\\-"<<endl;
	cout<<"OK!"<<endl;
	_sleep(2000); 
    
	return 0;
}
void hh(){
	if(yin>=1){
		zuo();
		cout<<"\\|/"<<endl;
	} 
	else{
		cout<<endl;
	}
	for(int i=2;i<h;i++){
		cout<<endl;
	}
}
void zuo(){
	for(int i=1;i<=zy;i++){
		cout<<" ";
	}
}
void hhh(){
	for(int i=1;i<22-h;i++){
		cout<<endl;
	}
}
void zuo1(){
	for(int i=1;i<=z;i++){
		cout<<" ";
	}
}
void you1(){
	for(int i=0;i<=y;i++){
		cout<<" ";
	}
	if(cang==1){
		cout<<"_";
	}
	else{
		cout<<" ";
	}
}
void you2(){
	if(cang2==1){
		cout<<"_";
	}
	else{
		cout<<" ";
	}
	for(int i=2;i<=y2;i++){
		cout<<" ";
	}
}
原文
存档评论5 条抓取于