public override void LoadContent() { graphics = ScreenManager.GraphicsDevice; spriteBatch = new SpriteBatch(graphics); ContentManager Content = ScreenManager.Game.Content; FloorBackgroundL = new ScrollBackground(); CloudBackgroundL = new ScrollBackground(); BackgroundL = new ScrollBackground(); floorL = Content.Load <Texture2D>("Textures\\Floor"); cloudsL = Content.Load <Texture2D>("Textures\\CloudsLong"); sunL = Content.Load <Texture2D>("Textures\\SunBig"); backl = Content.Load <Texture2D>("Textures\\1280lbg"); FloorBackgroundD = new ScrollBackground(); CloudBackgroundD = new ScrollBackground(); BackgroundD = new ScrollBackground(); floorD = Content.Load <Texture2D>("Textures\\dfloor"); cloudsD = Content.Load <Texture2D>("Textures\\DarkCloudsLong"); sunD = Content.Load <Texture2D>("Textures\\MoonBig"); backd = Content.Load <Texture2D>("Textures\\1280dbg"); pit = Content.Load <Texture2D>("Textures\\pitfall1"); FloorBackgroundL.Load(graphics, floorL, 760); CloudBackgroundL.Load(graphics, cloudsL, 150); BackgroundL.Load(graphics, backl, 357); FloorBackgroundD.Load(graphics, floorD, 760); CloudBackgroundD.Load(graphics, cloudsD, 150); BackgroundD.Load(graphics, backd, 357); base.LoadContent(); }
public void Update(ScrollBackground sb) { if (Input.WasKeyPressedGame(Keys.Right)) { screenpos.X -= 3; } else if (Input.WasKeyPressedGame(Keys.Left) && sb.scrollStop > 0) { screenpos.X += 3; } }
public void Update(GameTime gameTime, ScrollBackground sb) { screenPos += velocity; if (screenPos.X < startingPos.X - 100) { velocity.X = 2; } else if (screenPos.X > startingPos.X + 200) { velocity.X = -2; } if (Input.WasKeyPressedGame(Keys.Right)) { screenPos.X -= 3; startingPos.X -= 3; } else if (Input.WasKeyPressedGame(Keys.Left) && sb.scrollStop > 0) { screenPos.X += 3; startingPos.X += 3; } secsPassed += gameTime.ElapsedGameTime.Milliseconds; if (secsPassed >= secsPerUpdate) { if (Globals.Instance.light) { currentFrame++; currentFrame %= frames; sourceRect.X = (currentFrame % columns) * sourceRect.Width; sourceRect.Y = ((currentFrame / columns) * sourceRect.Height) + 65; secsPassed = 0; } else { currentFrame++; currentFrame %= frames; sourceRect.X = (currentFrame % columns) * sourceRect.Width; sourceRect.Y = (currentFrame / columns) * sourceRect.Height; secsPassed = 0; } } }
public void Update(GameTime gameTime, ScrollBackground sb) { if (Input.WasKeyPressedGame(Keys.Right)) { screenPos.X -= 3; } else if (Input.WasKeyPressedGame(Keys.Left) && sb.scrollStop > 0) { screenPos.X += 3; } secsPassed += gameTime.ElapsedGameTime.Milliseconds; if (secsPassed >= secsPerUpdate) { currentFrame++; currentFrame %= frames; sourceRect.X = (currentFrame % columns) * sourceRect.Width; sourceRect.Y = ((currentFrame / columns) * sourceRect.Height); secsPassed = 0; } }
public override void LoadContent() { graphics = ScreenManager.GraphicsDevice; spriteBatch = new SpriteBatch(graphics); ContentManager Content = ScreenManager.Game.Content; FloorBackgroundL = new ScrollBackground(); CloudBackgroundL = new ScrollBackground(); BackgroundL = new ScrollBackground(); floorL = Content.Load<Texture2D>("Textures\\Floor"); cloudsL = Content.Load<Texture2D>("Textures\\CloudsLong"); sunL = Content.Load<Texture2D>("Textures\\SunBig"); backl = Content.Load<Texture2D>("Textures\\1280lbg"); FloorBackgroundD = new ScrollBackground(); CloudBackgroundD = new ScrollBackground(); BackgroundD = new ScrollBackground(); floorD = Content.Load<Texture2D>("Textures\\dfloor"); cloudsD = Content.Load<Texture2D>("Textures\\DarkCloudsLong"); sunD = Content.Load<Texture2D>("Textures\\MoonBig"); backd = Content.Load<Texture2D>("Textures\\1280dbg"); pit = Content.Load<Texture2D>("Textures\\pitfall1"); FloorBackgroundL.Load(graphics, floorL, 760); CloudBackgroundL.Load(graphics, cloudsL, 150); BackgroundL.Load(graphics, backl, 357); FloorBackgroundD.Load(graphics, floorD, 760); CloudBackgroundD.Load(graphics, cloudsD, 150); BackgroundD.Load(graphics, backd, 357); base.LoadContent(); }