C# Öğren

şekiller çizen bir uygulama yapalım aşağıdaki kodu kullanarak şekiller çizen bir uygulama yapbilirsin


using System; using System.Drawing; using System.Windows.Forms; namespace WinFormsApp1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void btnDaire_Click(object sender, EventArgs e) { // Formun üzerine daire çiz using (Graphics g = this.CreateGraphics()) { Pen pen = new Pen(Color.Black, 2); g.DrawEllipse(pen, 50, 50, 100, 100); } } private void btnKare_Click(object sender, EventArgs e) { // Formun üzerine kare çiz using (Graphics g = this.CreateGraphics()) { Pen pen = new Pen(Color.Black, 2); g.DrawRectangle(pen, 50, 50, 100, 100); } } private void btnUcgen_Click(object sender, EventArgs e) { // Formun üzerine üçgen çiz using (Graphics g = this.CreateGraphics()) { Pen pen = new Pen(Color.Black, 2); Point[] points = { new Point(50, 150), new Point(100, 50), new Point(150, 150) }; g.DrawPolygon(pen, points); } } private void btnDikdortgen_Click(object sender, EventArgs e) { // Formun üzerine dikdörtgen çiz using (Graphics g = this.CreateGraphics()) { Pen pen = new Pen(Color.Black, 2); g.DrawRectangle(pen, 50, 50, 150, 100); } } } }


.

Hadi "Kedi Boom Boom" Adlı Bir Oyun Yapalım!

şimdi "kedi boom boom adlı bir oyun yapacağız


using static System.Runtime.CompilerServices.RuntimeHelpers; using System.Numerics; using System.Security.Cryptography.Xml; namespace kedi_boom_boom { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { using UnityEngine; public class AlienController : MonoBehaviour { public GameObject bulletPrefab; public Transform firePoint; public float jumpForce = 5f; public float speed = 3f; private Rigidbody2D rb; void Start() { rb = GetComponent(); } void Update() { if (Input.GetKeyDown(KeyCode.A)) { Fire(); } if (Input.GetKeyDown(KeyCode.Y)) { Jump(); } } void Fire() { Instantiate(bulletPrefab, firePoint.position, firePoint.rotation); } void Jump() { rb.velocity = new Vector2(rb.velocity.x, jumpForce); } } } } } ] .






n www.denizkulan.com
© denizkulanizmir@gmail.com her şey sitesininin tek hak sahibidir. tüm hakları saklıdır.