用c++编写俄罗斯方块

本文介绍了使用C++编程语言实现经典游戏俄罗斯方块的过程,包括游戏规则、方块生成、下落、旋转、消除行等核心功能。
摘要由CSDN通过智能技术生成
#pragma warning(disable:4996)//sprintf出错加这句
#include<iostream>
#include<string>
#include<stdio.h>
#include <time.h> 
#include <windows.h>
#include <Windows.h> 
#include <thread> 
#include <stdlib.h>
#include <conio.h>  
#include<cstdio>
#include<cstdlib>

#define XX 20
#define YY 30
#define KEY_DOWN(vk_c) (GetAsyncKeyState(vk_c)&0x8000?1:0)
using namespace std;
char p[31][20][2];
int spin = 1;
int MX = 0, MY = -4;
int FX = MX, FY = MY;
int Time = 500;
HANDLE hOutput, hOutBuf;
COORD coord = {
    0,0 };

DWORD bytes = 0;
int Gdata = 0;
int weizhi = 0;
int Down = 0;
int Gp = 0;
int Clear = 0;
int FIX[5], FIY[5];
int fen = 0;
char  o[3] = "▇";
char  k[3] = "  "; char  b[3] = "◆";
char control = 0;
int F1[4][4] = {
    {
    0,1,0,0 },{
    0,1,0,0 },{
    0,1,0,0 },{
    0,1,0,0 } },
F2[4][4] = {
    {
    0,0,0,0 },{
    1,1,1,1 },{
    0,0,0,0 },{
    0,0,0,0 } },
F3[4][4] = {
    {
    0,1,1,0 },{
    0,1,1,0 },{
    0,0,0,0 },{
    0,0,0,0 } },
F4[4][4] = {
    {
    0,1,0,0 },{
    0,1,1,0 },{
    0,0,1,0 },{
    0,0,0,0 } },
F5[4][4] = {
    {
    0,0,1,0 },{
    0,1,1,0 },{
    0,1,0,0 },{
    0,0,0,0 } },
F6[4][4] = {
    {
    0,0,0,0 },{
    1,0,0,0 },{
    1,1,1,0 },{
    0,0,0,0 } },
F7[4][4] = {
    {
    0,0,0,0 },{
    0,0,0,1 },{
    0,1,1,1 },{
    0,0,0,0 } },
F8[4][4] = {
    {
    0,0,0,0 },{
    0,1,0,0 },{
    1,1,1,0 },{
    0,0,0,0 } };
int FF[4][4];
void GW(int x, int y)
{
   
	if (weizhi == 0)
	{
   
		weizhi = 1;
		FX = x; FY = y;
		weizhi = 0;
	}
}
void dayin()
{
   
	for (int y = 0; y < 30; y++)
	{
   
		for (int x = 0; x < 20; x++)
		{
   
			if (y == 0 || y == 29)
			{
   
				for (int z = 0; z < 2; z++)
				{
   
					p[y][x][z] = o[z];
				}
			}

			else
			
评论 8
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

键盘小王子

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值