Ejemplo n.º 1
0
        public void OzelGucCiz(Tank tank1, Tank tank2)
        {
            ozelGunEffectAnimNo += 15 * Resim.FrameTime;
            ozelGunEffectAnimNo  = ozelGunEffectAnimNo > 15 ? 0 : ozelGunEffectAnimNo;

            if (!tank1.ozelGucDurum && !tank2.ozelGucDurum)
            {
                ozelGucAnimNo = ozelGucAnimNo > 13 ? 0 : ozelGucAnimNo;
                Resim.Ciz(ozelGuc[(int)ozelGucAnimNo], 580, 362, 125, 150);
                ozelGucAnimNo += 15 * Resim.FrameTime;
            }
            if (tank1.ozelGucDurum)
            {
                Resim.Ciz(ozelGucEffect[(int)ozelGunEffectAnimNo], tank1.x - 100, tank1.y - 70, 250, 250);
            }
            if (tank2.ozelGucDurum)
            {
                Resim.Ciz(ozelGucEffect[(int)ozelGunEffectAnimNo], tank2.x - 45, tank2.y - 25, 150, 150);
            }



            if (362 + 35 > tank1.y && 362 + 35 < tank1.y + 70 && 580 + 35 > tank1.x && 580 + 35 < tank1.x + 35 * 2 && !tank2.ozelGucDurum)
            {
                SFMLSes.Ses.SesCal(kukre);
                tank1.ozelGucDurum = true;
                tank1.x            = 400;
                tank1.y            = 400;
                tank2.x            = 800;
                tank2.y            = 400;
                tank1.rotation     = 0;
                tank2.rotation     = 0;
                tank1.kutuAcik     = true;
                tank1.kutuCan      = 3;
                do
                {
                    tank1.kutuX = tank2.kutuX = r.Next(50, 1180);
                    tank1.kutuY = tank2.kutuY = r.Next(10, 760);
                } while (tank1.kutuX + 35 * 2 > 550 && tank1.kutuX < 670 + 35 * 2 && tank1.kutuY + 35 * 2 > 325 && tank1.kutuY < 445 + 35 * 2);
            }
            else if (362 + 35 > tank2.y && 362 + 35 < tank2.y + 70 && 580 + 35 > tank2.x && 580 + 35 < tank2.x + 35 * 2 && !tank1.ozelGucDurum)
            {
                SFMLSes.Ses.SesCal(kukre);
                tank2.ozelGucDurum = true;
                tank1.x            = 400;
                tank1.y            = 400;
                tank2.x            = 800;
                tank2.y            = 400;
                tank1.rotation     = 0;
                tank2.rotation     = 0;
                tank1.kutuAcik     = true;
                tank2.kutuAcik     = true;
                tank1.kutuCan      = 3;
                do
                {
                    tank1.kutuX = tank2.kutuX = r.Next(50, 1180);
                    tank1.kutuY = tank2.kutuY = r.Next(10, 760);
                } while (tank1.kutuX + 35 * 2 > 550 && tank1.kutuX < 670 + 35 * 2 && tank1.kutuY + 35 * 2 > 325 && tank1.kutuY < 445 + 35 * 2);
            }
        }
Ejemplo n.º 2
0
 public void KalkanCiz()
 {
     if (kalkanDurum)
     {
         Resim.Ciz(kalkan, x - 45, y - 25, 150, 150);
     }
 }
Ejemplo n.º 3
0
        public void CanCiz(Tank tank1, Tank tank2)
        {
            if (canZaman > 5.0f && (!tank1.oyunBitti && !tank2.oyunBitti))
            {
                Resim.Ciz(can, canx - ortala, cany - ortala, ozellikBuyukluk, ozellikBuyukluk, ozellikDonus);

                if (cany + 35 > tank1.y && cany + 35 < tank1.y + 70 && canx + 35 > tank1.x && canx + 35 < tank1.x + 35 * 2)
                {
                    SFMLSes.Ses.SesCal(canSes);
                    tank1.Can -= 20;
                    canZaman   = 0;
                }
                if (cany + 35 > tank2.y && cany + 35 < tank2.y + 70 && canx + 35 > tank2.x && canx + 35 < tank2.x + 35 * 2)
                {
                    SFMLSes.Ses.SesCal(canSes);
                    tank2.Can -= 20;
                    canZaman   = 0;
                }
            }
            else
            {
                do
                {
                    canx = r.Next(50, 1180);
                    cany = r.Next(10, 760);
                } while (canx + 35 * 2 > 550 && canx < 670 + 35 * 2 && cany + 35 * 2 > 325 && cany < 445 + 35 * 2);
            }
            canZaman += Resim.FrameTime;
        }
Ejemplo n.º 4
0
 public void Ciz(Tank tank, Tank tank1, Tank gercekTank)
 {
     if (deger == 0)
     {
         if (animNo > 15)
         {
             animNo = 0;
             durum  = false;
         }
         if (tank.Can >= 100)
         {
             Resim.Ciz(buyukCarpma[(int)animNo], tank.x - 165, tank.y - 140, 400, 400);
             animNo += 20 * Resim.FrameTime;
         }
         //else if(tank.Can >= 100) Resim.Ciz(buyukCarpma[(int)animNo], tank.x - 165, tank.y - 140, 400, 400);
         else if (gercekTank.ozelGucDurum)
         {
             Resim.Ciz(buyukCarpma[(int)animNo], tank.x - 70, tank.y - 50, 200, 200);
         }
         else
         {
             Resim.Ciz(kucukCarpma[(int)animNo], tank.x - 40, tank.y - 25, 150, 150);
         }
         if (tank.Can < 100)
         {
             animNo += 40 * Resim.FrameTime;
         }
     }
     if (deger == 1)
     {
         if (kutuCarpmaAnimNo > 15)
         {
             kutuCarpmaAnimNo = 0;
             durum            = false;
         }
         if (gercekTank.ozelGucDurum)
         {
             Resim.Ciz(buyukCarpma[(int)kutuCarpmaAnimNo], tank1.kutuX - 50, tank1.kutuY - 60, 200, 200);
         }
         else
         {
             Resim.Ciz(kucukCarpma[(int)kutuCarpmaAnimNo], tank.kutuX - 20, tank.kutuY - 25, 150, 150);
         }
         kutuCarpmaAnimNo += 30 * Resim.FrameTime;
     }
 }
Ejemplo n.º 5
0
        public void KutuCiz(Tank tank1, Tank tank2)
        {
            if ((tank1.ozelGucDurum || tank2.ozelGucDurum) && tank1.kutuAcik)
            {
                Resim.Ciz(kutu, tank1.kutuX, tank1.kutuY, 100, 100);
                tank1.kutuDurum = true;
                tank2.kutuDurum = true;
                if (tank1.kutuCan == 0)
                {
                    tank1.kutuDurum = false;
                    tank2.kutuDurum = false;
                    tank1.kutuAcik  = false;
                    tank2.kutuAcik  = false;
                    kalkanDurum     = false;
                }
            }
            else if (!tank1.kutuAcik && !tank2.kutuAcik && !kalkanDurum)
            {
                Resim.Ciz(kalkan, tank1.kutuX - 25, tank1.kutuY - 25, 150, 150);

                if (tank1.kutuY + 35 > tank1.y && tank1.kutuY + 35 < tank1.y + 70 && tank1.kutuX + 35 > tank1.x && tank1.kutuX + 35 < tank1.x + 35 * 2)
                {
                    SFMLSes.Ses.SesCal(kalkanSes);
                    kalkanDurum       = true;
                    tank1.kalkanDurum = true;
                }
                if (tank1.kutuY + 35 > tank2.y && tank1.kutuY + 35 < tank2.y + 70 && tank1.kutuX + 35 > tank2.x && tank1.kutuX + 35 < tank2.x + 35 * 2)
                {
                    SFMLSes.Ses.SesCal(kalkanSes);
                    kalkanDurum       = true;
                    tank2.kalkanDurum = true;
                }
            }
            //else if (!tank1.ozelGucDurum && !tank2.ozelGucDurum && tank1.kutuCan == 0)
            //{
            //    tank1.kutuX = tank2.kutuX = r.Next(50, 1180);
            //    tank1.kutuY = tank2.kutuY = r.Next(10, 760);

            //}
        }
Ejemplo n.º 6
0
        public void Ciz(int canx, int cany, int tankNo)
        {
            //Resim.YaziYaz(Can.ToString(), 100, 100, 50);
            if (Can > 50 && !oyunBitti)
            {
                if (arizaAnimNo > 14)
                {
                    arizaAnimNo = 0;
                }
                Resim.Ciz(ariza[(int)arizaAnimNo], x - 70, y - 50, 200, 200);
                arizaAnimNo += 25 * Resim.FrameTime;
            }

            Resim.Ciz(renkli, canx + 8, cany + 38, 393, 35);
            Resim.Ciz(mavi, canx + 8, cany + 38, Can * 4, 35);
            Resim.Ciz(kalanCanDis, canx, cany, 500, 108);

            if (ozelGucDurum && !oyunBitti)
            {
                Resim.Ciz(tanklar[(int)displayTank], x, y, 60, 100, rotation, 255, 105, 139, 34);
            }
            else if (tankNo == 1 && !oyunBitti)
            {
                Resim.Ciz(tanklar[(int)displayTank], x, y, 60, 100, rotation, 255, 255, 48, 48);
            }
            else if (tankNo == 2 && !oyunBitti)
            {
                Resim.Ciz(tanklar[(int)displayTank], x, y, 60, 100, rotation, 255, 125, 38, 205);
            }
            //Resim.YaziYaz("CAN = " + Can, canx, cany - 30, 50);
            string tank = tankNo == 1 ? "MAVI TANK" : "KIRMIZI TANK";

            if (Can == 100)
            {
                oyunBitti = true;
                Resim.YaziYaz(tank + " KAZANDI", 250, 250, 100);
                Resim.YaziYaz("Tekrar Oynamak Icin ENTER", 380, 500, 50);
            }
        }
Ejemplo n.º 7
0
        public void OzelGucCerceve(Tank tank1, Tank tank2)
        {
            if ((tank1.ozelGucDurum || tank2.ozelGucDurum))
            {
                ozelGucZaman      = 0;
                tank1.cerceveSoru = false;
                tank2.cerceveSoru = false;
            }
            if (ozelGucZaman < 20.0f && (!tank1.oyunBitti && !tank2.oyunBitti))
            {
                Resim.Ciz(cerceve, 540, 336, 200, 200);
                Resim.YaziYaz((20 - (int)ozelGucZaman).ToString(), 600, 10, 50);
            }

            else
            {
                tank1.cerceveSoru = true;
                tank2.cerceveSoru = true;
            }

            ozelGucZaman += Resim.FrameTime;
        }
Ejemplo n.º 8
0
        //float animNo = 0, kutuCarpmaAnimNo = 0;
        //Boolean animDeger = false, kutuCarpmaAnimDeger = false;
        public void MermileriCiz(Tank tank, Tank gercekTank, Tank tank1)
        {
            //if (animDeger > 0)
            //{
            //    //if (animNo > 15)
            //    //{
            //    //    animDeger--;
            //    //    animNo = 0;
            //    //}
            //    ////Resim.Ciz(kutuCarpma[(int)animNo], tank.x - 70, tank.y - 50, 200, 200);
            //    //Resim.Ciz(kutuCarpma[(int)animNo], tank.x - 40 , tank.y - 25 , 150, 150);
            //    //animNo += 30 * Resim.FrameTime;
            foreach (Ates item in tankAtes)
            {
                if (item.durum)
                {
                    item.Ciz(tank, tank1, gercekTank);
                }
            }
            for (int i = 0; i < tankAtes.Count; i++)
            {
                if (!tankAtes[i].durum)
                {
                    tankAtes.Remove(tankAtes[i]);
                }
            }
            //}
            //if (kutuCarpmaAnimDeger == true)
            //{
            //    if (kutuCarpmaAnimNo > 10)
            //    {
            //        kutuCarpmaAnimDeger = false;
            //        kutuCarpmaAnimNo = 0;
            //    }
            //    Resim.Ciz(kutuCarpma[(int)kutuCarpmaAnimNo], tank1.kutuX - 50, tank1.kutuY - 60, 200, 200);
            //    kutuCarpmaAnimNo += 30 * Resim.FrameTime;


            //}
            for (int i = 0; i < mermiler1.Count; i++)
            {
                if (gercekTank.ozelGucDurum)
                {
                    Resim.Ciz(mermi2, mermiler1[i].X, mermiler1[i].Y, 60, 100, mermiler1[i].Rotation);
                }
                else
                {
                    Resim.Ciz(mermi1, mermiler1[i].X, mermiler1[i].Y, 60, 100, mermiler1[i].Rotation);
                }

                mermiler1[i].X += (float)((Resim.FrameTime * 500) * Math.Sin(mermiler1[i].Rotation * Math.PI / 180));
                mermiler1[i].Y -= (float)((Resim.FrameTime * 500) * Math.Cos(mermiler1[i].Rotation * Math.PI / 180));

                if ((mermiler1[i].Y + 35 > tank.y && mermiler1[i].Y + 35 < tank.y + 70 && mermiler1[i].X + 35 > tank.x && mermiler1[i].X + 35 < tank.x + 35 * 2) && tank.kalkanDurum)
                {
                    // animDeger = true;
                    Ses.SesCal(tankKalkan);
                    mermiler1.Remove(mermiler1[i]);
                }
                else if ((mermiler1[i].Y + 35 > tank.y && mermiler1[i].Y + 35 < tank.y + 70 && mermiler1[i].X + 35 > tank.x && mermiler1[i].X + 35 < tank.x + 35 * 2))
                {
                    //animDeger = true;

                    Ses.SesCal(ates);
                    tankAtes.Add(new Ates(0));
                    mermiler1.Remove(mermiler1[i]);
                    if (gercekTank.ozelGucDurum)
                    {
                        tank.Can += 5;
                    }
                    else
                    {
                        tank.Can += 2;
                    }

                    if (tank.Can >= 100)
                    {
                        Ses.SesCal(tankPatla);
                    }
                }
                else if (mermiler1[i].X > 1280 || mermiler1[i].X < -100 || mermiler1[i].Y > 960 || mermiler1[i].Y < -100)
                {
                    mermiler1.Remove(mermiler1[i]);
                }
                else if (mermiler1[i].X + 20 * 2 > 550 && mermiler1[i].X < 670 + 20 * 2 && mermiler1[i].Y + 20 * 2 > 325 && mermiler1[i].Y < 445 + 20 * 2 && tank.cerceveSoru == false)
                {
                    //if (x + r * 2 > 550 && x < 670 + r * 2 && y + r * 2 > 325 && y < 445 + r * 2)
                    mermiler1.Remove(mermiler1[i]);
                }
                else if (mermiler1[i].X - 10 + 20 * 2 > tank1.kutuX && mermiler1[i].X - 25 < tank1.kutuX + 20 * 2 && mermiler1[i].Y + 10 + 20 * 2 > tank1.kutuY && mermiler1[i].Y - 15 < tank1.kutuY + 20 * 2 && tank1.kutuDurum)
                {
                    if (tank1.kutuCan == 1)
                    {
                        Ses.SesCal(patla);
                    }
                    else
                    {
                        Ses.SesCal(ates);
                    }
                    mermiler1.Remove(mermiler1[i]);
                    tank1.kutuCan--;
                    tankAtes.Add(new Ates(1));
                }
            }
        }
Ejemplo n.º 9
0
        static void Main()
        {
            Resim.Yeni(1280, 960, "Ferhat SEZER", false);
            int bg = Resim.Ekle("img\\bigbg.png");


            Resim.SetFPSLimit(60);

            Tank     tank1      = new Tank(35, 400, 400);
            Tank     tank2      = new Tank(35, 800, 400);
            Mermiler tank1Mermi = new Mermiler();
            Mermiler tank2Mermi = new Mermiler();
            Ozellik  ozellik    = new Ozellik();

            while (Resim.Acik())
            {
                Resim.Baslat();
                Resim.Ciz(bg, 0, 0, 1280, 960);



                if (Resim.KeyPressed(SFML.Window.Keyboard.Key.D))
                {
                    tank1.Right();
                }
                if (Resim.KeyPressed(SFML.Window.Keyboard.Key.A))
                {
                    tank1.Left();
                }
                if (Resim.KeyPressed(SFML.Window.Keyboard.Key.W))
                {
                    if (!tank1.oyunBitti && !tank2.oyunBitti)
                    {
                        tank1.Display(Resim.FrameTime);
                        tank1.Up(tank2);
                    }
                }

                if (Resim.KeyPressed(SFML.Window.Keyboard.Key.S))
                {
                    if (!tank1.oyunBitti && !tank2.oyunBitti)
                    {
                        tank1.Display(Resim.FrameTime);
                        tank1.Down(tank2);
                    }
                }

                if (Resim.KeyPressed(SFML.Window.Keyboard.Key.Right))
                {
                    tank2.Right();
                }
                if (Resim.KeyPressed(SFML.Window.Keyboard.Key.Left))
                {
                    tank2.Left();
                }
                if (Resim.KeyPressed(SFML.Window.Keyboard.Key.Up))
                {
                    if (!tank2.oyunBitti && !tank1.oyunBitti)
                    {
                        tank2.Display(Resim.FrameTime);
                        tank2.Up(tank1);
                    }
                }
                if (Resim.KeyPressed(SFML.Window.Keyboard.Key.Down))
                {
                    if (!tank2.oyunBitti && !tank1.oyunBitti)
                    {
                        tank2.Display(Resim.FrameTime);
                        tank2.Down(tank1);
                    }
                }

                if (Resim.KeyPressed(SFML.Window.Keyboard.Key.RControl))
                {
                    if (!tank2.oyunBitti && !tank1.oyunBitti)
                    {
                        tank2Mermi.MermiEkle(new Mermi(tank2), Resim.FrameTime, tank2);
                    }
                }
                if (Resim.KeyPressed(SFML.Window.Keyboard.Key.F))
                {
                    if (!tank2.oyunBitti && !tank1.oyunBitti)
                    {
                        tank1Mermi.MermiEkle(new Mermi(tank1), Resim.FrameTime, tank1);
                    }
                }
                tank1Mermi.MermiHakkiYaz("Kirmizi TANK", 20, 40, tank1);
                tank2Mermi.MermiHakkiYaz("Mavi TANK", 960, 40, tank2);



                tank1.Ciz(20, 850, 1);
                tank2.Ciz(750, 850, 2);
                ozellik.CanCiz(tank1, tank2);
                ozellik.MermiCiz(tank1, tank2);
                ozellik.OzelGucCerceve(tank1, tank2);
                ozellik.OzelGucCiz(tank1, tank2);
                ozellik.KutuCiz(tank1, tank2);
                ozellik.OzelGucKontrol(tank1, tank2);

                tank1Mermi.MermileriCiz(tank2, tank1, tank1);
                tank2Mermi.MermileriCiz(tank1, tank2, tank1);
                tank1.KalkanCiz();
                tank2.KalkanCiz();
                ozellik.TekrarOyna(tank1, tank2);

                Resim.Bitir();
            }
        }
Ejemplo n.º 10
0
        public void MermiCiz(Tank tank1, Tank tank2)
        {
            ozellikDonus += 20 * Resim.FrameTime;


            if (ozellikBuyuklukSoru == true)
            {
                if (ozellikBuyukluk > 150)
                {
                    ozellikBuyuklukSoru = false;
                }
                else
                {
                    ozellikBuyuklukSoru = true;
                    ozellikBuyukluk    += 20 * Resim.FrameTime;
                    sayacOrtala++;
                    if (sayacOrtala == 2)
                    {
                        ortala     += 20 * Resim.FrameTime;
                        sayacOrtala = 0;
                    }
                }
            }
            if (ozellikBuyuklukSoru == false)
            {
                if (ozellikBuyukluk < 100)
                {
                    ozellikBuyuklukSoru = true;
                }
                else
                {
                    ozellikBuyuklukSoru = false;
                    ozellikBuyukluk    -= 20 * Resim.FrameTime;
                    sayacOrtala++;
                    if (sayacOrtala == 2)
                    {
                        ortala     -= 20 * Resim.FrameTime;
                        sayacOrtala = 0;
                    }
                }
            }
            if (mermiZaman > 8.0f && (!tank1.oyunBitti && !tank2.oyunBitti))
            {
                Resim.Ciz(mermi, mermix - ortala, mermiy - ortala, ozellikBuyukluk, ozellikBuyukluk, ozellikDonus);

                if (mermiy + 35 > tank1.y && mermiy + 35 < tank1.y + 70 && mermix + 35 > tank1.x && mermix + 35 < tank1.x + 35 * 2)
                {
                    SFMLSes.Ses.SesCal(mermiSes);
                    mermiZaman = 0;
                    if (tank1.mermiHakki <= 0)
                    {
                        tank1.mermiHakki = 30;
                    }
                    else
                    {
                        tank1.mermiHakki += 30;
                    }
                }
                if (mermiy + 35 > tank2.y && mermiy + 35 < tank2.y + 70 && mermix + 35 > tank2.x && mermix + 35 < tank2.x + 35 * 2)
                {
                    SFMLSes.Ses.SesCal(mermiSes);
                    mermiZaman = 0;
                    if (tank2.mermiHakki <= 0)
                    {
                        tank2.mermiHakki = 30;
                    }
                    else
                    {
                        tank2.mermiHakki += 30;
                    }
                }
            }
            else
            {
                do
                {
                    mermix = r.Next(50, 1180);
                    mermiy = r.Next(10, 760);
                } while (mermix + 35 * 2 > 550 && mermix < 670 + 35 * 2 && mermiy + 35 * 2 > 325 && mermiy < 445 + 35 * 2);
            }
            mermiZaman += Resim.FrameTime;
        }