Beispiel #1
0
 public Blaze()
 {
     graphics = new GraphicsDeviceManager(this);
     Content.RootDirectory         = "Content";
     this.graphics.GraphicsProfile = GraphicsProfile.HiDef;
     instance            = this;
     this.IsMouseVisible = true;
 }
Beispiel #2
0
 //update cycle
 public GameState Update()
 {
     if (Blaze.WasPressed(Keys.Escape))
     {
         frames = splashFrames - 1;
     }
     frames++;
     if (frames == splashFrames)
     {
         if (firstOver)
         {
             return(new MainMenu());
         }
         else
         {
             firstOver = true;
             frames    = 0;
         }
     }
     return(this);
 }
Beispiel #3
0
        static void Main()
        {
            log.Log("Game startup");
            try {
                using (var game = new Blaze())
                    game.Run();
            } catch (Exception e) {
                log.Log(e.ToString());

                var now         = DateTime.Now;
                var logName     = String.Format("ERROR {0}-{1}-{2} {3}-{4}-{5}.log", now.Month, now.Day, now.Year, now.Hour, now.Minute, now.Second);
                var logLocation = @"./logs/" + logName;
                using (var file = new StreamWriter(File.Create(logLocation)))
                {
                    file.WriteLine(e.ToString());
                }

                var ans = MessageBox.Show(e.ToString() + "\n\nEmail crash report?", "An error has occurred. Email crash report?", MessageBoxButtons.YesNo);
                if (ans == DialogResult.Yes)
                {
                    System.Diagnostics.Process.Start("mailto:[email protected]?subject=Blaze+Crash+Report?body=" + e.ToString().Replace(" ", "%20").Replace("\n", "%0A").Replace("\t", "%20"));
                }
            }
        }
Beispiel #4
0
        public void Update(List <Box> terrain)
        {
            Axis axis = Playing.Instance.axis;

            box.X += velocity.X;
            box.Y += velocity.Y;
            box.Z += velocity.Z;

            //handle walking sounds
            if (hadYCollision && (velocity.X != 0 || velocity.Z != 0))
            {
                if (walkTimer == 0)
                {
                    walkTimer = walkTime;
                    jump.Play(1f, .5f, 0f);
                }
                else if (walkTimer == walkTime / 2)
                {
                    jump.Play(1f, .4f, 0f);
                    walkTimer--;
                }
                else
                {
                    walkTimer--;
                }
            }
            else
            {
                walkTimer = walkTime;
            }

            HandleCollisions(terrain, axis);

            if (velocity.Y > -3)
            {
                velocity.Y -= gravity;
            }
            //handle turning lights on/off and drawing text prompts
            foreach (Light light in Playing.Instance.lights)
            {
                var intersection = box.Project(axis).GetIntersection(light.box.Project(axis));
                if (intersection.width == 0 || intersection.height == 0)
                {
                    light.drawText = false;
                }
                else
                {
                    light.drawText = true;
                    if (Blaze.WasPressed(Keys.E))
                    {
                        if (!light.lit)
                        {
                            if (lights > 0)
                            {
                                lights--;
                                light.lit = true;
                            }
                        }
                        else
                        {
                            lights++;
                            light.lit = false;
                        }
                    }
                }
            }
            var ex = box.Project(axis).GetIntersection(Playing.Instance.exit.box.Project(axis));

            if (ex.width != 0 && ex.height != 0 && canCollide)
            {
                if (Blaze.WasPressed(Keys.E))
                {
                    Blaze.instance.settings.levelUnlocked = Math.Max(Blaze.instance.settings.levelUnlocked, Playing.Instance.levelNum + 1);
                    Blaze.instance.SaveSettings();
                    Playing.Instance.LoadLevel(Playing.Instance.levelNum + 1);
                }
                Playing.Instance.exit.drawText = true;
            }
            else
            {
                Playing.Instance.exit.drawText = false;
            }
        }