public void Reset() { position = new Vector3(-2000, 10.0f, -2000); Direction = Vector3.Forward; Up = Vector3.Up; right = Vector3.Right; rotation = Vector3.Zero; modelRotation = Vector3.Zero; scale = Vector3.One * 15; acceleration = Vector3.Zero; velocity = Vector3.Zero; properties = main.currentBallProperties; }
public Ball(GamePlayScreen main, GraphicsDevice device, string path) { this.main = main; this.path = path; graphicsDevice = device; position = new Vector3(-2500, 10.0f, -2500); Direction = Vector3.Forward; Up = Vector3.Up; right = Vector3.Right; rotation = Vector3.Zero; modelRotation = Vector3.Zero; scale = Vector3.One * 15; acceleration = Vector3.Zero; velocity = Vector3.Zero; properties = main.currentBallProperties; }
/// <summary> /// Allows the game to run logic such as updating the world, /// checking for collisions, gathering input, and playing audio. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> override public void Update(GameTime gameTime) { timeInMillis += gameTime.ElapsedGameTime.Milliseconds; LevelTime -= gameTime.ElapsedGameTime.Milliseconds; if (LevelTime < 0 || ball.position.Y <= pitHeight) { Sound.pauseSound("Sound\\" + this.level, content); GameOver startOver = new GameOver(); startOver.Level = this.level; startOver.Name = this.name; ScreenManager.AddScreen(startOver); } lastKeyboardState = currentKeyboardState; lastGamePadState = currentGamePadState; lastMousState = currentMouseState; currentKeyboardState = Keyboard.GetState(); currentGamePadState = GamePad.GetState(PlayerIndex.One); currentMouseState = Mouse.GetState(); Int32 middleX = device.Viewport.Bounds.Width / 2; Int32 middleY = device.Viewport.Bounds.Height / 2;; #if XBOX // Exit when the Escape key or Back button is pressed if (currentGamePadState.Buttons.Back == ButtonState.Pressed) { ScreenManager.RemoveScreen(this); } if (!ball.onGround && currentGamePadState.IsButtonDown(Buttons.B) && !lastGamePadState.IsButtonDown(Buttons.B)) { ball.dash(); } else if (currentGamePadState.IsButtonDown(Buttons.A) && !lastGamePadState.IsButtonDown(Buttons.A)) { if (ball.onGround && !ball.jumpDelayTimer.IsRunning) { //ball.dashDelayTimer.Start(); ball.jump(); } } if (currentGamePadState.DPad.Down == ButtonState.Pressed) { Vector3 offset = camera.DesiredPositionOffset; offset.Y = MathHelper.Clamp(offset.Y += 2, 20, 150); if (Math.Abs(offset.Y - camera.DesiredPositionOffset.Y) > 0.0001) { Sound.playSoundOnce("Sound\\rotateCam", content); } camera.DesiredPositionOffset = offset; } else if (currentGamePadState.DPad.Up == ButtonState.Pressed) { Vector3 offset = camera.DesiredPositionOffset; offset.Y = MathHelper.Clamp(offset.Y -= 2, 20, 150); if (Math.Abs(offset.Y - camera.DesiredPositionOffset.Y) > 0.0001) { Sound.playSoundOnce("Sound\\rotateCam", content); } camera.DesiredPositionOffset = offset; } if (currentGamePadState.IsButtonDown(Buttons.LeftShoulder) && !lastGamePadState.IsButtonDown(Buttons.LeftShoulder)) { if (currentBallProperties.Equals(beachBallProperties)) { currentBallProperties = airBallProperties; } else if (currentBallProperties.Equals(airBallProperties)) { currentBallProperties = metalBallProperties; } else if (currentBallProperties.Equals(metalBallProperties)) { currentBallProperties = beachBallProperties; } Sound.playSoundOnce(currentBallProperties.ChangeToSound, content); } else if (currentGamePadState.IsButtonDown(Buttons.RightShoulder) && !lastGamePadState.IsButtonDown(Buttons.RightShoulder)) { if (currentBallProperties.Equals(beachBallProperties)) { currentBallProperties = metalBallProperties; } else if (currentBallProperties.Equals(metalBallProperties)) { currentBallProperties = airBallProperties; } else if (currentBallProperties.Equals(airBallProperties)) { currentBallProperties = beachBallProperties; } Sound.playSoundOnce(currentBallProperties.ChangeToSound, content); } else if (currentGamePadState.IsButtonDown(Buttons.Back) && !lastGamePadState.IsButtonDown(Buttons.Back)) { Sound.pauseSound(background, content); ScreenManager.AddScreen(new MainMenu()); } if (currentGamePadState.IsButtonDown(Buttons.RightStick) && !lastGamePadState.IsButtonDown(Buttons.RightStick)) { ball.Reset(); camera.Reset(); } #endif #if WINDOWS // Exit when the Escape key or Back button is pressed if (currentKeyboardState.IsKeyDown(Keys.Escape) || currentGamePadState.Buttons.Back == ButtonState.Pressed) { ScreenManager.RemoveScreen(this); } if (!ball.onGround && !lastKeyboardState.IsKeyDown(Keys.Space) && currentKeyboardState.IsKeyDown(Keys.Space)) { ball.dash(); } else if (currentKeyboardState.IsKeyDown(Keys.Space)) { if (ball.onGround && !ball.jumpDelayTimer.IsRunning) { //ball.dashDelayTimer.Start(); ball.jump(); } } if (currentKeyboardState.IsKeyDown(Keys.I) || (currentMouseState.RightButton == ButtonState.Pressed) && (currentMouseState.Y > middleY)) { Vector3 offset = camera.DesiredPositionOffset; offset.Y = MathHelper.Clamp(offset.Y += 2, 20, 150); if (Math.Abs(offset.Y - camera.DesiredPositionOffset.Y) > 0.0001) { Sound.playSoundOnce("Sound\\rotateCam", content, 0.5f); } camera.DesiredPositionOffset = offset; } else if (currentKeyboardState.IsKeyDown(Keys.K) || (currentMouseState.RightButton == ButtonState.Pressed) && (currentMouseState.Y <= middleY)) { Vector3 offset = camera.DesiredPositionOffset; offset.Y = MathHelper.Clamp(offset.Y -= 2, 20, 150); if (Math.Abs(offset.Y - camera.DesiredPositionOffset.Y) > 0.0001) { Sound.playSoundOnce("Sound\\rotateCam", content, 0.5f); } camera.DesiredPositionOffset = offset; } if (currentKeyboardState.IsKeyDown(Keys.Q) && !lastKeyboardState.IsKeyDown(Keys.Q)) { if (currentBallProperties.Equals(beachBallProperties)) { currentBallProperties = airBallProperties; } else if (currentBallProperties.Equals(airBallProperties)) { currentBallProperties = metalBallProperties; } else if (currentBallProperties.Equals(metalBallProperties)) { currentBallProperties = beachBallProperties; } Sound.playSoundOnce(currentBallProperties.ChangeToSound, content); } else if (currentKeyboardState.IsKeyDown(Keys.E) && !lastKeyboardState.IsKeyDown(Keys.E)) { if (currentBallProperties.Equals(beachBallProperties)) { currentBallProperties = metalBallProperties; } else if (currentBallProperties.Equals(metalBallProperties)) { currentBallProperties = airBallProperties; } else if (currentBallProperties.Equals(airBallProperties)) { currentBallProperties = beachBallProperties; } Sound.playSoundOnce(currentBallProperties.ChangeToSound, content); } else if (currentKeyboardState.IsKeyDown(Keys.M)) { Sound.pauseSound(background, content); ScreenManager.AddScreen(new MainMenu()); } if (currentKeyboardState.IsKeyDown(Keys.Z)) { System.Diagnostics.Debug.WriteLine(ball.position); } bool touchTopLeft = currentMouseState.LeftButton == ButtonState.Pressed && lastMousState.LeftButton != ButtonState.Pressed && currentMouseState.X < device.Viewport.Width / 10 && currentMouseState.Y < device.Viewport.Height / 10; if (currentKeyboardState.IsKeyDown(Keys.R) || currentGamePadState.Buttons.RightStick == ButtonState.Pressed) { ball.Reset(); camera.Reset(); } #endif ArrowRotation = RotateToFace(ball.position, ExitPosition, Vector3.Up); ExitRotation = RotateToFace(ExitPosition, ball.position, Vector3.Up); if (ExitBox.Contains(ball.position) == ContainmentType.Contains || currentKeyboardState.IsKeyDown(Keys.P)) { long nowTicks = DateTime.Now.Ticks; #if WINDOWS sendScore(name, level, (int)(LevelTime), nowTicks); #endif VictoryScreen victoryScreen = new VictoryScreen(); victoryScreen.Level = this.level; victoryScreen.Name = this.name; victoryScreen.Ticks = nowTicks; ScreenManager.AddScreen(victoryScreen); } //Test stuff if (heightMap.IsOnHeightmap(ball.position)) { heightMap.GetHeightAndNormal(ball.position, out h, out norm); norm.Normalize(); h = Vector3.Dot(new Vector3(0, 1, 0), norm); a = Math.Acos(h); //a = getSignedAngle(new Vector3(0, 1, 0), norm); b = Math.Atan2(norm.Y, norm.X); } for (int x = 0; x < coinList.Count; x++) { coinList[x].Update(gameTime); if (coinList[x].detectIntersection(ball.position)) { LevelTime += 5000f; Sound.playSoundOnce("Sound\\ding", content); coinList.RemoveAt(x); } } for (int x = 0; x < teleporterList.Count; x++) { teleporterList[x].Update(gameTime); if (teleporterList[x].detectIntersection(ball.position)) { Sound.playSoundOnce("Sound\\pop", content); ball.position = new Vector3(RandomNumber(-2500, 3000), 0, RandomNumber(-2500, 3000)); } } ball.properties = currentBallProperties; ball.Update(gameTime); camera.ChasePosition = ball.position; camera.ChaseDirection = ball.Direction; camera.Up = ball.Up; camera.Reset(); particleEngine.EmitterLocation = new Vector2(Mouse.GetState().X, Mouse.GetState().Y); particleEngine.Update(); base.Update(gameTime); }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> override public void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(device); spriteFont = content.Load <SpriteFont>("Arial"); camera = new ChaseCamera(heightMap); // Set the camera offsets camera.DesiredPositionOffset = new Vector3(0.0f, 100.0f, 200.0f); camera.LookAtOffset = new Vector3(0f, 15.0f, 30.0f); ball = new Ball(this, device, "Models\\balltest"); ball.scale = Vector3.One * 15f; camera.NearPlaneDistance = 10.0f; camera.FarPlaneDistance = 100000.0f; camera.AspectRatio = (float)device.Viewport.Width / device.Viewport.Height; camera.ChasePosition = ball.position; camera.ChaseDirection = ball.Direction; camera.Up = ball.Up; camera.Reset(); ballModel = content.Load <Model>("Models\\balltest"); pitModel = content.Load <Model>("Models\\ground"); boxModel = content.Load <Model>("Models\\cube"); arrowModel = content.Load <Model>("Models\\arrow"); exitModel = content.Load <Model>("Models\\exit2"); //exitModelText = content.Load<Model>("Models\\exitSign"); ballTextureBeach = content.Load <Texture2D>("Textures\\beach"); ballTextureMetal = content.Load <Texture2D>("Textures\\metal"); ballTextureAir = content.Load <Texture2D>("Textures\\air"); coinTexture = content.Load <Texture2D>("Textures\\coin"); teleporterTexture = content.Load <Texture2D>("Textures\\teleporter"); terrainModel = content.Load <Model>(terrain); rockTexture = content.Load <Texture2D>(terrainTexture); pitTextureLava = content.Load <Texture2D>("Textures\\lava"); pitTextureIce = content.Load <Texture2D>("Textures\\3"); scoreboardTexture = content.Load <Texture2D>("Textures\\highscores"); heightMap = terrainModel.Tag as HeightMapInfo; if (heightMap == null) { string message = "The terrain model did not have a HeightMapInfo"; throw new InvalidOperationException(message); } Sound.playSoundLoop(background, content); effect = content.Load <Effect>("Lighting/Effects"); sky = content.Load <Sky>("Textures\\sky"); /*Initialize properties for each ball*/ beachBallProperties = new BallProperties(ballTextureBeach, 1.0f, 0.5f, 900f, 1f, new Vector3(0.97f, 1f, 0.97f), new Vector3(1f, 1f, 1f), "Sound\\jump", "Sound\\jump", "Sound\\changeBall"); metalBallProperties = new BallProperties(ballTextureMetal, 3.0f, 0.15f, 750f, 3f, new Vector3(0.95f, 1f, 0.95f), new Vector3(1f, 1f, 1f), "Sound\\jump", "Sound\\jump", "Sound\\changeBall"); airBallProperties = new BallProperties(ballTextureAir, 1f, 0.05f, 1200f, 0.8f, new Vector3(0.99f, 0.99f, 0.99f), new Vector3(0.99f, 0.99f, 0.99f), "Sound\\jump", "Sound\\jump", "Sound\\changeBall"); currentBallProperties = beachBallProperties; List <Texture2D> textures = new List <Texture2D>(); textures.Add(Content.Load <Texture2D>("Textures\\circle")); textures.Add(Content.Load <Texture2D>("Textures\\star")); textures.Add(Content.Load <Texture2D>("Textures\\diamond")); particleEngine = new ParticleEngine(textures, new Vector2(100, 40)); //ExitPosition = new Vector3(1405.1f, .90952f, -2367.78f); ExitPosition = new Vector3(2000, 0f, 2000); ExitPosition.Y = getHeight(ExitPosition) + 50f; ExitBox = new BoundingBox(ExitPosition - new Vector3(50, 50, 50), ExitPosition + new Vector3(50, 50, 50)); for (int x = 0; x < 50; x++) { Vector3 Pos = new Vector3(RandomNumber(-2000, 2000), 0, RandomNumber(-2000, 2000)); //Vector3 Pos = new Vector3(0, 0, 0); Vector3 Normal; float Height; heightMap.GetHeightAndNormal(Pos, out Height, out Normal); Pos.Y = Height + 20; //System.Diagnostics.Debug.WriteLine(Pos); coinList.Add(new Coin(Pos, content)); } for (int x = 0; x < 20; x++) { Vector3 Pos = new Vector3(RandomNumber(-2500, 3000), 0, RandomNumber(-2500, 3000)); Vector3 Normal = new Vector3(); float Height = 10; heightMap.GetHeightAndNormal(Pos, out Height, out Normal); Pos.Y = Height + 50; //System.Diagnostics.Debug.WriteLine(Pos); teleporterList.Add(new teleporter(Pos, content)); } }
/// <summary> /// Allows the game to run logic such as updating the world, /// checking for collisions, gathering input, and playing audio. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> public override void Update(GameTime gameTime) { timeInMillis += gameTime.ElapsedGameTime.Milliseconds; LevelTime -= gameTime.ElapsedGameTime.Milliseconds; if (LevelTime < 0 || ball.position.Y <= pitHeight) { Sound.pauseSound("Sound\\" + this.level, content); GameOver startOver = new GameOver(); startOver.Level = this.level; startOver.Name = this.name; ScreenManager.AddScreen(startOver); } lastKeyboardState = currentKeyboardState; lastGamePadState = currentGamePadState; lastMousState = currentMouseState; currentKeyboardState = Keyboard.GetState(); currentGamePadState = GamePad.GetState(PlayerIndex.One); currentMouseState = Mouse.GetState(); Int32 middleX = device.Viewport.Bounds.Width / 2; Int32 middleY = device.Viewport.Bounds.Height / 2; ; #if XBOX // Exit when the Escape key or Back button is pressed if (currentGamePadState.Buttons.Back == ButtonState.Pressed) { ScreenManager.RemoveScreen(this); } if (!ball.onGround && currentGamePadState.IsButtonDown(Buttons.B) && !lastGamePadState.IsButtonDown(Buttons.B)) { ball.dash(); } else if (currentGamePadState.IsButtonDown(Buttons.A) && !lastGamePadState.IsButtonDown(Buttons.A)) if (ball.onGround && !ball.jumpDelayTimer.IsRunning) { //ball.dashDelayTimer.Start(); ball.jump(); } if (currentGamePadState.DPad.Down == ButtonState.Pressed) { Vector3 offset = camera.DesiredPositionOffset; offset.Y = MathHelper.Clamp(offset.Y += 2, 20, 150); if (Math.Abs(offset.Y - camera.DesiredPositionOffset.Y) > 0.0001) Sound.playSoundOnce("Sound\\rotateCam", content); camera.DesiredPositionOffset = offset; } else if (currentGamePadState.DPad.Up == ButtonState.Pressed) { Vector3 offset = camera.DesiredPositionOffset; offset.Y = MathHelper.Clamp(offset.Y -= 2, 20, 150); if (Math.Abs(offset.Y - camera.DesiredPositionOffset.Y) > 0.0001) Sound.playSoundOnce("Sound\\rotateCam", content); camera.DesiredPositionOffset = offset; } if (currentGamePadState.IsButtonDown(Buttons.LeftShoulder) && !lastGamePadState.IsButtonDown(Buttons.LeftShoulder)) { if (currentBallProperties.Equals(beachBallProperties)) currentBallProperties = airBallProperties; else if (currentBallProperties.Equals(airBallProperties)) currentBallProperties = metalBallProperties; else if (currentBallProperties.Equals(metalBallProperties)) currentBallProperties = beachBallProperties; Sound.playSoundOnce(currentBallProperties.ChangeToSound, content); } else if (currentGamePadState.IsButtonDown(Buttons.RightShoulder) && !lastGamePadState.IsButtonDown(Buttons.RightShoulder)) { if (currentBallProperties.Equals(beachBallProperties)) currentBallProperties = metalBallProperties; else if (currentBallProperties.Equals(metalBallProperties)) currentBallProperties = airBallProperties; else if (currentBallProperties.Equals(airBallProperties)) currentBallProperties = beachBallProperties; Sound.playSoundOnce(currentBallProperties.ChangeToSound, content); } else if (currentGamePadState.IsButtonDown(Buttons.Back) && !lastGamePadState.IsButtonDown(Buttons.Back)) { Sound.pauseSound(background, content); ScreenManager.AddScreen(new MainMenu()); } if (currentGamePadState.IsButtonDown(Buttons.RightStick) && !lastGamePadState.IsButtonDown(Buttons.RightStick)) { ball.Reset(); camera.Reset(); } #endif #if WINDOWS // Exit when the Escape key or Back button is pressed if (currentKeyboardState.IsKeyDown(Keys.Escape) || currentGamePadState.Buttons.Back == ButtonState.Pressed) { ScreenManager.RemoveScreen(this); } if (!ball.onGround && !lastKeyboardState.IsKeyDown(Keys.Space) && currentKeyboardState.IsKeyDown(Keys.Space)) { ball.dash(); } else if (currentKeyboardState.IsKeyDown(Keys.Space)) if (ball.onGround && !ball.jumpDelayTimer.IsRunning) { //ball.dashDelayTimer.Start(); ball.jump(); } if (currentKeyboardState.IsKeyDown(Keys.I) || (currentMouseState.RightButton == ButtonState.Pressed) && (currentMouseState.Y > middleY)) { Vector3 offset = camera.DesiredPositionOffset; offset.Y = MathHelper.Clamp(offset.Y += 2, 20, 150); if (Math.Abs(offset.Y - camera.DesiredPositionOffset.Y) > 0.0001) Sound.playSoundOnce("Sound\\rotateCam", content, 0.5f); camera.DesiredPositionOffset = offset; } else if (currentKeyboardState.IsKeyDown(Keys.K) || (currentMouseState.RightButton == ButtonState.Pressed) && (currentMouseState.Y <= middleY)) { Vector3 offset = camera.DesiredPositionOffset; offset.Y = MathHelper.Clamp(offset.Y -= 2, 20, 150); if (Math.Abs(offset.Y - camera.DesiredPositionOffset.Y) > 0.0001) Sound.playSoundOnce("Sound\\rotateCam", content, 0.5f); camera.DesiredPositionOffset = offset; } if (currentKeyboardState.IsKeyDown(Keys.Q) && !lastKeyboardState.IsKeyDown(Keys.Q)) { if (currentBallProperties.Equals(beachBallProperties)) currentBallProperties = airBallProperties; else if (currentBallProperties.Equals(airBallProperties)) currentBallProperties = metalBallProperties; else if (currentBallProperties.Equals(metalBallProperties)) currentBallProperties = beachBallProperties; Sound.playSoundOnce(currentBallProperties.ChangeToSound, content); } else if (currentKeyboardState.IsKeyDown(Keys.E) && !lastKeyboardState.IsKeyDown(Keys.E)) { if (currentBallProperties.Equals(beachBallProperties)) currentBallProperties = metalBallProperties; else if (currentBallProperties.Equals(metalBallProperties)) currentBallProperties = airBallProperties; else if (currentBallProperties.Equals(airBallProperties)) currentBallProperties = beachBallProperties; Sound.playSoundOnce(currentBallProperties.ChangeToSound, content); } else if (currentKeyboardState.IsKeyDown(Keys.M)) { Sound.pauseSound(background, content); ScreenManager.AddScreen(new MainMenu()); } if (currentKeyboardState.IsKeyDown(Keys.Z)) { System.Diagnostics.Debug.WriteLine(ball.position); } bool touchTopLeft = currentMouseState.LeftButton == ButtonState.Pressed && lastMousState.LeftButton != ButtonState.Pressed && currentMouseState.X < device.Viewport.Width / 10 && currentMouseState.Y < device.Viewport.Height / 10; if (currentKeyboardState.IsKeyDown(Keys.R) || currentGamePadState.Buttons.RightStick == ButtonState.Pressed) { ball.Reset(); camera.Reset(); } #endif ArrowRotation = RotateToFace(ball.position, ExitPosition, Vector3.Up); ExitRotation = RotateToFace(ExitPosition, ball.position, Vector3.Up); if (ExitBox.Contains(ball.position) == ContainmentType.Contains || currentKeyboardState.IsKeyDown(Keys.P)) { long nowTicks = DateTime.Now.Ticks; #if WINDOWS sendScore(name, level, (int)(LevelTime), nowTicks); #endif VictoryScreen victoryScreen = new VictoryScreen(); victoryScreen.Level = this.level; victoryScreen.Name = this.name; victoryScreen.Ticks = nowTicks; ScreenManager.AddScreen(victoryScreen); } //Test stuff if (heightMap.IsOnHeightmap(ball.position)) { heightMap.GetHeightAndNormal(ball.position, out h, out norm); norm.Normalize(); h = Vector3.Dot(new Vector3(0, 1, 0), norm); a = Math.Acos(h); //a = getSignedAngle(new Vector3(0, 1, 0), norm); b = Math.Atan2(norm.Y, norm.X); } for (int x = 0; x < coinList.Count; x++) { coinList[x].Update(gameTime); if (coinList[x].detectIntersection(ball.position)) { LevelTime += 5000f; Sound.playSoundOnce("Sound\\ding", content); coinList.RemoveAt(x); } } for (int x = 0; x < teleporterList.Count; x++) { teleporterList[x].Update(gameTime); if (teleporterList[x].detectIntersection(ball.position)) { Sound.playSoundOnce("Sound\\pop", content); ball.position = new Vector3(RandomNumber(-2500, 3000), 0, RandomNumber(-2500, 3000)); } } ball.properties = currentBallProperties; ball.Update(gameTime); camera.ChasePosition = ball.position; camera.ChaseDirection = ball.Direction; camera.Up = ball.Up; camera.Reset(); particleEngine.EmitterLocation = new Vector2(Mouse.GetState().X, Mouse.GetState().Y); particleEngine.Update(); base.Update(gameTime); }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> public override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(device); spriteFont = content.Load<SpriteFont>("Arial"); camera = new ChaseCamera(heightMap); // Set the camera offsets camera.DesiredPositionOffset = new Vector3(0.0f, 100.0f, 200.0f); camera.LookAtOffset = new Vector3(0f, 15.0f, 30.0f); ball = new Ball(this, device, "Models\\balltest"); ball.scale = Vector3.One * 15f; camera.NearPlaneDistance = 10.0f; camera.FarPlaneDistance = 100000.0f; camera.AspectRatio = (float)device.Viewport.Width / device.Viewport.Height; camera.ChasePosition = ball.position; camera.ChaseDirection = ball.Direction; camera.Up = ball.Up; camera.Reset(); ballModel = content.Load<Model>("Models\\balltest"); pitModel = content.Load<Model>("Models\\ground"); boxModel = content.Load<Model>("Models\\cube"); arrowModel = content.Load<Model>("Models\\arrow"); exitModel = content.Load<Model>("Models\\exit2"); //exitModelText = content.Load<Model>("Models\\exitSign"); ballTextureBeach = content.Load<Texture2D>("Textures\\beach"); ballTextureMetal = content.Load<Texture2D>("Textures\\metal"); ballTextureAir = content.Load<Texture2D>("Textures\\air"); coinTexture = content.Load<Texture2D>("Textures\\coin"); teleporterTexture = content.Load<Texture2D>("Textures\\teleporter"); terrainModel = content.Load<Model>(terrain); rockTexture = content.Load<Texture2D>(terrainTexture); pitTextureLava = content.Load<Texture2D>("Textures\\lava"); pitTextureIce = content.Load<Texture2D>("Textures\\3"); scoreboardTexture = content.Load<Texture2D>("Textures\\highscores"); heightMap = terrainModel.Tag as HeightMapInfo; if (heightMap == null) { string message = "The terrain model did not have a HeightMapInfo"; throw new InvalidOperationException(message); } Sound.playSoundLoop(background, content); effect = content.Load<Effect>("Lighting/Effects"); sky = content.Load<Sky>("Textures\\sky"); /*Initialize properties for each ball*/ beachBallProperties = new BallProperties(ballTextureBeach, 1.0f, 0.5f, 900f, 1f, new Vector3(0.97f, 1f, 0.97f), new Vector3(1f, 1f, 1f), "Sound\\jump", "Sound\\jump", "Sound\\changeBall"); metalBallProperties = new BallProperties(ballTextureMetal, 3.0f, 0.15f, 750f, 3f, new Vector3(0.95f, 1f, 0.95f), new Vector3(1f, 1f, 1f), "Sound\\jump", "Sound\\jump", "Sound\\changeBall"); airBallProperties = new BallProperties(ballTextureAir, 1f, 0.05f, 1200f, 0.8f, new Vector3(0.99f, 0.99f, 0.99f), new Vector3(0.99f, 0.99f, 0.99f), "Sound\\jump", "Sound\\jump", "Sound\\changeBall"); currentBallProperties = beachBallProperties; List<Texture2D> textures = new List<Texture2D>(); textures.Add(Content.Load<Texture2D>("Textures\\circle")); textures.Add(Content.Load<Texture2D>("Textures\\star")); textures.Add(Content.Load<Texture2D>("Textures\\diamond")); particleEngine = new ParticleEngine(textures, new Vector2(100, 40)); //ExitPosition = new Vector3(1405.1f, .90952f, -2367.78f); ExitPosition = new Vector3(2000, 0f, 2000); ExitPosition.Y = getHeight(ExitPosition) + 50f; ExitBox = new BoundingBox(ExitPosition - new Vector3(50, 50, 50), ExitPosition + new Vector3(50, 50, 50)); for (int x = 0; x < 50; x++) { Vector3 Pos = new Vector3(RandomNumber(-2000, 2000), 0, RandomNumber(-2000, 2000)); //Vector3 Pos = new Vector3(0, 0, 0); Vector3 Normal; float Height; heightMap.GetHeightAndNormal(Pos, out Height, out Normal); Pos.Y = Height + 20; //System.Diagnostics.Debug.WriteLine(Pos); coinList.Add(new Coin(Pos, content)); } for (int x = 0; x < 20; x++) { Vector3 Pos = new Vector3(RandomNumber(-2500, 3000), 0, RandomNumber(-2500, 3000)); Vector3 Normal = new Vector3(); float Height = 10; heightMap.GetHeightAndNormal(Pos, out Height, out Normal); Pos.Y = Height + 50; //System.Diagnostics.Debug.WriteLine(Pos); teleporterList.Add(new teleporter(Pos, content)); } }