Exemple #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);

            // TODO: use this.Content to load your game content here

            // Carregando as imagens do jogo
            {
                //Imagem de background
                Textures.Add("back", Content.Load<Texture2D>("back"));

                //Imagens do ufo1
                Textures.Add("ufo1", Content.Load<Texture2D>("Sprites/ufo1"));
                Textures.Add("exp1", Content.Load<Texture2D>("Sprites/exp1"));

                //Imagens do ufo2
                Textures.Add("ufo2", Content.Load<Texture2D>("Sprites/ufo2"));
                Textures.Add("exp2", Content.Load<Texture2D>("Sprites/exp2"));

                //Imagens do ufo3
                Textures.Add("ufo3", Content.Load<Texture2D>("Sprites/ufo3"));
                Textures.Add("exp3", Content.Load<Texture2D>("Sprites/exp3"));

                //Imagens da nave (ship)
                Textures.Add("ship", Content.Load<Texture2D>("Sprites/ship"));
                Textures.Add("shipexp", Content.Load<Texture2D>("Sprites/shipexp"));

                //Imagens do tiro
                Textures.Add("shoot1", Content.Load<Texture2D>("Sprites/shoot1"));
                Textures.Add("shoot2", Content.Load<Texture2D>("Sprites/shoot2"));
                Fonts.Add("vida", Content.Load<SpriteFont>("vida"));
            }

            //Carregando os sons do jogo
            {
                SoundEffects.Add("blaster", Content.Load<SoundEffect>("Sounds/blaster"));
                SoundEffects.Add("blub", Content.Load<SoundEffect>("Sounds/blub"));
                SoundEffects.Add("explosion", Content.Load<SoundEffect>("Sounds/explosion"));
                SoundEffects.Add("gameover", Content.Load<SoundEffect>("Sounds/gameover"));
                SoundEffects.Add("getextra", Content.Load<SoundEffect>("Sounds/getextra"));
                SoundEffects.Add("ship", Content.Load<SoundEffect>("Sounds/ship"));
                SoundEffects.Add("skid", Content.Load<SoundEffect>("Sounds/skid"));
                SoundEffects.Add("tap", Content.Load<SoundEffect>("Sounds/tap"));
                SoundEffects.Add("ufoshoot", Content.Load<SoundEffect>("Sounds/ufoshoot"));
                SoundEffects.Add("weaponchange", Content.Load<SoundEffect>("Sounds/weaponchange"));
            }

            Background back1 = new Background(this, new Vector2(-000, -000), Textures["back"]);
            Background back2 = new Background(this, new Vector2(-000, -800), Textures["back"]);
            GameObjects.Add(back1);
            GameObjects.Add(back2);

            ship = new Ship(this, new Vector2((Window.ClientBounds.Width - Textures["ship"].Width / 5) / 2,
                                                    (Window.ClientBounds.Height - Textures["ship"].Height / 5)),
                                 Textures["ship"], SoundEffects["ship"]);
            GameObjects.Add(ship);

            Ufo ufo = new Ufo(this, new Vector2(GameHelper.RandomNext(Window.ClientBounds.Width - 70), -70),
                                    Textures["ufo1"], velocidade_nivel, 1);
            GameObjects.Add(ufo);
        }
Exemple #2
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            base.Initialize();

            ParticleManager = new ParticleManager<ParticleState>(1024 * 20, ParticleState.UpdateParticle);

            //EntityManager.Add(Planet.Instance);
            Background Background = new Background();
            EntityManager.Add(Background);

            // spawns the level and the planets
            LevelSpawner Level = new LevelSpawner(45);
            TeamManager.GenerateTeams(Level, 2);
            Level.Spawn();

            //Console.WriteLine("in main starting thread");
            ServerThread.Start();
            //Console.WriteLine("back to main");
            //inputserver.StartListening();
        }