コード例 #1
0
ファイル: MainFrm.cs プロジェクト: soeminnminn/BattleCity
        public MainFrm()
        {
            this.InitializeComponent();

            this.MaximumSize = this.Size;
            this.MinimumSize = this.Size;
            this.BackColor = Color.FromArgb(0x74, 0x74, 0x74);
            this.DoubleBuffered = true;
            this.StartPosition = FormStartPosition.CenterScreen;

            this.m_canvas = new Canvas(this);
        }
コード例 #2
0
        public Bullet(Canvas canvas, gObject owner, int level)
            : base(canvas, 16, 16)
        {
            this.m_canvas = canvas;
            this.m_owner = owner;
            this.m_level = level;

            if (owner != null)
            {
                this.m_face = owner.Face;

                int cursorX = 0;
                switch (owner.Face)
                {
                    case FaceDirection.Up:
                        {
                            this.m_x = (owner.X + (owner.Width / 2)) - 8;
                            this.m_y = owner.Y - 4;
                            cursorX = 112;
                        }
                        break;
                    case FaceDirection.Down:
                        {
                            this.m_x = (owner.X + (owner.Width / 2)) - 8;
                            this.m_y = (owner.Y + owner.Height) - 4;
                            cursorX = 128;
                        }
                        break;
                    case FaceDirection.Left:
                        {
                            this.m_x = owner.X - 4;
                            this.m_y = (owner.Y + (owner.Height / 2)) - 8;
                            cursorX = 144;
                        }
                        break;
                    case FaceDirection.Right:
                        {
                            this.m_x = (owner.X + owner.Width) - 4;
                            this.m_y = (owner.Y + (owner.Height / 2)) - 8;
                            cursorX = 160;
                        }
                        break;
                }

                this.LoadImage(cursorX, 18, 16, 16);
                this.m_effect = new Effect();
                this.m_effect.End += new EventHandler(this.effect_End);

                this.m_processThread = new Thread(new ThreadStart(this.DoProcess));
                this.m_processThread.Start();
            }
        }
コード例 #3
0
ファイル: MainFrm.cs プロジェクト: soeminnminn/BattleCity
        public MainFrm()
        {
            this.InitializeComponent();

            this.MaximumSize = this.Size;
            this.MinimumSize = this.Size;
            this.BackColor = Color.FromArgb(0x74, 0x74, 0x74);
            this.DoubleBuffered = true;
            this.StartPosition = FormStartPosition.CenterScreen;

            this.m_loading = new LoadingPane(this.panelCanvas.Width, this.panelCanvas.Height);
            this.m_map = new Map();
            this.m_canvas = new Canvas(16, 16);

            this.m_timer = new System.Windows.Forms.Timer()
            {
                Interval = 5
            };
            this.m_timer.Tick += new EventHandler(this.timer_Tick);

            this.m_keyHook = new KeyboardHook();
            this.m_keyHook.KeyDown += new KeyEventHandler(this.keyHook_KeyDown);
        }
コード例 #4
0
ファイル: MainFrm.cs プロジェクト: soeminnminn/BattleCity
        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            this.m_timer.Stop();

            if (this.m_processThread != null)
            {
                this.m_processThread.Abort();
                this.m_processThread = null;
            }

            if (this.m_keyHook != null)
            {
                this.m_keyHook.Stop();
                this.m_keyHook = null;
            }

            if (this.m_loading != null)
            {
                this.m_loading.Dispose();
                this.m_loading = null;
            }

            if (this.m_canvas != null)
            {
                this.m_canvas.Dispose();
                this.m_canvas = null;
            }

            if (this.m_map != null)
            {
                this.m_map.Dispose();
                this.m_map = null;
            }

            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }
コード例 #5
0
        public void Start(Canvas canvas, bool secondPlayer, int level)
        {
            this.Dispose();

            this.m_canvas = canvas;
            this.SetOwner(canvas);

            this.m_secondPlayer = secondPlayer;

            this.Initialize(secondPlayer, level);

            if (secondPlayer)
            {
                this.m_x = canvas.X + 256;
                this.m_y = canvas.Y + 384;
            }
            else
            {
                this.m_x = canvas.X + 128;
                this.m_y = canvas.Y + 384;
            }

            TRACE("Player Started!");
            this.m_face = FaceDirection.Up;
            this.m_life = 0;
            this.m_pause = false;
            this.m_portal = c_portalLife;
            this.m_armor = c_armorLife;
            this.m_bulletLoad = 0;

            this.m_effect = new Effect();
            this.m_effect.End += new EventHandler(this.effect_End);
            this.m_effect.Start(this, EffectTypes.portal, 5, true);

            this.m_processThread = new Thread(new ThreadStart(this.DoProcess));
            this.m_processThread.Start();
        }
コード例 #6
0
        public Enemies(Canvas canvas, int level, int type, bool withBonus, int spwanLoc)
            : base(canvas, 32, 32)
        {
            this.m_canvas = canvas;
            this.m_life = 0;
            this.Initialize(level, type, withBonus);

            this.m_x = canvas.X;
            this.m_y = canvas.Y;
            if (spwanLoc == 1)
                this.m_x += 192;
            else if (spwanLoc == 2)
                this.m_x += 384;

            this.m_face = FaceDirection.Down;

            this.m_random = new Random();

            this.m_effect = new Effect();
            this.m_effect.End += new EventHandler(this.effect_End);
            this.m_effect.Start(this, EffectTypes.portal, 5, true);

            this.m_processThread = new Thread(new ThreadStart(this.DoProcess));
            this.m_processThread.Start();
        }