Exemple #1
0
 private void UpdatePozicija(Igralec igralec)
 {
     //računanje kota nasprotnika, da je usmerjen proti igralcu
     Vector2 usmerjenost = new Vector2(pozicija.X - igralec.pozicija.X, pozicija.Y - igralec.pozicija.Y);
     smer = usmerjenost;
     angle = (float)(Math.Atan2(usmerjenost.Y, usmerjenost.X));
 }
Exemple #2
0
 public void Update(GameTime cas, Igralec igralec)
 {
     if (alive)
     {
         UpdatePozicija(igralec);
         smer.Normalize();
         smer.X = (float)(smer.X * (-1)) / (float)(1.5);
         smer.Y = (float)(smer.Y * (-1)) / (float)(1.5);
         if (Vector2.Distance(pozicija, igralec.pozicija) > 20) pozicija += smer * new Vector2(HITROST,HITROST);
         //base.Update(cas, new Vector2(-1,-1), smer);
     }
     else if(alpha>0) alpha--;
 }
Exemple #3
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // TODO: Add your initialization logic here
            this.IsMouseVisible = true;
            this.Window.Title = "KillEm!";
            igralec = new Igralec();
            r1 = new Random();
            cas_napisa = TimeSpan.Zero;

            ozadje = new Sprite();
            ozadje.povecava = 1.2f;

            seznam_napisov.Add("pistola", new Sprite()); //pištola je osnovno orožje

            spawnbox = new Spawnbox();
            spawnbox.ime = "ognjena_krogla";
            spawnbox.visible = false;

            healthbox = new Spawnbox();
            healthbox.ime="zdravje";
            healthbox.visible=false;

            seznam_nasprotnikov.Add(new Nasprotnik());

            obris_izbran_napis = new Sprite();

            base.Initialize();
        }