-
大小: 286KB文件类型: .rar金币: 2下载: 0 次发布日期: 2021-06-07
- 语言: 其他
- 标签: 控制台 游戏 flappybird piexlbird
资源简介
基于控制台绘图的小游戏,仿造曾经很火的flappybird,回调函数处理消息,比较简单缺乏注释,有计分和游戏状态判定机制,,缺乏文字描述,按f开始游戏,空格控制鸟跳跃,p暂停游戏

代码片段和文件信息
/*
Author: ATP
Date:2015-10-16
*/
#include “StdAfx.h“
#include “Bird.h“
Bird::Bird(void)
{
g=2.5;
vx=0.0;
vy=0.0;
x=CONSOLEX /2.0;
y=CONSOLEY/2.0;
upa = -12.0;
memset(birddot0sizeof(birddot));
birddot[0][0][1]=1;
birddot[0][1][2]=1;
birddot[0][2][0]=1;birddot[0][2][1]=1;birddot[0][2][2]=1;birddot[0][2][3]=1;birddot[0][2][4]=1;
birddot[0][3][2]=1;
birddot[0][4][1]=1;
birddot[1][1][1]=1;birddot[1][1][2]=1;
birddot[1][2][0]=1;birddot[1][2][1]=1;birddot[1][2][2]=1;birddot[1][2][3]=1;birddot[1][2][4]=1;
birddot[1][3][1]=1;birddot[1][3][2]=1;
birdstate = 0;
}
Bird::~Bird(void)
{
}
void Bird::jump(){
vy = upa;
}
void Bird::move(){
vy += g;
y += vy;
}
void Bird::drawBD(){
HWND hwnd=GetForegroundWindow(); //找到程序运行窗口的句柄
HDC hDC = GetDC((HWND)hwnd);//通过窗口句柄得到该窗口的设备场境句柄
HPEN hPen; //画笔
HBRUSH hBrush;
/*
hPen = CreatePen(PS_SOLID 0 0xffffff);
hBrush = CreateSolidBrush(RGB(000));
HPEN oldPen = (HPEN)Selectobject(hDC hPen);
HBRUSH oldBrush = (HBRUSH)Selectobject(hDC hBrush);
Rectangle(hDC00CONSOLEXCONSOLEY);
hPen = (HPEN)Selectobject(hDC oldPen);
hBrush = (HBRUSH)Selectobject(hDC oldBrush);
*/
hPen = CreatePen(PS_SOLID 0 0x000000);
hBrush = CreateSolidBrush(RGB(00 255));
HPEN oldPen = (HPEN)Selectobject(hDC hPen);
HBRUSH oldBrush = (HBRUSH)Selectobject(hDC hBrush);
int ij;
for (i = 0; i < 5; i++){
for(j = 0; j < 5; j++){
if(birddot[birdstate][i][j] > 0){
Rectangle(hDC x+5*jy+5*ix+5*j+5y+5*i+5);
}
}
}
hPen = (HPEN)Selectobject(hDC oldPen);
hBrush = (HBRUSH)Selectobject(hDC oldBrush);
Deleteobject(hPen);
Deleteobject(hBrush);
Deleteobject(oldPen);
Deleteobject(oldBrush);
ReleaseDC(hwnd hDC);
}
void Bird::changeBdSt(){
birdstate = 1-birdstate;
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
I.A.... 106496 2015-10-25 11:42 pixelBird\Debug\pixelBird.exe
I.A.... 478500 2015-10-25 11:42 pixelBird\Debug\pixelBird.ilk
I.A.... 1018880 2015-10-25 11:42 pixelBird\Debug\pixelBird.pdb
I.A.... 1868 2017-07-13 12:50 pixelBird\pixelBird\Bird.cpp
I.A.... 323 2017-07-13 12:50 pixelBird\pixelBird\Bird.h
I.A.... 1200 2017-07-13 12:50 pixelBird\pixelBird\Column.cpp
I.A.... 341 2017-07-13 12:50 pixelBird\pixelBird\Column.h
I.A.... 4452 2017-07-13 12:50 pixelBird\pixelBird\Game.cpp
I.A.... 306 2017-07-13 12:51 pixelBird\pixelBird\Game.h
I.A.... 5897 2017-07-13 12:51 pixelBird\pixelBird\pixelBird.cpp
I.A.... 138 2017-07-13 12:51 pixelBird\pixelBird\pixelBird.h
I.A.... 23558 2009-08-31 02:31 pixelBird\pixelBird\pixelBird.ico
I.A.... 6562 2015-09-23 12:10 pixelBird\pixelBird\pixelBird.rc
I.A.... 4828 2015-10-16 19:43 pixelBird\pixelBird\pixelBird.vcxproj
I.A.... 2326 2015-10-16 19:43 pixelBird\pixelBird\pixelBird.vcxproj.filters
I.A.... 143 2015-09-23 12:10 pixelBird\pixelBird\pixelBird.vcxproj.user
I.A.... 2355 2015-09-23 12:10 pixelBird\pixelBird\ReadMe.txt
I.A.... 728 2015-09-23 12:10 pixelBird\pixelBird\Resource.h
I.A.... 23558 2009-08-31 02:31 pixelBird\pixelBird\small.ico
I.A.... 214 2015-09-23 12:10 pixelBird\pixelBird\stdafx.cpp
I.A.... 420 2015-09-23 12:10 pixelBird\pixelBird\stdafx.h
I.A.... 236 2015-09-23 12:10 pixelBird\pixelBird\targetver.h
I.A.... 894 2015-09-23 12:10 pixelBird\pixelBird.sln
I.A..H. 23552 2015-10-25 11:47 pixelBird\pixelBird.suo
I.A.... 46 2017-07-13 12:58 pixelBird\控制说明.txt
I..D... 0 2015-10-30 18:53 pixelBird\Debug
I..D... 0 2015-11-08 22:58 pixelBird\pixelBird
I..D... 0 2017-07-13 12:58 pixelBird
----------- --------- ---------- ----- ----
1707821 28
............此处省略1个文件信息
- 上一篇:BMP180气压模块资料源码
- 下一篇:在线系统需求规格说明文档
相关资源
- flash3.0小游戏
- Scrach 欢乐狙击手.sb2
- linux应用层的华容道游戏源代码
- 小鸡快跑游戏.
- ply格式文件的读写程序
- [易语言]游戏多开例程
- 贪吃蛇游戏设计(汇编语言)
- VC 游戏编程—附源代码
- C 纸牌游戏——21点
- 分享 mud 文字游戏 源码
- c 制作的RPG小游戏
- 五子棋游戏实现悔棋功能
- 学生成绩管理系统C 源码(很完整)
- 找不同FLASH游戏源码
- planeGame飞机游戏
- 拼图游戏源代码 powerbuilder 9.0实例
- 解决WPE进不了游戏的最佳方法(闭屏
- linux扫雷游戏代码
- 多线程实例:桌面智能弹球小游戏
- “猜数字”游戏 算法破解
- OpenGL-3D坦克模拟
- 联机版井字棋源码
- 拼图游戏(可自由选择难度)
- 扫雷(MVC架构)
- 解封SHOW 51VV 9158 封机器码类游戏机
- scratch穿越迷宫.sb2
- 小鱼捉迷藏Scratch小游戏
- GlowtoolsA-wdf网易游戏wdf查看及解包
- 游戏音频图像提取工具GARbro
- OPENGL实现世界上最小的3D游戏
评论
共有 条评论