使用C语言+EasyX完成消灭星星游戏(3)

使用C语言+EasyX完成消灭星星游戏(3)

本篇介绍方块消除后,方块下落移动。

在这里插入图片描述

在这里插入图片描述

#include<stdio.h>
#include<graphics.h>
#include<time.h>
#include <conio.h>
#include <mmsystem.h>
#pragma comment(lib,"Winmm.lib")
#pragma warning(disable:4996)
#define N 40
IMAGE bgImage;//游戏页面背景图片
IMAGE RegbgImage;//注册页面背景图片
IMAGE nowImage;  //当前
MOUSEMSG m;    //鼠标 
COLORREF colorArr[6] = {
    RGB(200, 0, 0), RGB(0, 200, 0),
   RGB(0, 200, 200), RGB(200, 0, 200),RGB(200,200,0) };//颜色池
typedef struct position
{
   
 int x;
 int y;
}posType;          //位置信息
posType mou;    //鼠标位置结构体
posType sameArr[100];   //同色方块坐标
int index = 0;    //同色方块个数
void game(void);    //初始化游戏界面
void playgame(void);   //游戏玩法
void getsameclolr(posType, COLORREF);//获取同颜色的方块
int isValid(posType, COLORREF);   //判断方块附近颜色是否一样
void rectanglefall(void);         //方块下落移动
int main() {
   
 initgraph(700, 700);//初始化窗口
 game();
 playgame();
 system("pause");
 return 0;
}
void game() {
   
 loadimage(&bgImage, "../Project2/bg2.2.jpg", 700, 700);//取背景图
 putimage(0, 0, &bgImage);//放置背景图
 setfillcolor(RGB(0, 0, 0));
 fillrectangle(150, 0, 550, 700);//黑色背景
 settextstyle(15, 0, _T(""));
 settextcolor(RGB(255, 255, 255));
 outtextxy(10, 10, "hello,");
 srand
  • 1
    点赞
  • 14
    收藏
    觉得还不错? 一键收藏
  • 3
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值