• 大小: 690KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-05-22
  • 语言: C#
  • 标签: c#  flappybird  

资源简介

使用c#开发的flappybird小游戏。功能还没有完全实现。有需要的拿去用吧。

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using flappybird.Properties;

namespace flappybird
{
    public class Bird : GameObj
    {
        /// 
        /// 各种小鸟形态数组
        /// 

        private static Image[] imgs ={
                         Properties.Resources.bird_blue_0
                         Properties.Resources.bird_blue_1
                         Properties.Resources.bird_blue_2
                     };
        /// 
        /// 当前绘制的小鸟形态的索引
        /// 

        public int BirdIndex { get; set; }
        /// 
        /// 存储当前下落速度
        /// 

        public float Speed { get; set; }
        /// 
        /// 存储已下落持续时间
        /// 

        public float Time { get; set; }




        private static Bird bird = null;
        /// 
        /// 单例模式,确保只实例化一个Bird对象
        /// 

        /// 
        public static Bird GetSingleBird()
        {
            if (bird == null)
            {
                bird = new Bird(100 200 0);
            }
            return bird;
        }
        /// 
        /// 调用父类的构造函数
        /// 

        /// 
        /// 
        /// 
        private Bird(int x int y int birdIndex)
            : base(x y imgs[0].Height imgs[0].Width)
        {
            this.BirdIndex = birdIndex;
            this.Time = 10f;
            this.Speed = 0f;
        }

        /// 
        /// 重写父类的抽象Draw方法
        /// 

        public override void Draw(Graphics g)
        {
            switch (this.BirdIndex)
            {
                case 0:
                    g.DrawImage(imgs[0] this.X this.Y);
                    break;
                case 1:
                    g.DrawImage(imgs[1] this.X this.Y);
                    break;
                case 2:
                    g.DrawImage(imgs[2] this.X this.Y);
                    break;
                default:
                    break;
            }
            this.BirdIndex++;
            this.BirdIndex %= 3;
        }
        /// 
        /// 重写父类的抽象Move方法
        /// 

        public override void Move()
        {
            this.Y = this.Y <= 60 ? 0 : this.Y - 60;
            //this.Y -= 30;
        }
        /// 
        /// 获取图形区域,用于碰撞检测
        /// 

        /// 
        public static Rectangle GetRectangle()
        {
            return new Rectangle(bird.X bird.Y Resources.bird_blue_0.Width Resources.bird_blue_0.Height);
        } 
    }
}

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

     文件     214016  2014-12-11 13:52  flappybird\bin\Debug\flappybird.exe

     文件      48640  2014-12-11 13:52  flappybird\bin\Debug\flappybird.pdb

     文件      22656  2014-12-13 13:27  flappybird\bin\Debug\flappybird.vshost.exe

     文件        490  2010-03-17 22:39  flappybird\bin\Debug\flappybird.vshost.exe.manifest

     文件       3016  2014-12-13 13:30  flappybird\Bird.cs

     文件       4786  2014-12-09 23:34  flappybird\flappybird.csproj

     文件       4755  2014-12-10 02:18  flappybird\Form1.cs

     文件       4144  2014-12-10 12:07  flappybird\Form1.Designer.cs

     文件       6574  2014-12-10 12:07  flappybird\Form1.resx

     文件        702  2014-12-08 21:55  flappybird\GameObj.cs

     文件       1165  2014-12-09 00:58  flappybird\Gravity.cs

     文件       1417  2014-12-09 00:15  flappybird\obj\Debug\DesignTimeResolveAssemblyReferences.cache

     文件       8247  2014-12-09 22:26  flappybird\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache

     文件        938  2014-12-13 13:27  flappybird\obj\Debug\flappybird.csproj.FileListAbsolute.txt

     文件       1533  2014-12-11 13:52  flappybird\obj\Debug\flappybird.csproj.GenerateResource.Cache

     文件       2145  2014-12-08 21:51  flappybird\obj\Debug\flappybird.csprojResolveAssemblyReference.cache

     文件     214016  2014-12-11 13:52  flappybird\obj\Debug\flappybird.exe

     文件        180  2014-12-11 13:52  flappybird\obj\Debug\flappybird.Form1.resources

     文件      48640  2014-12-11 13:52  flappybird\obj\Debug\flappybird.pdb

     文件     198495  2014-12-09 23:34  flappybird\obj\Debug\flappybird.Properties.Resources.resources

     文件       6144  2014-12-08 17:27  flappybird\obj\Debug\TempPE\Properties.Resources.Designer.cs.dll

     文件       2071  2014-12-10 01:42  flappybird\Pipe.cs

     文件        491  2014-12-08 17:02  flappybird\Program.cs

     文件       1362  2014-12-08 17:02  flappybird\Properties\AssemblyInfo.cs

     文件       7552  2014-12-08 17:27  flappybird\Properties\Resources.Designer.cs

     文件       9105  2014-12-08 17:27  flappybird\Properties\Resources.resx

     文件       1097  2014-12-08 17:02  flappybird\Properties\Settings.Designer.cs

     文件        249  2014-12-08 17:02  flappybird\Properties\Settings.settings

     文件      45166  2014-12-08 17:06  flappybird\Resources\atlas.png

     文件      47891  2014-12-08 17:06  flappybird\Resources\background.png

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

评论

共有 条评论