1. Anasayfa
  2. Visual Studio C#

C# Uçak Savaşı Oyunu

C# Uçak Savaşı Oyunu
C# Uçak Savaşı Oyunu
8

Bu şimdiki C# örneğimizde basit bir oyun uygulaması yapacağız. Uygulamayı aşağıdaki videodan önizleyebilir ve konu sonundan uygulamayı indirebilirsiniz….

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
 
namespace Ucak_Savasi
{
    public partial class Form1 : Form
    {
        int solHareket = 0;
        int ducakHareketHiz = 3;
        Random rnd = new Random();
        int mermiHiz = 8;
        bool ates = false;
        int Puan = 0;
        public Form1()
        {
            InitializeComponent();
            ducak1.Top = -500;
            ducak2.Top = -900;
            ducak3.Top = -1300;
            mermi.Top = -100;
            mermi.Left = -100;
 
        }
 
        private void ducak1_Click(object sender, EventArgs e)
        {
 
        }
 
        private void Form1_Load(object sender, EventArgs e)
        {
            //https://www.bilisimogretmeni.com
        }
 
        private void Form1_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                timer1.Start();
            }
            if (e.KeyCode == Keys.P)
            {
                timer1.Stop();
            }
 
            if (e.KeyCode == Keys.Left)
            {
                if (bucak.Location.X < 0) { solHareket = 0; } else { solHareket =-5; }
            }
            else if (e.KeyCode == Keys.Right)
            {
                if (bucak.Location.X > 512)
                {
                    solHareket = 0;
                }
                else
                {
                    solHareket = 5;
                }
            }
            else if (e.KeyCode == Keys.Space)
            {
 
                if (ates == false)
                {
                    mermiHiz = 8;
                    mermi.Left = bucak.Left+40;
                    mermi.Top = bucak.Top;
                    ates = true;
                }
            }
 
        }
 
        private void Form1_KeyUp(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Left)
            {
                solHareket = 0;
            }
            else if (e.KeyCode == Keys.Right)
            {
                solHareket = 0;
            }
        private void timer1_Tick(object sender, EventArgs e)
        {
            bucak.Left += solHareket;
            mermi.Top -= mermiHiz;
            ducak1.Top += ducakHareketHiz;
            ducak2.Top += ducakHareketHiz;
            ducak3.Top += ducakHareketHiz;
            lblsonuc.Text = "" + Puan;
            if (ducak1.Top >= 660 || ducak2.Top >= 660 || ducak3.Top >= 660)
            {
                oyunSonu();
 
            }
            if (ates && mermi.Top < 0)
            {
                ates = false;
                mermiHiz = 0;
                mermi.Top = -100;
                mermi.Left = -100;
            }
            Vurulma();
        }
 
        private void oyunSonu()
        {          
                timer1.Enabled = false;
                MessageBox.Show(Puan + " Puan Kazandınız....", "Uçak Oyunu V1.0 www.bilisimogretmeni.com", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                Puan = 0;
                lblsonuc.Text = "0";
                ducak1.Top = -500;
                ducak2.Top = -900;
                ducak3.Top = -1300;
                mermi.Top = -100;
                mermi.Left = -100;
                timer1.Enabled = true;
        }
 
        private void Vurulma()
        {
            if (mermi.Bounds.IntersectsWith(ducak1.Bounds))
            {
                Puan += 1;
                ducak1.Top = -500;
                int ranP = rnd.Next(1, 300);
                ducak1.Left = ranP;
                ates = false;
                mermiHiz = 0;
                mermi.Top = -100;
                mermi.Left = -100;
                //https://www.bilisimogretmeni.com
 
            }
            else if (mermi.Bounds.IntersectsWith(ducak2.Bounds))
            {
                Puan += 1;
                ducak2.Top = -900;
                int ranP = rnd.Next(1, 400);
                ducak2.Left = ranP;
                ates = false;
                mermiHiz = 0;
                mermi.Top = -100;
                mermi.Left = -100;
 
            }
            else if (mermi.Bounds.IntersectsWith(ducak3.Bounds))
            {
                Puan += 1;
                ducak3.Top = -1300;
                int ranP = rnd.Next(1, 500);
                ducak3.Left = ranP;
                ates = false;
                mermiHiz = 0;
                mermi.Top = -100;
                mermi.Left = -100;
 
            }
 
        }
 
        private void label2_Click(object sender, EventArgs e)
        {
 
        }
    }
}
İndir “C# Uçak Oyunu” Ucak_Savasi.zip – 6899 defa indirildi – 3,69 MB
Bu İçeriğe Tepkin Ne Oldu?
  • 39
    ba_ar_l_
    Başarılı
  • 8
    gayet_yi
    Gayet İyi
  • 9
    te_ekk_rler
    Teşekkürler
  • 13
    anlamad_m
    Anlamadım
  • 10
    yetersiz
    Yetersiz
Subscribe
Bildir
guest


Bu site, istenmeyenleri azaltmak için Akismet kullanıyor. Yorum verilerinizin nasıl işlendiği hakkında daha fazla bilgi edinin.

8 Yorum
Inline Feedbacks
View all comments
Sıla

Nasıl o uçakları koydun anlatır mısın lütfen .

Dilara

acaba uçak resimlerını nerden aldınız ????

Sabri Aydinli

Cagdisi teknolojileri birakin artik ya. Gidin Web ogrenin.

Takipçi

Teşekkürler Güzel bir uygulama :D

Takipçi

Teşekkürler geliştirilebilir bir uygulama