• 大小: 1.82MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-10-01
  • 语言: C#
  • 标签: C#  游戏  FlappyBird  

资源简介

模仿的FlappyBird,功能都实现了,代码不多,一看就懂,项目介绍博客地址:http://blog.csdn.net/q594076608/article/details/40217039

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Threading;
using System.Windows.Forms;
using Microsoft.Win32;

namespace FlappyBird
{
    public partial class FrmMain : Form
    {
        private bool IsAlive = false;
        private int cntBirdUp = 0;
        private int DisVerticalUp = 30;
        private int DisVerticalDown = 1;
        public PictureBox[] picPipe = new PictureBox[6];
        bool[] IsTransit = new bool[3];
        int Score = 0;
        int 试玩次数=0;
        int 最高得分 = 0;
        int 金牌 = 0;
        int 银牌 = 0;
        int 铜牌 = 0;
        int 第一根管子都没通过 = 0;

        public FrmMain()
        {
            InitializeComponent();
        }

        protected override bool ProcessDialogKey(Keys keyData)
        {
            if (keyData == Keys.Up || keyData == Keys.Down || keyData == Keys.Left || keyData == Keys.Right || keyData == Keys.Enter || keyData == Keys.Space || keyData == Keys.Escape)
            {
                return false;
            }
            else
            {
                return base.ProcessDialogKey(keyData);
            }
        }

        private void FrmMain_Load(object sender EventArgs e)
        {
            CheckForIllegalCrossThreadCalls = false;
            UnifyInfo();
            pnlTop.Top = -180;
            for (int i = 0; i < picPipe.Length; i++)
            {
                picPipe[i] = new PictureBox();
                picPipe[i].Size = new Size(50 150);
                picPipe[i].SizeMode = PictureBoxSizeMode.StretchImage;
                picPipe[i].BackColor = Color.Transparent;
                if (i % 2 == 0)
                {
                    picPipe[i].Image = global::FlappyBird.Properties.Resources.Pipe_Down;
                }
                else
                {
                    picPipe[i].Image = global::FlappyBird.Properties.Resources.Pipe;
                }
                pnlbase.Controls.Add(picPipe[i]);
            }
            for (int i = 0; i < picPipe.Length; i++)
            {
                picPipe[i].Location = new Point(pnlbase.Width 0);
                //IsTransit[i / 2] = false;
            }
        }

        private int GetHeight()
        {
            return (new Random().Next(-110 0));
        }

        private void FrmMain_KeyUp(object sender KeyEventArgs e)
        {
            switch (e.KeyData)
            {
                case Keys.Enter:
                case Keys.Space:
                    {
                        if (IsAlive)
                        {
                            tmrBirdDown.Stop();
                            BirdUp();
                            DisVerticalDown = 1;
                            tmrBirdDown.Start();
                            //if (cntBirdUp == 0)
                            //{
                            /

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

     文件        140  2014-02-17 17:42  FlappyBird\FlappyBird\App.config

     文件     250368  2014-02-17 17:34  FlappyBird\FlappyBird\bin\Debug\FlappyBird.exe

     文件        189  2014-02-15 19:47  FlappyBird\FlappyBird\bin\Debug\FlappyBird.exe.config

     文件      34304  2014-02-17 17:34  FlappyBird\FlappyBird\bin\Debug\FlappyBird.pdb

     文件      22984  2014-02-17 17:35  FlappyBird\FlappyBird\bin\Debug\FlappyBird.vshost.exe

     文件        189  2014-02-15 19:47  FlappyBird\FlappyBird\bin\Debug\FlappyBird.vshost.exe.config

     文件        490  2013-06-18 20:28  FlappyBird\FlappyBird\bin\Debug\FlappyBird.vshost.exe.manifest

     文件     292864  2014-02-21 15:51  FlappyBird\FlappyBird\bin\Release\FlappyBird.exe

     文件        140  2014-02-17 17:42  FlappyBird\FlappyBird\bin\Release\FlappyBird.exe.config

     文件      38400  2014-02-21 15:51  FlappyBird\FlappyBird\bin\Release\FlappyBird.pdb

     文件      21464  2014-02-21 15:55  FlappyBird\FlappyBird\bin\Release\FlappyBird.vshost.exe

     文件        140  2014-02-17 17:42  FlappyBird\FlappyBird\bin\Release\FlappyBird.vshost.exe.config

     文件        490  2013-06-18 20:28  FlappyBird\FlappyBird\bin\Release\FlappyBird.vshost.exe.manifest

     文件       4199  2014-02-17 19:25  FlappyBird\FlappyBird\FlappyBird.csproj

     文件      11556  2014-02-17 19:56  FlappyBird\FlappyBird\FrmMain.cs

     文件      18236  2014-02-17 19:51  FlappyBird\FlappyBird\FrmMain.Designer.cs

     文件      26181  2014-02-17 19:51  FlappyBird\FlappyBird\FrmMain.resx

     文件        219  2014-02-17 19:58  FlappyBird\FlappyBird\Global.cs

     文件      82174  2014-02-15 21:12  FlappyBird\FlappyBird\img\BG.png

     文件       8624  2014-02-15 21:27  FlappyBird\FlappyBird\img\BG2.jpg

     文件       7405  2014-02-21 14:27  FlappyBird\FlappyBird\img\Bird.gif

     文件       6405  2014-02-15 21:17  FlappyBird\FlappyBird\img\Bird1.gif

     文件     106023  2014-02-15 21:27  FlappyBird\FlappyBird\img\m_1392115568513.jpg

     文件      98972  2014-02-15 21:21  FlappyBird\FlappyBird\img\m_1392115576302.jpg

     文件      85480  2014-02-15 21:21  FlappyBird\FlappyBird\img\m_1392115590670.jpg

     文件      27810  2014-02-15 22:39  FlappyBird\FlappyBird\img\Pipe.png

     文件      27816  2014-02-15 22:40  FlappyBird\FlappyBird\img\Pipe_Down.png

     文件      11911  2014-02-17 18:42  FlappyBird\FlappyBird\img\Play.png

     文件      10327  2014-02-15 20:50  FlappyBird\FlappyBird\img\ProgressBar.gif

     文件      16656  2014-02-17 18:42  FlappyBird\FlappyBird\img\Top.png

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

评论

共有 条评论