Beispiel #1
0
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);
            font_damage = Content.Load <SpriteFont>("Font");

            scrollingBackgroundManager.AddBackground("Street_2", "Street_2", new Vector2(0, 0), new Rectangle(0, 0, 1065, 644), 70, 0.5f, Color.White);
            // scrollingBackgroundManager.AddBackground("street", "Street", new Vector2(0, 0), new Rectangle(0, 0, 1065, 392), 70, 0.5f, Color.White);
            scrollingBackgroundManager.AddBackground("road", "Road", new Vector2(0, 390), new Rectangle(0, 0, 1066, 356), 100, 0.1f, Color.White);

            death     = Content.Load <Texture2D>("death");
            font_life = Content.Load <SpriteFont>("Font");

            foreach (Sprite sprite in sprites)
            {
                sprite.Load(spriteBatch, font_damage, font_life);
            }

            // player.death = this.death;
        }
Beispiel #2
0
        protected override void LoadContent()
        {
            int viewportWidth  = GraphicsDevice.Viewport.Width;
            int viewportHeight = GraphicsDevice.Viewport.Height;

            int textureWidth     = 1024;
            int cloudHeight      = 512;
            int cityHeight       = 256;
            int foregroundHeight = 128;
            int streetHeight     = 128;
            int cloudY           = 0;
            int streetY          = cloudHeight;
            int foregroundY      = streetY + streetHeight;
            int cityY            = foregroundY + foregroundHeight;

            sbm.SetScrollRate(-75.0f); //75 pixels a second

            sbm.AddBackground("clouds1", "background",
                              Vector2.Zero,
                              new Rectangle(0, cloudY, textureWidth, cloudHeight),
                              0.4f, Color.White);

            sbm.AddBackground("clouds2", "background",
                              new Vector2(128, 0),
                              new Rectangle(0, cloudY, textureWidth, cloudHeight),
                              0.6f, new Color(255, 255, 255, 127));

            sbm.AddBackground("street", "background",
                              new Vector2(0, viewportHeight - streetHeight),
                              new Rectangle(0, streetY, textureWidth, streetHeight),
                              1.0f, Color.White);

            sbm.AddBackground("foreground", "background",
                              new Vector2(0, viewportHeight - foregroundHeight),
                              new Rectangle(0, foregroundY, textureWidth, foregroundHeight),
                              1.5f, Color.White);

            sbm.AddBackground("city", "background",
                              new Vector2(0, viewportHeight - cityHeight - streetHeight + 32),
                              new Rectangle(0, cityY, textureWidth, cityHeight),
                              0.8f, Color.White);
        }
 private void LoadBG()
 {
     scrollingBackgroundManager.AddBackground("space", "backgroundSpace", new Vector2(0, 0), new Rectangle(0, 0, 1024, 1024), 30, 0.5f, Color.White);
     scrollingBackgroundManager.AddBackground("space2", "backgroundSpace", new Vector2(0, 1023), new Rectangle(0, 0, 1024, 1024), 30, 0.5f, Color.White);
     scrollingBackgroundManager.AddBackground("space3", "backgroundSpace", new Vector2(0, 2047), new Rectangle(0, 0, 1024, 1024), 30, 0.5f, Color.White);
 }