Пример #1
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            Random rand = new Random();


            Grafika.Init(Content, this.GraphicsDevice);
            GlobalAcc.Init();
            Wyposazenie.Inicjalizacja(Content);
            Mapy.Init(this.GraphicsDevice);
            Menu.init();
            Info.init();
            Help.init();
            TestowyFont = Content.Load <SpriteFont>("testfont");

            SpriteAnimated SA = new SpriteAnimated(300, 300, Grafika.Eksplozja3, 60);

            GlobalAcc.ListaAnimacji1.Add(SA);



            // TODO: use this.Content to load your game content here
        }
Пример #2
0
        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.Black);

            spriteBatch.Begin();
            if (GlobalAcc.StanGry == GameState.Game || GlobalAcc.StanGry == GameState.ChangingToGameFromMenuP2)
            {
                Mapy.Rysuj(ref spriteBatch);
                spriteBatch.DrawString(TestowyFont, GlobalAcc.StatekGracza.IloscPkt.ToString(), new Vector2(300f, 0), Color.White);
            }
            if (GlobalAcc.StanGry == GameState.Menu || GlobalAcc.StanGry == GameState.ChangingToInfoFromMenuP1 ||
                GlobalAcc.StanGry == GameState.ChangingToGameFromMenuP1 || GlobalAcc.StanGry == GameState.ChangingToMenuFromInfoP2 ||
                GlobalAcc.StanGry == GameState.ChangingToMenuFromGameP2 || GlobalAcc.StanGry == GameState.ChangingToMenuFromHelpP2 ||
                GlobalAcc.StanGry == GameState.ChangingToHelpFromMenuP1)
            {
                Menu.Rysuj(ref spriteBatch);
            }
            if (GlobalAcc.StanGry == GameState.Info || GlobalAcc.StanGry == GameState.ChangingToInfoFromMenuP2 ||
                GlobalAcc.StanGry == GameState.ChangingToMenuFromInfoP1)
            {
                Info.Rysuj(ref spriteBatch);
            }
            if (GlobalAcc.StanGry == GameState.Help || GlobalAcc.StanGry == GameState.ChangingToHelpFromMenuP2 ||
                GlobalAcc.StanGry == GameState.ChangingToMenuFromHelpP1)
            {
                Help.Rysuj(ref spriteBatch);
            }

            spriteBatch.DrawString(TestowyFont, iloscfps, Vector2.Zero, Color.White);

            spriteBatch.End();


            base.Draw(gameTime);
        }
Пример #3
0
        /// <summary>
        /// Allows the game to run logic such as updating the world,
        /// checking for collisions, gathering input, and playing audio.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Update(GameTime gameTime)
        {
            // Allows the game to exit
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
            {
                this.Exit();
            }

            if (gameTime.IsRunningSlowly)
            {
            }
            TouchCollection TC = TouchPanel.GetState();

            Vector2[] klikniecia = new Vector2[4];
            int       i          = 0;

            foreach (TouchLocation TL in TC)
            {
                if (TL.State == TouchLocationState.Moved)
                {
                    klikniecia[i++] = TL.Position;
                }
            }


            ParticleSystem.Pracuj();
            if (GlobalAcc.StanGry == GameState.Game)
            {
                Mapy.Pracuj(klikniecia, i);
            }


            float elapsed = (float)gameTime.ElapsedGameTime.TotalSeconds;

            deltaFPSTime += elapsed;
            if (deltaFPSTime > 1)
            {
                float fps = 1 / elapsed;
                iloscfps      = "<" + fps.ToString() + ">";
                deltaFPSTime -= 1;
            }


            base.Update(gameTime);
        }
Пример #4
0
        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.Black);

            spriteBatch.Begin();
            if (GlobalAcc.StanGry == GameState.Game)
            {
                Mapy.Rysuj(ref spriteBatch);
                spriteBatch.DrawString(TestowyFont, GlobalAcc.StatekGracza.IloscPkt.ToString(), new Vector2(300f, 0), Color.White);
            }
            if (GlobalAcc.StanGry == GameState.Menu)
            {
                spriteBatch.DrawString(TestowyFont, iloscfps, Vector2.Zero, Color.White);
            }

            spriteBatch.End();


            base.Draw(gameTime);
        }
Пример #5
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            Random rand = new Random();


            Grafika.Init(Content, this.GraphicsDevice);
            GlobalAcc.Init();
            Wyposazenie.Inicjalizacja(Content);
            Mapy.Init(this.GraphicsDevice);

            TestowyFont = Content.Load <SpriteFont>("testfont");



            float[]     pozycjeX = { 100, 100, 400, 400, 100 };
            float[]     pozycjeY = { 100, 300, 300, 100, 100 };
            float []    czas     = { 0f, 20f, 70f, 100f, 120f };
            CurveKey [] KurwyX   = new CurveKey[5];
            CurveKey [] KurwyY   = new CurveKey[5];
            for (int i = 0; i < 5; i++)
            {
                KurwyX[i] = new CurveKey(czas[i], pozycjeX[i]);
                KurwyY[i] = new CurveKey(czas[i], pozycjeY[i]);
            }
            kolizja = new Obiekt(new Vector2(750f, 320f), "GuzikN", Content, 0f);
            GlobalAcc.ListaKolizji.Add(kolizja);
            GlobalAcc.ListaObiektow3.Add(kolizja);


            SpriteAnimated SA = new SpriteAnimated(300, 300, Grafika.Eksplozja3, 60);

            GlobalAcc.ListaAnimacji1.Add(SA);



            // TODO: use this.Content to load your game content here
        }
Пример #6
0
        /// <summary>
        /// Allows the game to run logic such as updating the world,
        /// checking for collisions, gathering input, and playing audio.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Update(GameTime gameTime)
        {
            // Allows the game to exit
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Menu.PrzyciskExit.Pojedyncze_wcisniecie)
            {
                this.Exit();
            }

            if (gameTime.IsRunningSlowly)
            {
            }
            TouchCollection TC = TouchPanel.GetState();

            Vector2[] klikniecia = new Vector2[4];
            int       i          = 0;

            foreach (TouchLocation TL in TC)
            {
                if (TL.State == TouchLocationState.Moved)
                {
                    klikniecia[i++] = TL.Position;
                }
            }


            ParticleSystem.Pracuj();
            if (GlobalAcc.StanGry == GameState.Game)
            {
                Mapy.Pracuj(klikniecia, i);
            }
            if (GlobalAcc.StanGry == GameState.Menu)
            {
                Menu.Pracuj(klikniecia, i);
            }
            if (GlobalAcc.StanGry == GameState.Info)
            {
                Info.Pracuj(klikniecia, i);
            }
            if (GlobalAcc.StanGry == GameState.Help)
            {
                Help.Pracuj(klikniecia, i);
            }

            if (GlobalAcc.StanGry == GameState.ChangingToInfoFromMenuP1 || GlobalAcc.StanGry == GameState.ChangingToGameFromMenuP1 || GlobalAcc.StanGry == GameState.ChangingToHelpFromMenuP1)
            {
                Menu.PracujPrzejscieDo();
            }
            if (GlobalAcc.StanGry == GameState.ChangingToMenuFromInfoP2 || GlobalAcc.StanGry == GameState.ChangingToMenuFromGameP2 ||
                GlobalAcc.StanGry == GameState.ChangingToMenuFromHelpP2)
            {
                Menu.PracujPrzejscieZ();
            }

            if (GlobalAcc.StanGry == GameState.ChangingToInfoFromMenuP2)
            {
                Info.PracujPrzejscieZ();
            }
            if (GlobalAcc.StanGry == GameState.ChangingToHelpFromMenuP2)
            {
                Help.PracujPrzejscieZ();
            }

            if (GlobalAcc.StanGry == GameState.ChangingToMenuFromInfoP1)
            {
                Info.PracujPrzejscieDo();
            }
            if (GlobalAcc.StanGry == GameState.ChangingToMenuFromHelpP1)
            {
                Help.PracujPrzejscieDo();
            }
            if (GlobalAcc.StanGry == GameState.ChangingToGameFromMenuP2)
            {
                Mapy.PrzejscieZ();
            }


            float elapsed = (float)gameTime.ElapsedGameTime.TotalSeconds;

            deltaFPSTime += elapsed;
            if (deltaFPSTime > 1)
            {
                float fps = 1 / elapsed;
                iloscfps      = "<" + fps.ToString() + ">";
                deltaFPSTime -= 1;
            }


            base.Update(gameTime);
        }