public void update(Gameworld gameWorld, GameTime gameTime) { risse = gameWorld.Risse; Vector2 prePos = risse.Position; parallaxBackground(gameWorld); physicsEngine.gravitation(risse, gameTime); collisionResolution(gameWorld, prePos); risse.update(gameTime); foreach (Gameobject go in gameWorld.Platforms) { go.update(); } //if (!(MediaPlayer.State == MediaState.Playing)) //{ // MediaPlayer.Play(contentHolder.soundtrack); //} //foreach (Gameobject ground in gameWorld.Ground) //{ // ground.update(); //} foreach (List<Gameobject> g in gameWorld.Ground) { foreach (Gameobject obj in g) { obj.update(); } } foreach (Gameobject obj in gameWorld.Collidables) { obj.update(); } //Console.Out.WriteLine(risse.Position); }
public void update(Gameworld gameWorld, GameTime gameTime) { risse = gameWorld.Risse; parallaxBackground(gameWorld); physicsEngine.gravitation(risse, gameTime); collisionResolution(gameWorld, prePos); prePos = new Vector2(risse.BoundingBox.X, risse.BoundingBox.Y); risse.update(gameTime); //foreach (Gameobject go in gameWorld.Platforms) //{ // go.update(); //} gameWorld.updateCheckpointsDone(); if (theState == state.ducking) { if (ducking > 1000) { ducking = 0; theState = state.running; risse.Animation = (int)state.running; } ducking += (float)gameTime.ElapsedGameTime.Milliseconds; } if (theState == state.crash) { if (crashing > 1000) { crashing = 0; theState = state.running; risse.Animation = (int)state.running; } crashing += (float)gameTime.ElapsedGameTime.Milliseconds; } foreach (List<Gameobject> p in gameWorld.Platforms) { foreach (Gameobject obj in p) { obj.update(); } } if (!(MediaPlayer.State == MediaState.Playing)) { MediaPlayer.Play(contentHolder.music_soundtrack); } foreach (Gameobject go in gameWorld.BackgroundFluff) { go.updateFluff(risse, contentHolder); } gameWorld.Platforms[0][0].Position = new Vector2(gameWorld.BackgroundFluff[0].Position.X - gameWorld.Platforms[0][0].Texture.Width, gameWorld.Platforms[0][0].Position.Y); gameWorld.Platforms[0][1].Position = new Vector2(gameWorld.BackgroundFluff[0].Position.X + gameWorld.Platforms[0][1].SpriteWidth, gameWorld.Platforms[0][1].Position.Y); //foreach (Gameobject ground in gameWorld.Ground) //{ // ground.update(); //} foreach (List<Gameobject> g in gameWorld.Ground) { foreach (Gameobject obj in g) { obj.update(); } } foreach (Gameobject obj in gameWorld.Collidables) { obj.update(); } }