Ejemplo n.º 1
0
        public void fartMeter()
        {
            //fart Mete#test change#r
            blockBrush.Color  = Color.FromArgb(200 - fartTimer / 4, 50, 128, 40);
            blockBrush2.Color = Color.FromArgb(200 - fartTimer / 3, 0, 100, 0);
            blockBrush3.Color = Color.FromArgb(fartTimer / 2, 165, 42, 42);

            if (fart && fartTimer > 0)
            {
                fartTimer -= 2;
                fartLevel += 2;
            }
            else if (fartTimer < 260)
            {
                fartTimer++;
            }
            else if (fartTimer >= 260)
            {
                //lose
                // Create an instance of the SecondScreen
                Form1.mainGameMusic.Stop();
                Form1.titleMusic.Play();
                loseScreen cs = new loseScreen();
                cs.Location = new Point(this.Left, this.Top);
                // Add the User Control to the Form
                Form form = this.FindForm();
                form.Controls.Remove(this);
                form.Controls.Add(cs);
                cs.Focus();
                timer1.Enabled = false;
                return;
            }
        }
Ejemplo n.º 2
0
        public void GameOver(string type)
        {//game over method
            scoreLabel.Visible = false;
            timeLabel.Visible  = false;

            gameOver = true;
            Refresh();

            Label    l     = new Label();
            Graphics graph = this.CreateGraphics();

            timer1.Enabled = false;
            if (type == "poop")
            {
                graph.DrawImage(Properties.Resources.dylonPoopy, playerRect);
            }
            else if (type == "embarassed")
            {
                graph.DrawImage(Properties.Resources.dylonEmbarassed, playerRect);
            }

            for (int i = -30; i < 80; i++)
            {
                try
                {
                    graph.FillRectangle(gameOverBrush, screenRect);
                    gameOverBrush.Color = Color.FromArgb(i, 139, 69, 19);
                }
                catch
                {
                }
            }

            if (type == "poop")
            {
                graph.DrawString("you pooped your pants...", new Font("Outline Pixel7", 45, FontStyle.Regular), testBrush, new Rectangle(30, this.Height / 2 - 40, this.Width, 100));
            }
            else if (type == "embarassed")
            {
                graph.DrawString("someone caught you...", new Font("Outline Pixel7", 50, FontStyle.Regular), testBrush, new Rectangle(40, this.Height / 2 - 40, this.Width, 100));
            }


            System.Threading.Thread.Sleep(2000);

            Form1.mainGameMusic.Stop();
            Form1.titleMusic.Play();
            loseScreen cs = new loseScreen();

            cs.Location = new Point(this.Left, this.Top);
            // Add the User Control to the Form
            Form form = this.FindForm();

            form.Controls.Remove(this);
            form.Controls.Add(cs);
            cs.Focus();
            return;
        }
Ejemplo n.º 3
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            counter++;
            timeLabel.Text  = "Time:" + (counter / 28).ToString("000");
            scoreLabel.Text = "Score:" + (Form1.score).ToString("0000");

            dayChange();
            fartMeter();

            #region fartlLevel
            if (Keyboard.IsKeyDown(Key.Space))
            {
                if (fartLevel > 3)
                {
                    try
                    {
                        //    farts[farts.Count - 1].size.Width+= 2;
                        //    farts[farts.Count - 1].size.Height+= 2;
                        //    farts[farts.Count - 1].x--;
                        //    farts[farts.Count - 1].y--;
                        farts[farts.Count - 1].cap = fartLevel;
                    }
                    catch
                    {
                        GasCloud g = new GasCloud(position + 75, this.Height - 160, fartLevel);
                        farts.Add(g);
                    }
                    //farts.RemoveAt(farts.IndexOf(g) - 1);
                }
                else
                {
                    GasCloud g = new GasCloud(position + 75, this.Height - 160, fartLevel);
                    farts.Add(g);
                }

                fartLevel++;
            }
            else
            {
                fartLevel = 0;
            }
            #endregion

            #region Farts

            GrowFarts();

            #endregion

            #region Pedestrians

            double scoreFactor = Form1.score / 20;
            pedSpawnFactor = Convert.ToInt16(Math.Round(scoreFactor));

            SpawnNPC();
            DespawnNPC();

            foreach (Pedestrian p in peds)
            {
                p.Move();

                foreach (GasCloud f in farts)
                {
                    if (p.Collide(f.rect))
                    {
                        Form1.score++;
                    }
                    if (p.FartCheck(f.rect, playerHitbox))
                    {
                        //lose
                        // Create an instance of the SecondScreen
                        Form1.mainGameMusic.Stop();
                        Form1.titleMusic.PlayLooping();
                        loseScreen cs = new loseScreen();
                        cs.Location = new Point(this.Left, this.Top);
                        // Add the User Control to the Form
                        Form form = this.FindForm();
                        form.Controls.Remove(this);
                        form.Controls.Add(cs);
                        cs.Focus();
                        timer1.Enabled = false;
                        return;
                    }
                }
            }

            #endregion

            playerRect.X   = position;
            playerHitbox.X = position + 36;

            if (speedBoostTimer > 0)
            {
                speed = 10;
                speedBoostTimer--;
            }
            else
            {
                speed = 5;
            }

            if (right && position < this.Width - 119)
            {
                left      = false;
                position += speed;
                still     = false;
                imageChange();
            }
            else if (left && position > -40)
            {
                right     = false;
                still     = false;
                position -= speed;
                imageChange();
            }
            else
            {
                still = true;
                imgStill++;
                if (imgStill == 60)
                {
                    imgStill = 0;
                }
            }

            Refresh();
        }
Ejemplo n.º 4
0
        private void mainGame_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
        {
            imgStill = 0;
            if (e.KeyCode == Keys.Escape)
            {
                pause = true;
                if (brightness > 100)
                {
                    backBrush.Color = Color.FromArgb(140, 0, 0, 0); backBrush2.Color = Color.FromArgb(120, 0, 0, 0);
                }
                timer1.Enabled = false; Refresh();
            }

            if (!pause)
            {
                if (e.KeyCode == Keys.Right && !fart)
                {
                    right = true;
                }
                if (e.KeyCode == Keys.Left && !fart)
                {
                    left = true;
                }
                if (e.KeyCode == Keys.Space)
                {
                    right = false; left = false; fart = true; Form1.fartSound.Play();
                }
            }

            else
            {
                if (e.KeyCode == Keys.Space)
                {
                    pause = false; timer1.Enabled = true; Refresh();
                }
                if (e.KeyCode == Keys.M)
                {
                    // Create an instance of the SecondScreen
                    Form1.mainGameMusic.Stop();
                    Form1.titleMusic.PlayLooping();
                    MainScreen cs = new MainScreen();
                    cs.Location = new Point(this.Left, this.Top);
                    // Add the User Control to the Form
                    Form f = this.FindForm();
                    f.Controls.Remove(this);
                    f.Controls.Add(cs);
                    cs.Focus();
                }
            }
            if (brightness < 245)
            {
                if (e.KeyCode == Keys.B)
                {
                    brightness += 10;
                }
            }
            if (brightness > 12)
            {
                if (e.KeyCode == Keys.M)
                {
                    brightness -= 10;
                }
            }

            //gameOver
            if (e.KeyCode == Keys.G)
            {
                // Create an instance of the SecondScreen
                loseScreen cs = new loseScreen();
                cs.Location = new Point(this.Left, this.Top);
                // Add the User Control to the Form
                Form f = this.FindForm();
                f.Controls.Remove(this);
                f.Controls.Add(cs);
                cs.Focus();
            }
        }