Esempio n. 1
0
        public void prepNewTerrain(screen scr = screen.LEVEL1)
        {
            Random random = new Random();

            stop      = false;
            curScreen = scr;
            lines.Clear();
            vertexList.Clear();
            indexList.Clear();
            polygonPoints.Clear();
            vertexTri           = new VertexPositionColor[] { };
            indexTri            = new int[] { };
            transitionTime      = 0;
            landingZone1.point1 = new Point();
            landingZone1.point2 = new Point();
            landingZone2.point1 = new Point();
            landingZone2.point2 = new Point();
            lander               = new Lander();
            lander.position      = new Vector2(random.Next((int)(screenWidth * 0.15), (int)(screenWidth * 0.85)), (float)(screenHeight * 0.1));
            lander.velocity      = 0;
            lander.fuel          = scr == screen.LEVEL1 ? 100 : 50;
            lander.angle         = (float)random.Next(0, 6);
            winner               = false;
            crashed              = false;
            gravitationalForce   = 0;
            horizontalMomentum   = 0;
            lastIteration        = DateTime.Now;
            particleEmitterSmoke = new ParticleEmitter(
                Content,
                new TimeSpan(0, 0, 0, 0, 2),
                (int)lander.position.X,
                (int)lander.position.Y,
                20,
                200,
                new TimeSpan(0, 0, 2),
                new TimeSpan(0, 0, 0, 3000));
            particleEmitterFire = new ParticleEmitter(
                Content,
                new TimeSpan(0, 0, 0, 0, 10),
                (int)lander.position.X,
                (int)lander.position.Y,
                40,
                300,
                new TimeSpan(0, 0, 0, 0, 1000),
                new TimeSpan(0, 0, 0, 0, 800));
        }
Esempio n. 2
0
        public Game1()
        {
            polygonPoints                       = new List <Point>();
            collisionPoint                      = new Point();
            keyPressed                          = false;
            winner                              = false;
            stop                                = false;
            emitParticles                       = false;
            themePlaying                        = false;
            crashed                             = false;
            changingKey                         = false;
            lander                              = new Lander();
            lines                               = new List <Point>();
            vertexList                          = new List <VertexPositionColor>();
            indexList                           = new List <int>();
            soundEffects                        = new List <SoundEffect>();
            _graphics                           = new GraphicsDeviceManager(this);
            _graphics.IsFullScreen              = true;
            _graphics.PreferredBackBufferWidth  = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width;
            _graphics.PreferredBackBufferHeight = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height;
            _graphics.ApplyChanges();
            curScreen             = screen.MAIN;
            Content.RootDirectory = "Content";
            IsMouseVisible        = true;
            s = 0.2;
            landingZoneWidth   = 100;
            gravitationalForce = 0;
            horizontalMomentum = 0;
            screenWidth        = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width;
            screenHeight       = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height;
            random             = new Random();

            LoadKeys();
            LoadScores();
            rotLeft  = KeyConfig[1];
            rotRight = KeyConfig[2];
            thrust   = KeyConfig[0];

            myMenu = new Menu(Content, screenWidth, screenHeight, thrust, rotRight, rotLeft);
        }