コード例 #1
0
        public Form1()
        {
            InitializeComponent();

            //Stop Movement Timers
            MoveTimersStop();

            //Stop Powerup Timers
            Powerup01Timer.Stop();
            Powerup02Timer.Stop();

            //Random Food Placement
            Food01.Location = new Point(random.Next(67, 908), random.Next(67, 908));
            Food02.Location = new Point(random.Next(67, 908), random.Next(67, 908));
            Food03.Location = new Point(random.Next(67, 908), random.Next(67, 908));
            Food04.Location = new Point(random.Next(67, 908), random.Next(67, 908));
            Food05.Location = new Point(random.Next(67, 908), random.Next(67, 908));
            Food06.Location = new Point(random.Next(67, 908), random.Next(67, 908));
        }
コード例 #2
0
        //ShieldTimer
        private void Powerup02Timer_Tick(object sender, EventArgs e)
        {
            //Waiting for 5 seconds
            wait2--;
            ShieldCounter.Text = wait2 + " sec";
            if (wait2 == 0)
            {
                //deactivating Powerup
                ShieldActive = false;

                //Player Image to Normal
                Image PlayerNormal = Image.FromFile("asserts\\Player(HappyHarry).png");
                Player.Image = PlayerNormal;

                ShieldCounter.Visible = false;
                wait2 = 5;
                ShieldCounter.Text = wait2 + " sec";
                Powerup02Timer.Stop();
            }
        }