예제 #1
0
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        protected override void LoadContent()
        {
            //textures
            ship         = Content.Load <Texture2D>("Images/ship");
            testTile     = Content.Load <Texture2D>("Images/tile");
            asteroid     = Content.Load <Texture2D>("Images/asteroid");
            enemy        = Content.Load <Texture2D>("Images/enemy");
            laserTex     = Content.Load <Texture2D>("Images/laser");
            planet       = Content.Load <Texture2D>("Images/planet");
            star         = Content.Load <Texture2D>("Images/star");
            minimap_ship = Content.Load <Texture2D>("Images/minimap_ship");
            minimap_star = Content.Load <Texture2D>("Images/minimap_star");
            font         = Content.Load <SpriteFont>("File");
            bigFont      = Content.Load <SpriteFont>("BiggerFont");

            soundEffects.Add(Content.Load <SoundEffect>("Sounds/music"));

            startButton   = new Button(Content.Load <Texture2D>("Images/startButton"), null, 20, viewport.Height - 40, 50, 20);
            exitButton    = new Button(Content.Load <Texture2D>("Images/exitButton"), null, 90, viewport.Height - 40, 50, 20);
            optionsButton = new Button(Content.Load <Texture2D>("Images/optionsButton"), null, 160, viewport.Height - 40, 50, 20);

            buttonList.Add(startButton);
            buttonList.Add(exitButton);
            buttonList.Add(optionsButton);

            graphics.PreferredBackBufferWidth  = GraphicsDevice.DisplayMode.Width;
            graphics.PreferredBackBufferHeight = GraphicsDevice.DisplayMode.Height;
            graphics.IsFullScreen = true;
            graphics.ApplyChanges();

            var instance = soundEffects[0].CreateInstance();

            instance.IsLooped = true;
            instance.Play();

            player = new PlayerShip(new Vector2(world.getSizeX() / 2, world.getSizeY() / 2));
            //bob = new AI(MAP_WIDTH / 2, MAP_HEIGHT / 2 + 100);
            objects.Add(player);
            //objects.Add(bob);
            players.Add(player);
        }
예제 #2
0
파일: Game1.cs 프로젝트: AlanTheLlama/Space
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);

            movingObjects = new List <MovingObject>();

            //textures
            ship     = Content.Load <Texture2D>("Images/ship");
            testTile = Content.Load <Texture2D>("Images/tile");
            asteroid = Content.Load <Texture2D>("Images/asteroid");
            enemy    = Content.Load <Texture2D>("Images/enemy");
            font     = Content.Load <SpriteFont>("File");
            laserTex = Content.Load <Texture2D>("Images/laser");

            player = new PlayerShip(new Vector2(world.SizeX / 2, world.SizeY / 2));
            movingObjects.Add(player);

            bob = new AI(7500, 7500);

            viewport = GraphicsDevice.Viewport;
            cam      = new Camera(viewport, player);
        }