C++复刻MC破坏方块的动画(16×16)

(20分钟速成代码,可能有点不同之处)

原创,未经许可禁止转载!!!

有玩MC的程序猿吗?加个好友一起玩~

电脑号:Carlgood

手机号:CARLGOODDOCC

(由于博主热爱学习,所以号常年不上线……看缘分吧……)

//
//Created by Carlgood.
//
//Note:This program is written in version DEV-C++ 5.11.
# include<iostream>
# include<cmath>
# include<string>
# include<cstring>
# include<cstdio>
# include<algorithm>
# include<sstream>
# include<iomanip>
# include<vector>
# include<queue>
# include<deque>
# include<stack>
# include<stdio.h>
# include<windows.h>
# include<ctime>
# define This_program_is_written_by_Carlgood_Programming_Studio 9876543210
using namespace std;
int block[15][15];
int break_block[4][17]; 
int main()
{
	//▇由于破坏点以及粒子的出现点均为随机,可能与MC有不同之处,请谅解~ ▇
	system("cls");
	system("title Minecraft_Block_Break_Cartton  By--C.G.P.S");
	system("color 17");
	//清空数组 
	for(int i=0;i<15;i++)
	{
		for(int j=0;j<15;j++)
		{
			block[i][j]=0;
		}
	}
	for(int i=0;i<4;i++)
	{
		for(int j=0;j<17;j++)
		{
			break_block[i][j]=0;
		}
	}
	srand(time(0));
	//初始方块 
	cout<<"▇ ▇ ▇ ▇ ▇ ▇ ▇ ▇ ▇ ▇ ▇ ▇ ▇ ▇ ▇ ▇       Minecraft--Break--Block\n";
	for(int i=1;i<=14;i++)
	{
		cout<<"▇                             ▇ \n";	
	}
	cout<<"▇ ▇ ▇ ▇ ▇ ▇ ▇ ▇ ▇ ▇ ▇ ▇ ▇ ▇ ▇ ▇       \n";
	Sleep(543);
	//破坏方块过程 
	for(int i=1;i<=10;i++)
	{
		system("cls");
		cout<<"▇ ▇ ▇ ▇ ▇ ▇ ▇ ▇ ▇ ▇ ▇ ▇ ▇ ▇ ▇ ▇       Minecraft--Break--Block\n";
		int a1,b1,a2,b2,a3,b3,a4,b4,a5,b5,a6,b6,a7,b7,a8,b8;
		a1=rand()%16+1;
		a2=rand()%16+1;
		a3=rand()%16+1;
		a4=rand()%16+1;
		a5=rand()%16+1;
		a6=rand()%16+1;
		a7=rand()%16+1;
		a8=rand()%16+1;
		b1=rand()%14+1;
		b2=rand()%14+1;
		b3=rand()%14+1;
		b4=rand()%14+1;
		b5=rand()%14+1;
		b6=rand()%14+1;
		b7=rand()%14+1;
		b8=rand()%14+1;
		block[a1][b1]=1;
		block[a2][b2]=1;
		block[a3][b3]=1;
		block[a4][b4]=1;
		block[a5][b5]=1;
		block[a6][b6]=1;
		block[a7][b7]=1;
		block[a8][b8]=1;
		for(int i=1;i<=14;i++)
		{
			cout<<"▇ ";
			for(int j=1;j<=14;j++)
			{
				if(block[i][j]==1) cout<<"▇ ";
				else cout<<"  ";
			}
			cout<<"▇ \n";
		}
		cout<<"▇ ▇ ▇ ▇ ▇ ▇ ▇ ▇ ▇ ▇ ▇ ▇ ▇ ▇ ▇ ▇ \n";
		Sleep(234);
	}
	Sleep(234);
	//破坏后粒子出现 
	for(int k=1;k<=4;k++)
	{
		system("cls");
		for(int i=1;i<=13;i++) cout<<endl;
		int a1,b1,a2,b2,a3,b3;
		a1=rand()%2+1;
		a2=rand()%2+1;
		a3=rand()%2+1;
		b1=rand()%16+1;
		b2=rand()%16+1;
		b3=rand()%16+1;
		break_block[a1][b1]=1;
		break_block[a2][b2]=1;
		break_block[a3][b3]=1;
		for(int i=1;i<=2;i++)
		{
			for(int j=1;j<=16;j++)
			{
				if(break_block[i][j]==1) cout<<"▇ ";
				else cout<<"  ";
			}
			cout<<"\n";
		}
		Sleep(1);
	}
	//破坏后粒子消失 
	for(int k=1;k<=4;k++)
	{
		system("cls");
		for(int i=1;i<=13;i++) cout<<endl;
		int a1,b1,a2,b2,a3,b3,a4,b4,a5,b5,a6,b6;
		a1=rand()%2+1;
		a2=rand()%2+1;
		a3=rand()%2+1;
		a4=rand()%2+1;
		a5=rand()%2+1;
		a6=rand()%2+1;
		b1=rand()%16+1;
		b2=rand()%16+1;
		b3=rand()%16+1;
		b4=rand()%16+1;
		b5=rand()%16+1;
		b6=rand()%16+1;
		break_block[a1][b1]=0;
		break_block[a2][b2]=0;
		break_block[a3][b3]=0;
		break_block[a4][b4]=0;
		break_block[a5][b5]=0;
		break_block[a6][b6]=0;
		for(int i=1;i<=2;i++)
		{
			for(int j=1;j<=16;j++)
			{
				if(break_block[i][j]==0) cout<<"  ";
				else cout<<"▇ ";
			}
			cout<<"\n";
		}
		Sleep(234);
	}
	Sleep(234);
    //重置
	system("cls");
	Sleep(1234);
	main();
	return 0;
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值