MainFrm.cs

(开头部分) 7KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using FlappyBird.Model;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace FlappyBird
{
    public partial class MainFrm : Form
    {

        private Pipe gdUp;
        private Pipe gdUp2;
        private Pipe gdDown;
        private Pipe gdDown2;
        public int Score = 0;
        public MainFrm()
        {
            InitializeComponent();
            InitialGame();
        }

        private void MainFrm_Load(object sender, EventArgs e)
        {
            //// 给当前窗体设置背景图像
            //this.BackgroundImage = Properties.Resources.bg;
            //// 设置图像在窗体中的显示效果
            //this.BackgroundImageLayout = ImageLayout.Stretch;
        }

        /// <summary>
        ///  开始初始化游戏  给游戏添加我们的游戏对象
        /// </summary>
        public void InitialGame()
        {
            SingleObject.GetSingleObject().AddGameObject(new Bird(20, 200, 0));
            //对管道进行初始化
            gdUp = new Pipe(200, -600, 128, 775, GDDirection.Up);
            gdDown = new Pipe(200, 353, 128, 775, GDDirection.Down);
            //gdUp2 = new Pipe(100+this.Width, -600, 128, 830, GDDirection.Up);
            //gdDown2 = new Pipe(100 + this.Width, 400, 128, 830, GDDirection.Down);
        }

        /// <summary>
        /// 绘制窗体的时候  重绘游戏对象
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void MainFrm_Paint(object sender, PaintEventArgs e)
        {
            SingleObject.GetSingleObject().DrawGameObject(e.Graphics);
            //需要访问到管道对象
            gdUp.Draw(e.Graphics);
            gdDown.Draw(e.Graphics);

        }
后面还有 143 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。