• 大小: 10.92MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-10-07
  • 语言: 其他
  • 标签: MFC  2D游戏  

资源简介

自制的Flappy Bird,比较简单,有源码,适合新手看看

资源截图

代码片段和文件信息


#include “stdafx.h“
#include “Bird.h“

CBird::CBird()
{
m_shang.Load(“.\\img\\birdprev.png“);
m_zhong.Load(“.\\img\\birdmiddle.png“);
m_xia.Load(“.\\img\\birdbext.png“);
}
CBird::~CBird()
{
m_shang.Destroy();
m_zhong.Destroy();
m_xia.Destroy();
}
void CBird::Init(CRect destRect)

Current_frame=1;
Yspeed=0; //速度
m_destRect=destRect;
}
void CBird::Add()
{
Current_frame++;
if (Current_frame>=4) Current_frame=1;
}
void CBird::SetSpeed(int speed)
{
Yspeed=speed;
if (speed<0) Current_Meter=0;
}
void CBird::Move()
{   
Current_Meter++;
m_destRect.top+=Yspeed;
m_destRect.SetRect(m_destRect.leftm_destRect.topm_destRect.left+45m_destRect.top+45);
if (Yspeed>=0) Yspeed++;
}
BOOL CBird::IsCrash(CRect tmpShangCRect tmpXia)
{
CPoint pt1(m_destRect.leftm_destRect.top);
CPoint pt2(pt1.x+45pt1.y);
CPoint pt3(pt1.xpt1.y+30);
CPoint pt4(pt1.x+45pt1.y+30);
//顶部的判断
if (pt1.y<0) return TRUE;
//地面的判断
if (pt4.y>=(Height-90)) return TRUE;
if (PtInRect(tmpShangpt1)||PtInRect(tmpShangpt2)||PtInRect(tmpShangpt3)||PtInRect(tmpShangpt4)||PtInRect(tmpXiapt1)||PtInRect(tmpXiapt2)||PtInRect(tmpXiapt3)||PtInRect(tmpXiapt4))
return TRUE;
return FALSE;
}
BOOL CBird::IsPass(int Xint Y)
{   
if (m_destRect.left>=X&&Y>30)
return TRUE;
return FALSE;
}
BOOL CBird::PanDuan()
{
if (Current_Meter<=10) return TRUE;
return FALSE;
}
void CBird::BitBlt(CDC *pDC)
{
switch(Current_frame)
{
case 1: m_shang.TransparentBlt(pDC->m_hDCm_destRectRGB(255255255)); break;
case 2: m_zhong.TransparentBlt(pDC->m_hDCm_destRectRGB(255255255)); break;
case 3: m_xia.TransparentBlt(pDC->m_hDCm_destRectRGB(255255255)); break;
}
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       6221  2014-02-27 17:26  FlappyBirdFirst\FlappyBirdFirst\FlappyBirdFirst.vcxproj

     文件        143  2014-02-25 17:07  FlappyBirdFirst\FlappyBirdFirst\FlappyBirdFirst.vcxproj.user

     文件       2570  2014-02-27 17:26  FlappyBirdFirst\FlappyBirdFirst\FlappyBirdFirst.vcxproj.filters

     文件       3293  2014-02-25 17:07  FlappyBirdFirst\FlappyBirdFirst\ReadMe.txt

     文件        496  2014-02-25 17:07  FlappyBirdFirst\FlappyBirdFirst\FlappyBirdFirst.h

     文件       2110  2014-02-27 17:35  FlappyBirdFirst\FlappyBirdFirst\FlappyBirdFirst.cpp

     文件       1662  2014-02-27 17:31  FlappyBirdFirst\FlappyBirdFirst\FlappyBirdFirstDlg.h

     文件       8394  2014-02-27 17:36  FlappyBirdFirst\FlappyBirdFirst\FlappyBirdFirstDlg.cpp

     文件       1691  2014-02-27 17:36  FlappyBirdFirst\FlappyBirdFirst\stdafx.h

     文件        234  2014-02-25 17:07  FlappyBirdFirst\FlappyBirdFirst\targetver.h

     文件        144  2014-02-27 17:36  FlappyBirdFirst\FlappyBirdFirst\stdafx.cpp

     文件        686  2014-02-25 17:07  FlappyBirdFirst\FlappyBirdFirst\res\FlappyBirdFirst.rc2

    .......     67777  2009-08-31 02:31  FlappyBirdFirst\FlappyBirdFirst\res\FlappyBirdFirst.ico

     文件       1889  2014-02-13 16:59  FlappyBirdFirst\FlappyBirdFirst\img\ground.png

     文件      34891  2014-02-13 16:58  FlappyBirdFirst\FlappyBirdFirst\img\light.png

     文件       2987  2014-02-13 21:36  FlappyBirdFirst\FlappyBirdFirst\img\birdmiddle.png

     文件       2927  2014-02-13 21:34  FlappyBirdFirst\FlappyBirdFirst\img\birdprev.png

     文件       2864  2014-02-13 21:36  FlappyBirdFirst\FlappyBirdFirst\img\birdbext.png

     文件      50831  2014-02-13 21:07  FlappyBirdFirst\FlappyBirdFirst\img\start.png

     文件      27740  2014-02-13 17:03  FlappyBirdFirst\FlappyBirdFirst\img\loading.png

     文件      73882  2014-02-13 17:04  FlappyBirdFirst\FlappyBirdFirst\img\readyxia.png

     文件      72949  2014-02-13 17:04  FlappyBirdFirst\FlappyBirdFirst\img\readymiddle.png

     文件      73863  2014-02-13 17:04  FlappyBirdFirst\FlappyBirdFirst\img\readyshang.png

     文件      15491  2014-02-14 16:18  FlappyBirdFirst\FlappyBirdFirst\img\gameover.png

     文件       4478  2014-02-14 14:53  FlappyBirdFirst\FlappyBirdFirst\img\zheng.png

     文件       4473  2014-02-14 14:53  FlappyBirdFirst\FlappyBirdFirst\img\fan.png

     文件       5067  2014-02-14 15:58  FlappyBirdFirst\FlappyBirdFirst\img\recome.png

     文件      10599  2014-02-14 16:17  FlappyBirdFirst\FlappyBirdFirst\img\score.png

     文件       6446  2014-02-14 15:57  FlappyBirdFirst\FlappyBirdFirst\img\paihang.png

     文件       1284  2014-02-25 17:23  FlappyBirdFirst\FlappyBirdFirst\Resource.h

............此处省略59个文件信息

评论

共有 条评论