private void GameStart() { //�ɼ� �ڽ��� ��� ������ �Է¹´�. Option opBomb = new Option(); if (opBomb.ShowDialog() == DialogResult.OK) { if (opBomb.Level == "�ʺ�") this.GameLevel = 1; else if (opBomb.Level == "��") this.GameLevel = 2; else if (opBomb.Level == "���") this.GameLevel = 3; //�� ��ȯ opBomb = null; } else //���� �ɼǹڽ��� �׳� �ݾ� ������ ��� { return; } //���� ��� ��Ʈ�ѵ��� �ʱ�ȭ �Ѵ�. this.Controls.Clear(); Player = null;//�÷��̾� PlayerMissile = null;//Player �̻��� ���� Enemy = null;//�� ���ּ� ���� Bomb = null;//�� �̻��� ���� //Player ���� Player = new PictureBox(); this.Player.ImageLocation = "img/Player.bmp"; this.Player.Location = new System.Drawing.Point(140, 370); this.Player.Name = "Player"; this.Player.Size = new System.Drawing.Size(18, 16); this.Player.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; this.Player.TabIndex = 1; this.Player.TabStop = false; this.Controls.Add(Player); //Player �̻��� ���� PlayerMissile = new PictureBox[PlayerMissileCnt]; for (int i = 0; i < PlayerMissileCnt; i++) { this.PlayerMissile[i] = new PictureBox(); this.PlayerMissile[i].ImageLocation = "img/Missile.bmp"; this.PlayerMissile[i].Location = new System.Drawing.Point(this.Width, this.Height); this.PlayerMissile[i].Name = "PlayerMissile" + i; this.PlayerMissile[i].Size = new System.Drawing.Size(13, 8); this.PlayerMissile[i].SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; this.PlayerMissile[i].Visible = false; this.Controls.Add(PlayerMissile[i]); } //�� ���ּ� ���� Enemy = new PictureBox[EnemyCount]; for (int i = 0; i < EnemyCount; i++) { this.Enemy[i] = new PictureBox(); this.Enemy[i].ImageLocation = "img/Enemy.bmp"; this.Enemy[i].Location = new System.Drawing.Point(10, i * 25); this.Enemy[i].Name = "Enemy" + i; this.Enemy[i].Size = new System.Drawing.Size(22, 20); this.Enemy[i].SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; this.Controls.Add(Enemy[i]); } //�� �̻��� ���� Bomb = new PictureBox[EnemyCount]; for (int i = 0; i < EnemyCount; i++) { this.Bomb[i] = new PictureBox(); this.Bomb[i].ImageLocation = "img/Bomb.bmp"; this.Bomb[i].Location = new System.Drawing.Point(10, i * 25); this.Bomb[i].Name = "Bomb" + i; this.Bomb[i].Size = new System.Drawing.Size(10, 10); this.Bomb[i].SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; this.Bomb[i].Visible = false; this.Controls.Add(Bomb[i]); } //Ÿ�̸� ���� TimerBomb.Start(); //���� ���ۼ��� isGameRunning = true; }
private void GameStart() { //�ɼ� �ڽ��� ��� ������ �Է¹´�. Option opBomb = new Option(); if (opBomb.ShowDialog() == DialogResult.OK) { if (opBomb.Level == "�ʺ�") this.GameLevel = 1; else if (opBomb.Level == "��") this.GameLevel = 2; else if (opBomb.Level == "���") this.GameLevel = 3; //�� ��ȯ opBomb = null; } else //���� �ɼǹڽ��� �׳� �ݾ� ������ ��� { return; } // �ٹ�ȣ 107 - 120 ���� // �ɼ� ��ȭ���ڸ� �����Ͽ� ������ �Է� �ް�, // 117�� ��ü �� ��ȯ����. ���ӿ��� ������� �ʴ� ��ü�� �ٷ� �Ҹ��� �־�� �� //���� ��� ��Ʈ�ѵ��� �ʱ�ȭ �Ѵ�. this.Controls.Clear(); // 127 ���� ���� ���ȿ� �߰��� ��Ʈ���� ��� ������. // ������ ó�� ������ �� �߰��� ������ ���ֱ� ���ؼ� // ��, ������ �������� �� ��� �������� �߰��ߴ� ��Ʈ���� ��� �ʱ�ȭ �ϱ� ���ؼ� Player = null;//�÷��̾� PlayerMissile = null;//Player �̻��� ���� Enemy = null;//�� ���ּ� ���� Bomb = null;//�� �̻��� ���� score = 0; //�������� �ʱ�ȭ PlayerHp = 3; //HP�ʱ�ȭ enemyCnt = EnemyCount; // ����ȭ���� �� ���ּ� ���� 0�̵Ǹ� ���� //�ְ����� lblScoreMax = new Label(); lblScoreMax.Location = new System.Drawing.Point(0, 0); lblScoreMax.Size = new System.Drawing.Size(60, 11); lblScoreMax.BackColor = Color.Black; lblScoreMax.ForeColor = Color.Yellow; lblScoreMax.Text = "�ְ�����"; this.Controls.Add(lblScoreMax); lblScoreMaxVal = new Label(); lblScoreMaxVal.Location = new System.Drawing.Point(60, 0); lblScoreMaxVal.Size = new System.Drawing.Size(30, 11); lblScoreMaxVal.BackColor = Color.Black; lblScoreMaxVal.ForeColor = Color.Yellow; lblScoreMaxVal.Text = Convert.ToString(scoreMax); this.Controls.Add(lblScoreMaxVal); //�������� lblScore = new Label(); lblScore.Location = new System.Drawing.Point(0, 15); lblScore.Size = new System.Drawing.Size(60, 11); lblScore.BackColor = Color.Black; lblScore.ForeColor = Color.Yellow; lblScore.Text = "��������"; this.Controls.Add(lblScore); lblScoreVal = new Label(); lblScoreVal.Location = new System.Drawing.Point(60, 15); lblScoreVal.Size = new System.Drawing.Size(30, 11); lblScoreVal.BackColor = Color.Black; lblScoreVal.ForeColor = Color.Yellow; lblScoreVal.Text = "0"; this.Controls.Add(lblScoreVal); // �� 4�ٿ��� ��� Null �� �ʱ�ȭ �ϴ� ������ // �������� ������ �� ��� ������ �ν��Ͻ��� ������ ��ü�� �ʱ� ���·� �ϱ� ���� //Player ���� Player = new PictureBox(); this.Player.ImageLocation = "img/iron.png"; // Bin/Debug/img ������ �̹��� ���� // this.Player.ImageLocation = "img/Player_1.png"; // �ٸ� �̹����� ��ü�� ���� this.Player.Location = new System.Drawing.Point(140, 370); // �߽��� this.Player.Name = "Player"; this.Player.Size = new System.Drawing.Size(28, 26); // ũ�� this.Player.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; this.Player.TabIndex = 1; this.Player.TabStop = false; this.Controls.Add(Player); // �ݷ���(�迭)�� �߰� //Player �̻��� ���� PlayerMissile = new PictureBox[PlayerMissileCnt]; for (int i = 0; i < PlayerMissileCnt; i++) { this.PlayerMissile[i] = new PictureBox(); this.PlayerMissile[i].ImageLocation = "img/missile.bmp"; this.PlayerMissile[i].Location = new System.Drawing.Point(this.Width, this.Height); this.PlayerMissile[i].Name = "PlayerMissile" + i; this.PlayerMissile[i].Size = new System.Drawing.Size(20, 13); //13,8 this.PlayerMissile[i].SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; this.PlayerMissile[i].Visible = false; this.Controls.Add(PlayerMissile[i]); } //�� ���ּ� ���� Enemy = new PictureBox[EnemyCount]; for (int i = 0; i < EnemyCount; i++) { this.Enemy[i] = new PictureBox(); this.Enemy[i].ImageLocation = "img/Enemy.bmp"; if (i < EnemyCount / 2) this.Enemy[i].Location = new System.Drawing.Point(40 * i, 25); else this.Enemy[i].Location = new System.Drawing.Point(40 * (i % (EnemyCount / 2)), 150); this.Enemy[i].Name = "Enemy" + i; this.Enemy[i].Size = new System.Drawing.Size(32, 27); //22, 20 this.Enemy[i].SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; this.Controls.Add(Enemy[i]); } //�� �̻��� ���� Bomb = new PictureBox[EnemyCount]; for (int i = 0; i < EnemyCount; i++) { this.Bomb[i] = new PictureBox(); this.Bomb[i].ImageLocation = "img/Bomb.bmp"; if (i < EnemyCount/2) this.Bomb[i].Location = new System.Drawing.Point(40 * i, 25); else this.Bomb[i].Location = new System.Drawing.Point(40 * (i % EnemyCount / 2), 150); this.Bomb[i].Name = "Bomb" + i; this.Bomb[i].Size = new System.Drawing.Size(15, 15); // 10,10 this.Bomb[i].SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; this.Bomb[i].Visible = false; this.Controls.Add(Bomb[i]); } //Ÿ�̸� ���� TimerBomb.Start(); //���� ���ۼ��� isGameRunning = true; }