Esempio n. 1
0
        private void SetLocation(Karakter karakter, PictureBox pbSprite)
        {
            Rectangle vld    = gbSpeelveld.Bounds;
            int       margin = 50;

            if (karakter.X < 0)
            {
                karakter.X = 0;
            }
            if (karakter.X > vld.Width - margin)
            {
                karakter.X = vld.Width - margin;
            }
            if (karakter.Y < 0)
            {
                karakter.Y = 0;
            }
            if (karakter.Y > vld.Height - margin)
            {
                karakter.Y = vld.Height - margin;
            }

            Console.WriteLine("vld: W" + vld.Width + ", H" + vld.Height);
            Console.WriteLine(karakter.X + ", " + karakter.Y);

            pbSprite.Location = new Point(karakter.X, karakter.Y);
        }
Esempio n. 2
0
        public GameForm()
        {
            InitializeComponent();

            Random    r      = new Random();
            Rectangle vld    = gbSpeelveld.Bounds;
            int       margin = 50;

            karakterA = new Karakter("Jij", r.Next(margin, vld.Width - margin), r.Next(margin, vld.Height - margin));
            karakterB = new Karakter("Tegenstander", r.Next(margin, vld.Width - margin), r.Next(margin, vld.Height - margin));

            karakterB.ModXp(+600);

            UpdateUI();
        }
Esempio n. 3
0
        public void CastSpell(Karakter target)
        {
            if (IsAlive && target.IsAlive)
            {
                int targetLevensBefore = target.Levens;
                Logger.Log(Naam + " schiet: Pew!");
                target.ModXp(-500);

                if (target.IsAlive == false)
                {
                    ModXp(600);
                }
                else if (target.Levens < targetLevensBefore)
                {
                    ModXp(300);
                }
            }
        }