/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { spriteBatch = new SpriteBatch(GraphicsDevice); spriteSheet.LoadContent(Content); paddle.LoadContent(Content, spriteSheet.GetSprite("paddle"), spriteSheet.GetSprite("fire_start_left"), spriteSheet.GetSprite("fire_steady_left"), spriteSheet.GetSprite("fire_start_right"), spriteSheet.GetSprite("fire_steady_right")); foreach (Object ball in balls) { ball.LoadContent(Content, spriteSheet.GetSprite("ball")); } foreach (Brick brick in bricks) { Sprite powerup = null; Sprite brickSprite = spriteSheet.GetSprite("brick" + brick.SpriteNum); Sprite crackedSprite = spriteSheet.GetSprite("crackedbrick" + brick.CrackedSpriteNum); if (brick.Powerup != null) { powerup = spriteSheet.GetSprite(brick.Powerup.GetNameByType()); brickSprite.TextureColor = Color.Yellow; } brick.LoadContent(Content, brickSprite, crackedSprite, powerup); } particleTexture = Content.Load <Texture2D>("pixel"); ParticleManager.SetTexture(particleTexture, "smoke"); ParticleManager.SetTexture(particleTexture, "star"); ParticleManager.SetTexture(particleTexture, "debris"); SpawnBall(ballCount, BallSpawnPos); parallax.LoadContent(Content); }
/// <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); ball.LoadContent(Content); paddle.LoadContent(Content); }
/// <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); ball.LoadContent(Content); paddle.LoadContent(Content); Scoreboard = Content.Load <Texture2D>("Scoreboard"); RightScore = Content.Load <Texture2D>("Zero"); LeftScore = Content.Load <Texture2D>("Zero"); paddleRight.LoadContent(Content); }
/// <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 ball.LoadContent(Content); // load in green ball paddle.LoadContent(Content); //load in the pixel paddle AIpaddle.LoadContent(Content); //load in the enemy pixel paddle paddle_Bounce = Content.Load <SoundEffect>("Paddle_Bounce"); // load in paddle bounce sound spriteFont = Content.Load <SpriteFont>("Font"); }
/// <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); font = Content.Load <SpriteFont>("Points"); coinPickupSFX = Content.Load <SoundEffect>("coinPickupSound"); // TODO: use this.Content to load your game content here ball.LoadContent(Content); coin.LoadContent(Content); paddle.LoadContent(Content); smokeTexture = Content.Load <Texture2D>("smoke"); smokeParticleSystem = new ParticleSystem(GraphicsDevice, 1000, smokeTexture); smokeParticleSystem.SpawnPerFrame = 4; // Set the SpawnParticle method smokeParticleSystem.SpawnParticle = (ref Particle particle) => { particle.Position = new Vector2(ball.bounds.X, ball.bounds.Y); particle.Velocity = new Vector2( MathHelper.Lerp(-50, 50, (float)rand.NextDouble()), // X between -50 and 50 MathHelper.Lerp(0, 100, (float)rand.NextDouble()) // Y between 0 and 100 ); particle.Acceleration = 0.1f * new Vector2(0, (float)-rand.NextDouble()); particle.Color = Color.Gold; particle.Scale = 1f; particle.Life = 1.0f; }; // Set the UpdateParticle method smokeParticleSystem.UpdateParticle = (float deltaT, ref Particle particle) => { particle.Velocity += deltaT * particle.Acceleration; particle.Position += deltaT * particle.Velocity; particle.Scale -= deltaT; particle.Life -= deltaT; }; //////////////////COIN coinSparkTexture = Content.Load <Texture2D>("pixelYellow"); coinParticleSystem = new ParticleSystem(GraphicsDevice, 1000, coinSparkTexture); coinParticleSystem.SpawnPerFrame = 4; // Set the SpawnParticle method coinParticleSystem.SpawnParticle = (ref Particle particle) => { particle.Position = new Vector2(coin.bounds.X, coin.bounds.Y); particle.Velocity = new Vector2( MathHelper.Lerp(-70, 70, (float)rand.NextDouble()), // X between -50 and 50 MathHelper.Lerp(60, -60, (float)rand.NextDouble()) // Y between 0 and 100 ); particle.Acceleration = 0.1f * new Vector2(0, (float)-rand.NextDouble() / 2); particle.Color = Color.Gold; particle.Scale = 2f; particle.Life = 0.85f; }; // Set the UpdateParticle method coinParticleSystem.UpdateParticle = (float deltaT, ref Particle particle) => { particle.Velocity += deltaT * particle.Acceleration / 10; particle.Position += deltaT * particle.Velocity; particle.Scale -= deltaT; particle.Life -= deltaT; }; ///////////////////PLAYER TRAIL playerParticleTexture = Content.Load <Texture2D>("pixelWhite"); playerParticleSystem = new ParticleSystem(GraphicsDevice, 1000, playerParticleTexture); playerParticleSystem.SpawnPerFrame = 16; // Set the SpawnParticle method playerParticleSystem.SpawnParticle = (ref Particle particle) => { particle.Position = new Vector2(paddle.bounds.X, paddle.bounds.Y); particle.Velocity = new Vector2( MathHelper.Lerp(-5, 5, (float)rand.NextDouble()), // X between -50 and 50 MathHelper.Lerp(-5, 5, (float)rand.NextDouble()) // Y between 0 and 100 ); particle.Acceleration = 0.1f * new Vector2(0, (float)-rand.NextDouble()); particle.Color = Color.Gold; particle.Scale = 2f; particle.Life = 2.0f; }; // Set the UpdateParticle method playerParticleSystem.UpdateParticle = (float deltaT, ref Particle particle) => { particle.Velocity += deltaT * particle.Acceleration; particle.Position += deltaT * particle.Velocity; particle.Scale -= deltaT; particle.Life -= deltaT; }; var backgroundTexture = Content.Load <Texture2D>("mountainBACK1"); var backgroundSprite = new StaticSprite(backgroundTexture); var backgroundLayer = new ParallaxLayer(this); backgroundLayer.Sprites.Add(backgroundSprite); backgroundLayer.DrawOrder = 0; Components.Add(backgroundLayer); var cloudTexture = Content.Load <Texture2D>("clouds2"); var cloudSprite = new StaticSprite(cloudTexture); var cloudLayer = new ParallaxLayer(this); cloudLayer.Sprites.Add(cloudSprite); cloudLayer.DrawOrder = 1; Components.Add(cloudLayer); var landTexture = Content.Load <Texture2D>("land3"); var landSprite = new StaticSprite(landTexture); var landLayer = new ParallaxLayer(this); landLayer.Sprites.Add(landSprite); landLayer.DrawOrder = 2; Components.Add(landLayer); var topBTexture = Content.Load <Texture2D>("topbleachers4"); var topBSprite = new StaticSprite(topBTexture); var topBLayer = new ParallaxLayer(this); topBLayer.Sprites.Add(topBSprite); topBLayer.DrawOrder = 3; Components.Add(topBLayer); var midBTexture = Content.Load <Texture2D>("middlebleachers5"); var midBSprite = new StaticSprite(midBTexture); var midBLayer = new ParallaxLayer(this); midBLayer.Sprites.Add(midBSprite); midBLayer.DrawOrder = 4; Components.Add(midBLayer); var botBTexture = Content.Load <Texture2D>("bottombleachers6"); var botBSprite = new StaticSprite(botBTexture); var botBLayer = new ParallaxLayer(this); botBLayer.Sprites.Add(botBSprite); botBLayer.DrawOrder = 5; Components.Add(botBLayer); backgroundLayer.ScrollController = new PlayerTrackingScrollController(paddle, 0.1f); cloudLayer.ScrollController = new PlayerTrackingScrollController(paddle, 0.2f); landLayer.ScrollController = new PlayerTrackingScrollController(paddle, 0.4f); topBLayer.ScrollController = new PlayerTrackingScrollController(paddle, 0.6f); midBLayer.ScrollController = new PlayerTrackingScrollController(paddle, 0.8f); botBLayer.ScrollController = new PlayerTrackingScrollController(paddle, 1.0f); }