Beispiel #1
0
        private void Form1_Load(object sender, EventArgs e)
        {
            MenuScreen ms = new MenuScreen();

            this.Controls.Add(ms);
            ms.Focus();
        }
Beispiel #2
0
        private void winTimer_Tick(object sender, EventArgs e)
        {
            if (nori.x < this.Width)
            {
                //move nori to the right until off-screen
                nori.MoveLeftRight(5);

                //draw the correct nori animation sprite
                noriAnimationCounter++;
                if (noriAnimationCounter == 0)
                {
                    nori.sprite = Properties.Resources.noriR1;
                }
                if (noriAnimationCounter == 8)
                {
                    nori.sprite = Properties.Resources.noriRR;
                }
                if (noriAnimationCounter == 16)
                {
                    nori.sprite = Properties.Resources.noriR2;
                }
                if (noriAnimationCounter == 24)
                {
                    nori.sprite          = Properties.Resources.noriRR;
                    noriAnimationCounter = -8;
                }

                Refresh();
            }
            else if (winTextWritten != winText)
            {
                //write out the win text one character at a time until it has been fully written out
                foreach (char c in winText)
                {
                    winTextWritten += c;
                    Refresh();
                    Thread.Sleep(50);
                }
            }
            else
            {
                //wait 4 seconds before going back to the title screen
                Thread.Sleep(4000);

                winTimer.Enabled = false;

                MenuScreen ms   = new MenuScreen();
                Form       form = this.FindForm();

                form.Controls.Add(ms);
                form.Controls.Remove(this);

                ms.Focus();
                ms.Location = new Point((form.Width - ms.Width) / 2, (form.Height - ms.Height) / 2);
            }
        }