Example #1
0
 public void RemoveMToken(Classes.mechToken m)
 {
     MTokens.Remove(m);
 }
Example #2
0
        private void GameScreen_Paint(object sender, PaintEventArgs e)
        {
            SolidBrush g = new SolidBrush(Color.Green);
            SolidBrush b = new SolidBrush(Color.SkyBlue);

            e.Graphics.FillRectangle(g, 0, this.Height - 100, this.Width, 100);
            e.Graphics.FillRectangle(b, 0, 0, this.Width, this.Height - 100);

            e.Graphics.DrawRectangle(new Pen(Color.Black), cloudX, 50, 100, 50);
            if (!started)
            {
                Font s = new Font(Font.FontFamily, 20);

                e.Graphics.DrawString("Press Space to Play!", s, new SolidBrush(Color.Black), (this.Width - 300) / 2, 100);
            }
            if (!up && !grounded)
            {
                frame = 9;
            }
            if (up && curntMech != "superJump")
            {
                frame = 8;
            }
            if (grounded && !up && tick % 4 == 0)
            {
                frame++;
            }
            if (curntMech == "superJump" && tick % 4 == 0)
            {
                frame++;
            }
            if (endGame)
            {
                frame = 10;
            }
            switch (curntMech)
            {
            case "none":
                frameCount = gifImage.GetFrameCount(dimension);
                if (frame >= 8 && grounded && !up && !endGame)
                {
                    frame = 0;
                }
                e.Graphics.DrawImage(gifImage, player.hb);
                gifImage.SelectActiveFrame(dimension, frame);

                break;

            case "teleporter":
                e.Graphics.DrawImage(Properties.Resources.teleporter, player.hb.X, player.hb.Y);
                break;

            case "superJump":
                frameCount = spImage.GetFrameCount(dimension);
                if (frame >= 8 && !endGame)
                {
                    frame = 0;
                }
                e.Graphics.DrawImage(spImage, player.x, player.y);
                spImage.SelectActiveFrame(spdimension, frame);

                break;

            case "gravity":
                frameCount = gImage.GetFrameCount(dimension);
                if (frame >= 8 && grounded && !up && !endGame)
                {
                    frame = 0;
                }
                e.Graphics.DrawImage(gImage, player.x, player.y);
                gImage.SelectActiveFrame(gdimension, frame);

                break;
            }



            if (curntMech == "teleporter")
            {
                teleporterDraw(e.Graphics, teleporterMarkerY);
            }
            foreach (Classes.rocket l in rockets)
            {
                if (l.launchingRocket && l.launchingTicks < 180)
                {
                    l.launchingTicks++;
                    l.hb.Y = player.y + 25;
                    l.y    = player.y + 25;
                    e.Graphics.DrawImage(l.i, l.hb);
                }
                if (l.launchingTicks == 180 && l.launchingRocket)
                {
                    l.hb.Y            = player.y + 25;
                    l.y               = player.y + 25;
                    l.launchingRocket = false;
                }
                if (!l.launchingRocket)
                {
                    l.move();
                    e.Graphics.DrawImage(l.i, l.hb);
                    if (l.hb.Right <= 0)
                    {
                        rocketToRemove = l;
                    }
                    if (player.hb.IntersectsWith(l.hb))
                    {
                        //GameOver();
                        if (!endGame && curntMech == "none")
                        {
                            endGame = true;
                            death.Stop();
                            death.Play();
                            spdStorage = backgroundMoveSpd;
                            bounce     = (this.Height - player.y) / 2;
                        }
                        else if (curntMech != "none")
                        {
                            broken.Stop();
                            broken.Play();
                            toClearLsers = true;
                            grounded     = false;
                            curntMech    = "none";
                        }
                    }
                }
            }

            foreach (Classes.laser l in lasers)
            {
                l.move();
                e.Graphics.DrawImage(l.i, l.hb);
                if (l.hb.Right <= 0)
                {
                    laserToRemove = l;
                }
                if (player.hb.IntersectsWith(l.hb))
                {
                    //GameOver();
                    if (!endGame && curntMech == "none")
                    {
                        death.Stop();
                        death.Play();
                        spdStorage = backgroundMoveSpd;
                        endGame    = true;
                        bounce     = (this.Height - player.y) / 2;
                    }
                    else if (curntMech != "none")
                    {
                        broken.Stop();
                        broken.Play();
                        toClearLsers = true;
                        grounded     = false;
                        curntMech    = "none";
                    }
                }
            }
            if (toClearLsers)
            {
                lasers.Clear();
                rockets.Clear();
                toClearLsers = false;
            }
            List <Classes.coin> delete = new List <Classes.coin>();

            foreach (Classes.coin c in coins)
            {
                if (c.hb.IntersectsWith(player.hb))
                {
                    coinScore++;
                    //coinToRemove = c;
                    delete.Add(c);
                }
                else
                {
                    c.move();
                    e.Graphics.FillEllipse(coinBrush, c.hb);
                    if (c.hb.Right <= 0)
                    {
                        //coinToRemove = c;
                        delete.Add(c);
                    }
                }
            }
            foreach (Classes.mechToken m in MTokens)
            {
                if (m.hb.IntersectsWith(player.hb))
                {
                    MTokenToRemove = m;
                    curntMech      = m.type;
                    lasers.Clear();
                    rockets.Clear();
                    broken.Play();
                }
                else
                {
                    m.move();
                    e.Graphics.FillRectangle(coinBrush, m.hb);
                    if (m.hb.Right <= 0)
                    {
                        MTokenToRemove = m;
                    }
                }
                if (upgrades["xray"])
                {
                    string s = "";
                    Font   f = new Font(Font.FontFamily, 20);
                    if (m.type == "teleporter")
                    {
                        s = "T";
                    }
                    else if (m.type == "superJump")
                    {
                        s = "S";
                    }
                    else if (m.type == "gravity")
                    {
                        s = "G";
                    }
                    e.Graphics.DrawString(s, f, new SolidBrush(Color.Black), m.hb.X + 10, m.hb.Y + 10);
                }
            }
            Font fr = new Font("Arial", 16);

            e.Graphics.DrawString("Coins " + coinScore, fr, new SolidBrush(Color.Black), 0, 10);
            e.Graphics.DrawString("Distance " + actualDist + "m", fr, new SolidBrush(Color.Black), 0, 30);
            RemoveLaser(laserToRemove);
            RemoveCoin(delete);
            RemoveMToken(MTokenToRemove);
            MTokenToRemove = null;
            coinToRemove   = null;
            laserToRemove  = null;
        }
Example #3
0
        private void GameTimer_Tick(object sender, EventArgs e)
        {
            tick++;                         // tick
            cloudX    -= backgroundMoveSpd; // move cloud
            dist      += backgroundMoveSpd; // add to dist
            actualDist = dist / 100;        // actual distance travelled
            if (endGame && tick % 15 == 0)
            {
                if (backgroundMoveSpd > 0)
                {
                    backgroundMoveSpd--;
                }
                else if (bounce < 10 && backgroundMoveSpd == 0)
                {
                    GameOver();
                }
            }
            if (endGame && player.hb.Bottom >= this.Height && !bounceUp)
            {
                bounceUp = true;
                bounce  /= 2;
                if (bounce < 15)
                {
                    bounce = 0;
                }
            }
            if (player.hb.Bottom > this.Height - bounce && bounceUp && endGame)
            {
                player.move(-10);
                airDownFrames = 0;
            }
            else
            {
                bounceUp = false;
            }

            if (r.Next(0, 101) < coinChance && tick % 120 == 0 && !endGame)
            {
                generateCoin(r.Next(0, 3), r.Next(100, this.Height - 100));
            }
            if (r.Next(0, 2) == 0 && tick % 1200 == 0 && !endGame && curntMech == "none")
            {
                Classes.mechToken m = new Classes.mechToken(this.Width, r.Next(0, this.Height - 50));
                if (!abort)
                {
                    MTokens.Add(m);
                }
                else
                {
                    abort = false;
                }
            }
            if (tick == 180)
            {
                lasers.Add(new Classes.laser(this.Width, 10, midLaser, laserWidth, Properties.Resources.laserV));
            }
            else if (tick % timeBtwnLasers == 0 && !endGame)
            {
                generateLaser(player.y);
            }
            if (tick % 1200 == 0 && coinChance < 35 && !endGame)
            {
                coinChance += 5;
            }

            if (tick % 240 == 0)
            {
                cloudX = this.Width;
            }
            if (tick % 550 == 0 && !endGame)
            {
                if (backgroundMoveSpd < 20)
                {
                    backgroundMoveSpd += 2;
                }

                //if (timeBtwnLasers > 15) timeBtwnLasers -= 15;
            }
            if (tick % 240 == 0)
            {
                if (timeBtwnLasers > 20)
                {
                    timeBtwnLasers -= 15;
                }
                else
                {
                    //timeBtwnLasers = 5;
                }
            }
            if (tick % 600 == 0 && r.Next(0, 3) == 0 && !upgrades["jammer"])
            {
                if (r.Next(0, 5) == 0)
                {
                    spawnBarrage  = true;
                    barrageSpawns = 0;
                }

                Classes.rocket rc = new Classes.rocket(this.Width - 80, player.y + 25);
                alert.Stop();
                alert.Play();
                rockets.Add(rc);
            }
            if (spawnBarrage && tick % 30 == 0 && barrageSpawns < 5)
            {
                Classes.rocket rc = new Classes.rocket(this.Width - 80, player.y + 25);
                rockets.Add(rc);
                barrageSpawns++;
            }



            switch (curntMech)
            {
            case "none":
                standardGrounded();
                standardUp();
                standardGav();
                standardJump();
                break;

            case "teleporter":
                grounded = true;
                break;

            case "superJump":
                superJumpUp();
                superJumpGav();
                break;

            case "gravity":
                GsuitGav();
                break;
            }



            if (endGame)
            {
                up = false;
            }
            Refresh();
        }
Example #4
0
        private void GameScreen_Paint(object sender, PaintEventArgs e)
        {
            if (!started)
            {
                Font s = new Font(Font.FontFamily, 20);

                e.Graphics.DrawString("Press Space to Play!", s, new SolidBrush(Color.White), (this.Width - 300) / 2, 100);
            }
            switch (curntMech)
            {
            case "none":
                //e.Graphics.DrawRectangle(playerPen, player.hb);
                break;

            case "teleporter":
                break;

            case "superJump":
                break;

            case "gravity":
                break;
            }


            e.Graphics.DrawRectangle(playerPen, player.hb);
            if (curntMech == "teleporter")
            {
                teleporterDraw(e.Graphics, teleporterMarkerY);
            }
            foreach (Classes.rocket l in rockets)
            {
                if (l.launchingRocket && l.launchingTicks < 180)
                {
                    l.launchingTicks++;
                    e.Graphics.DrawRectangle(new Pen(Color.White), this.Width - 30, player.hb.Top + 25, 30, 25);
                }
                if (l.launchingTicks == 180 && l.launchingRocket)
                {
                    l.hb.Y            = player.y + 25;
                    l.y               = player.y + 25;
                    l.launchingRocket = false;
                }
                if (!l.launchingRocket)
                {
                    l.move();
                    e.Graphics.DrawRectangle(playerPen, l.hb);
                    if (l.hb.Right <= 0)
                    {
                        rocketToRemove = l;
                    }
                    if (player.hb.IntersectsWith(l.hb))
                    {
                        //GameOver();
                        if (!endGame && curntMech == "none")
                        {
                            endGame    = true;
                            spdStorage = backgroundMoveSpd;
                            bounce     = (this.Height - player.y) / 2;
                        }
                        else if (curntMech != "none")
                        {
                            toClearLsers = true;
                            grounded     = false;
                            curntMech    = "none";
                        }
                    }
                }
            }

            foreach (Classes.laser l in lasers)
            {
                l.move();
                e.Graphics.DrawRectangle(playerPen, l.hb);
                if (l.hb.Right <= 0)
                {
                    laserToRemove = l;
                }
                if (player.hb.IntersectsWith(l.hb))
                {
                    //GameOver();
                    if (!endGame && curntMech == "none")
                    {
                        spdStorage = backgroundMoveSpd;
                        endGame    = true;
                        bounce     = (this.Height - player.y) / 2;
                    }
                    else if (curntMech != "none")
                    {
                        toClearLsers = true;
                        grounded     = false;
                        curntMech    = "none";
                    }
                }
            }
            if (toClearLsers)
            {
                lasers.Clear();
                rockets.Clear();
                toClearLsers = false;
            }
            List <Classes.coin> delete = new List <Classes.coin>();

            foreach (Classes.coin c in coins)
            {
                if (c.hb.IntersectsWith(player.hb))
                {
                    coinScore++;
                    //coinToRemove = c;
                    delete.Add(c);
                }
                else
                {
                    c.move();
                    e.Graphics.FillEllipse(coinBrush, c.hb);
                    if (c.hb.Right <= 0)
                    {
                        //coinToRemove = c;
                        delete.Add(c);
                    }
                }
            }
            foreach (Classes.mechToken m in MTokens)
            {
                if (m.hb.IntersectsWith(player.hb))
                {
                    MTokenToRemove = m;
                    curntMech      = m.type;
                    lasers.Clear();
                    rockets.Clear();
                }
                else
                {
                    m.move();
                    e.Graphics.FillRectangle(coinBrush, m.hb);
                    if (m.hb.Right <= 0)
                    {
                        MTokenToRemove = m;
                    }
                }
                if (upgrades["xray"])
                {
                    string s = "";
                    Font   f = new Font(Font.FontFamily, 20);
                    if (m.type == "teleporter")
                    {
                        s = "T";
                    }
                    else if (m.type == "superJump")
                    {
                        s = "S";
                    }
                    else if (m.type == "gravity")
                    {
                        s = "G";
                    }
                    e.Graphics.DrawString(s, f, new SolidBrush(Color.Black), m.hb.X + 10, m.hb.Y + 10);
                }
            }
            e.Graphics.DrawString("Coins " + coinScore, Font, new SolidBrush(Color.White), 0, 10);
            e.Graphics.DrawString("Distance " + actualDist, Font, new SolidBrush(Color.White), 0, 20);
            RemoveLaser(laserToRemove);
            RemoveCoin(delete);
            RemoveMToken(MTokenToRemove);
            MTokenToRemove = null;
            coinToRemove   = null;
            laserToRemove  = null;
        }
Example #5
0
        private void GameScreen_Paint(object sender, PaintEventArgs e)
        {
            //draw sky
            SolidBrush g = new SolidBrush(Color.Green);
            SolidBrush b = new SolidBrush(Color.SkyBlue);

            e.Graphics.FillRectangle(g, 0, this.Height - 100, this.Width, 100);
            e.Graphics.FillRectangle(b, 0, 0, this.Width, this.Height - 100);
            e.Graphics.DrawImage(Properties.Resources.cloud, cloudX, 50, 100, 50); //clouds

            if (!started)                                                          // display startup message
            {
                Font s = new Font(Font.FontFamily, 20);

                e.Graphics.DrawString("Press Green to Play!", s, new SolidBrush(Color.Black), (this.Width - 300) / 2, 100);
            }
            //decides animation frames
            if (!up && !grounded)
            {
                frame = 9;
            }
            if (up && curntMech != "superJump")
            {
                frame = 8;
            }
            if (grounded && !up && tick % 4 == 0)
            {
                frame++;
            }
            if (curntMech == "superJump" && tick % 4 == 0)
            {
                frame++;
            }
            if (endGame)
            {
                frame = 10;
            }

            switch (curntMech) //draws image based on mech/character
            {
            case "none":
                frameCount = gifImage.GetFrameCount(dimension);
                if (frame >= 8 && grounded && !up && !endGame)
                {
                    frame = 0;
                }
                e.Graphics.DrawImage(gifImage, player.hb);
                gifImage.SelectActiveFrame(dimension, frame);
                break;

            case "teleporter":
                e.Graphics.DrawImage(Properties.Resources.teleporter, player.hb.X, player.hb.Y);
                break;

            case "superJump":
                frameCount = spImage.GetFrameCount(dimension);
                if (frame >= 8 && !endGame)
                {
                    frame = 0;
                }
                e.Graphics.DrawImage(spImage, player.x, player.y);
                spImage.SelectActiveFrame(spdimension, frame);
                break;

            case "gravity":
                frameCount = gImage.GetFrameCount(dimension);
                if (frame >= 8 && grounded && !up && !endGame)
                {
                    frame = 0;
                }
                e.Graphics.DrawImage(gImage, player.x, player.y);
                gImage.SelectActiveFrame(gdimension, frame);
                break;
            }

            if (curntMech == "teleporter")
            {
                teleporterDraw(e.Graphics, teleporterMarkerY);                            // draws teleporter cursor
            }
            foreach (Classes.rocket l in rockets)
            {
                if (l.launchingRocket && l.launchingTicks < 180) // displays warning, and tracks player
                {
                    l.launchingTicks++;
                    l.hb.Y = player.y + 25;
                    l.y    = player.y + 25;
                    e.Graphics.DrawImage(l.i, l.hb);
                }
                if (l.launchingTicks == 180 && l.launchingRocket) // sets rocket to player location
                {
                    l.hb.Y            = player.y + 25;
                    l.y               = player.y + 25;
                    l.launchingRocket = false;
                }
                if (!l.launchingRocket) // shoots rocket at player
                {
                    l.move();
                    e.Graphics.DrawImage(l.i, l.hb);

                    if (l.hb.Right <= 0)
                    {
                        rocketToRemove = l;                  // out of bounds, delete
                    }
                    if (player.hb.IntersectsWith(l.hb))      // if hits player, kill player and delete
                    {
                        if (!endGame && curntMech == "none") // kill
                        {
                            endGame = true;
                            death.Stop();
                            death.Play();
                            spdStorage = backgroundMoveSpd;
                            bounce     = (this.Height - player.y) / 2;
                        }
                        else if (curntMech != "none") // destroy mech instead of killing
                        {
                            broken.Stop();
                            broken.Play();
                            toClearLsers = true; // clears all objects
                            grounded     = false;
                            curntMech    = "none";
                        }
                    }
                }
            }

            foreach (Classes.laser l in lasers)
            {
                l.move();
                e.Graphics.DrawImage(l.i, l.hb); //display laser

                if (l.hb.Right <= 0)
                {
                    laserToRemove = l;                   // remove if out of bounds
                }
                if (player.hb.IntersectsWith(l.hb))      //if hits player
                {
                    if (!endGame && curntMech == "none") // kill player
                    {
                        death.Stop();
                        death.Play();
                        spdStorage = backgroundMoveSpd;
                        endGame    = true;
                        bounce     = (this.Height - player.y) / 2;
                    }
                    else if (curntMech != "none") //destroy mech
                    {
                        broken.Stop();
                        broken.Play();
                        toClearLsers = true;
                        grounded     = false;
                        curntMech    = "none";
                    }
                }
            }

            if (toClearLsers)
            {
                lasers.Clear();
                rockets.Clear();
                toClearLsers = false;
            }

            List <Classes.coin> delete = new List <Classes.coin>(); // coins to delete

            foreach (Classes.coin c in coins)
            {
                if (c.hb.IntersectsWith(player.hb)) // if player hits coins
                {
                    coinScore++;
                    //coinToRemove = c;
                    delete.Add(c);
                }
                else
                {
                    c.move(); // move and draw
                    e.Graphics.FillEllipse(coinBrush, c.hb);

                    if (c.hb.Right <= 0) // if ooB, delete
                    {
                        delete.Add(c);
                    }
                }
            }

            foreach (Classes.mechToken m in MTokens)
            {
                if (m.hb.IntersectsWith(player.hb)) //if player hits mech token
                {
                    MTokenToRemove = m;
                    curntMech      = m.type; // set player mech to token type
                    lasers.Clear();
                    rockets.Clear();
                    broken.Play();
                }
                else
                {
                    m.move();
                    e.Graphics.FillRectangle(coinBrush, m.hb); //move and draw

                    if (m.hb.Right <= 0)                       // if ooB, delete
                    {
                        MTokenToRemove = m;
                    }
                }

                if (upgrades["xray"]) // if xray is bought, you can see the type of mech token
                {
                    string s = "";
                    Font   f = new Font(Font.FontFamily, 20);

                    if (m.type == "teleporter")
                    {
                        s = "T";
                    }
                    else if (m.type == "superJump")
                    {
                        s = "S";
                    }
                    else if (m.type == "gravity")
                    {
                        s = "G";
                    }

                    e.Graphics.DrawString(s, f, new SolidBrush(Color.Black), m.hb.X + 10, m.hb.Y + 10);
                }
            }
            //draws coin and distance
            Font fr = new Font("Arial", 16);

            e.Graphics.DrawString("Coins " + coinScore, fr, new SolidBrush(Color.Black), 0, 10);
            e.Graphics.DrawString("Distance " + actualDist + "m", fr, new SolidBrush(Color.Black), 0, 30);

            //removes objects
            RemoveLaser(laserToRemove);
            RemoveCoin(delete);
            RemoveMToken(MTokenToRemove);
            MTokenToRemove = null;
            laserToRemove  = null;
        }
Example #6
0
        private void GameTimer_Tick(object sender, EventArgs e)
        {
            tick++;                         // tick
            cloudX    -= backgroundMoveSpd; // move cloud
            dist      += backgroundMoveSpd; // add to dist
            actualDist = dist / 100;        // actual distance travelled

            if (endGame && tick % 15 == 0)  // for bounces and slowing down after being killed
            {
                if (backgroundMoveSpd > 0)
                {
                    backgroundMoveSpd--;
                }
                else if (bounce < 10 && backgroundMoveSpd == 0)
                {
                    GameOver();                                             // if fully stopped, gameover
                }
            }

            if (endGame && player.hb.Bottom >= this.Height && !bounceUp) // if player hits bottom, bounce up
            {
                bounceUp = true;
                bounce  /= 2;
                if (bounce < 15)
                {
                    bounce = 0;
                }
            }

            if (player.hb.Bottom > this.Height - bounce && bounceUp && endGame) // if less than bounce height, keep moving up
            {
                player.move(-10);
                airDownFrames = 0;
            }
            else
            {
                bounceUp = false; // turn around and fall down
            }

            if (r.Next(0, 101) < coinChance && tick % 120 == 0 && !endGame) // if game isnt over, and chance is met, generate a coin pattern
            {
                generateCoin(r.Next(0, 3), r.Next(100, this.Height - 100));
            }

            if (r.Next(0, 2) == 0 && tick % 1200 == 0 && !endGame && curntMech == "none") // every 1200 ticks, have a chance to generate a mech token
            {
                Classes.mechToken m = new Classes.mechToken(this.Width, r.Next(0, this.Height - 50));

                if (!abort) // if the player doesn't have the generated mech, stop the generation
                {
                    MTokens.Add(m);
                }
                else
                {
                    abort = false;
                }
            }

            if (tick == 180) // generates startup laser
            {
                lasers.Add(new Classes.laser(this.Width, 10, midLaser, laserWidth, Properties.Resources.laserV));
            }
            else if (tick % timeBtwnLasers == 0 && !endGame) //from here on out, generate a laser every timebtwnlaser ticks
            {
                generateLaser(player.y);
            }

            if (tick % 1200 == 0 && coinChance < 35 && !endGame)
            {
                coinChance += 5; // every 1200 ticks increase chance to get coins
            }
            if (tick % 240 == 0) // move the cloud to front of screen
            {
                cloudX = this.Width;
            }

            if (tick % 550 == 0 && !endGame) // movespeed increase every 550 ticks
            {
                if (backgroundMoveSpd < 20)  // caps speed at 20
                {
                    backgroundMoveSpd += 2;
                }
            }

            if (tick % 240 == 0) //every 240 ticks, decrease spawn timeout for lasers
            {
                if (timeBtwnLasers > 20)
                {
                    timeBtwnLasers -= 15;
                }
            }

            if (tick % 600 == 0 && r.Next(0, 3) == 0 && !upgrades["jammer"]) // spawn rockets on 1/3 chance, every 600 ticks, and if you haven't bought jammer
            {
                if (r.Next(0, 5) == 0)                                       // 1/5 chance to spawn a 5 rocket barrage
                {
                    spawnBarrage  = true;
                    barrageSpawns = 0;
                }

                Classes.rocket rc = new Classes.rocket(this.Width - 80, player.y + 25); // create a rocket that follows the player

                alert.Stop();                                                           //play alert
                alert.Play();
                rockets.Add(rc);
            }

            if (spawnBarrage && tick % 30 == 0 && barrageSpawns < 5) // spawn barrage rockets every 30 ticks until 5 are spawned
            {
                Classes.rocket rc = new Classes.rocket(this.Width - 80, player.y + 25);
                rockets.Add(rc);
                barrageSpawns++;
            }

            switch (curntMech) //based on mech, do different physics
            {
            case "none":
                standardGrounded();
                standardUp();
                standardGav();
                standardJump();
                break;

            case "teleporter":
                grounded = true;
                break;

            case "superJump":
                superJumpUp();
                superJumpGav();
                break;

            case "gravity":
                GsuitGav();
                break;
            }

            if (endGame)
            {
                up = false;          // stop the player from flying if they got hit
            }
            Refresh();
        }