Esempio n. 1
0
        private void startButton_Click(object sender, EventArgs e)
        {
            //Moves to level screen
            LevelScreen LevelScreenForm = new LevelScreen();

            LevelScreenForm.Show();
            this.Hide();
        }
Esempio n. 2
0
        private void colTimer_Tick(object sender, EventArgs e)
        {
            //Brings dog to next level, switch forms
            if (DogSpr.IntersectsWith(stair))
            {
                floor += 1;
                this.levelForm.setHealth(getHealth());
                this.levelForm.setLevel(getLevel());
                levelForm.Show();
                this.Close();
            }

            //Determines if dog's health goes up or down
            int damageRan = randomGen.Next(25, 101);
            int healthRan = randomGen.Next(300, 501);

            foreach (Rectangle eneRec in enemyLocs)
            {
                damageRan = randomGen.Next(25, 101);

                for (int t = 0; t < foodLocs.Length; t++)
                {
                    if (eneRec.IntersectsWith(foodLocs[t]))
                    {
                        foodLocs[t].X = -32;
                        foodLocs[t].Y = -32;
                        foodCount    -= 1;
                    }
                }

                if (DogSpr.IntersectsWith(eneRec))
                {
                    if (health - damageRan < 0)
                    {
                        health = 0;
                    }

                    else
                    {
                        health -= damageRan;
                    }
                }
            }

            for (int s = 0; s < foodLocs.Length; s++)
            {
                healthRan = randomGen.Next(500, 601);

                if (DogSpr.IntersectsWith(foodLocs[s]))
                {
                    foodLocs[s].X = -32;
                    foodLocs[s].Y = -32;
                    foodCount    -= 1;

                    if (health != 0)
                    {
                        if (health + healthRan > 1000)
                        {
                            health = 1000;
                        }

                        else
                        {
                            health += healthRan;
                        }
                    }

                    if (health == 0)
                    {
                        health += 0;
                    }
                }
            }
        }