c#.net之窗体应用程序飞机大战(开始+暂停+得分+清屏+爆炸)

程序小白,欢迎建议
有需要源码或图片或音效的请在GitHup自行下载下载地址请点击这里
设计界面运行界面
主要实现代码:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Media;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace 打字游戏
{
   
    public partial class Form1 : Form
    {
   
        public Form1()
        {
   
            InitializeComponent();
        }

        //实例化一个游戏区 
        Panel bg = new Panel();
        //实例化一个控制区
        Panel kz = new Panel();
        //实例化随机对象
        Random r = new Random();
        //实例化己方飞机对象
        PictureBox plan = new PictureBox();
        //实例化得分板
        Label lb1 = new Label();
        //实例化开始按钮
        Label lb2 = new Label();
        //记录分数
        int count = 0;
        //创建敌机
        Timer GreateEnmmy = new Timer();
        //字母下落
        Timer FlyTime = new Timer();
        //lab进度条背景
        Label jdback = new Label();
        //lab进度条
        Label jdtiao = new Label();
        //进度条血量
        int xt = 100;
        //实例化放飞机火苗1
        PictureBox fire2 = new PictureBox();
        //实例化放飞机火苗2
        PictureBox fire = new PictureBox();
        装敌机
        List<PictureBox> djBox = new List<PictureBox>();
        装子弹
        List<PictureBox> zdBox = new List<PictureBox>();
        //创建子弹生成器
        Timer Greatbutt = new Timer();
        //子弹上升
        Timer buttTop = new Timer();
        //给飞机火苗添加控制时间
        Timer firet = new Timer();
        //实例化声音
        SoundPlayer sy = new SoundPlayer();
        private void Form1_Load(object sender, EventArgs e)
        {
   
            //初始化窗口
            this.Size = new Size(1000, 600);
            //this.BackColor = Color.Red;
            this.BackgroundImage = Image.FromFile(@"../../img/bg.jpg");
            this.BackgroundImageLayout = ImageLayout.Stretch;
            this.Left = Screen.PrimaryScreen.Bounds.Width / 2 - this.Width / 2;
            this.Top = Screen.PrimaryScreen.Bounds.Height / 2 - this.Height / 2;

            //创建游戏区
            bg.Width = 800;
            bg.Height = 530;
            bg.BackColor = Color.Pink;
            this.Controls.Add(bg);
            bg.Location = new Point(10, 20);

            //创建控制区
            kz.Width = 200;
            kz.Height = 530;
            kz.BackColor = Color.Cyan;
            kz.Location = new Point(this.Width-kz.
  • 2
    点赞
  • 17
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值