public override void Update(ContentManager content, GameTime gameTime) { if (isLoaded == false) { isLoaded = true; font = content.Load <SpriteFont>("ps2p"); gameOver = content.Load <Texture2D>("gameover"); } game.AllowMenu = false; if (Keyboard.GetState().IsKeyDown(Keys.Enter) == true) { AIE.StateManager.ChangeState("TitleScreen"); game.ResetInputTimer(); } }
public override void Update(ContentManager content, GameTime gameTime) { if (isLoaded == false) { isLoaded = true; font = content.Load <SpriteFont>("3Dventure"); moon = content.Load <Texture2D>("moon"); map = content.Load <TiledMap>("intro_main"); map2 = content.Load <TiledMap>("intro_effect"); var viewportAdapter = new BoxingViewportAdapter(game.Window, game.GraphicsDevice, ScreenWidth / 2, ScreenHeight / 2); camera = new Camera2D(viewportAdapter); camera.Position = new Vector2(100, 560); foreach (TiledObjectGroup group in map.ObjectGroups) { if (group.Name == "player_spawn") { foreach (TiledObject obj in group.Objects) { player = new Player_Cutscene(this); player.Load(content); player.Position = new Vector2(obj.X + 80, obj.Y); } } if (group.Name == "kitty_spawn") { foreach (TiledObject obj in group.Objects) { kitty = new Kitty_Cutscene(this); kitty.Load(content); kitty.Position = new Vector2(obj.X + 70, obj.Y); } } } fadein = new Effect_FadeIn(this); fadein.Load(content); fadein.Position = new Vector2(0, 300); fadeout = new Effect_FadeOut(this); fadeout.Load(content); fadeout.Position = new Vector2(500, 300); fadeout.Pause(); } float deltaTime = (float)gameTime.ElapsedGameTime.TotalSeconds; player.Update(deltaTime); kitty.Update(deltaTime); fadein.Update(deltaTime); fadeout.Update(deltaTime); if (game.AllowInput == true) { if (Keyboard.GetState().IsKeyDown(Keys.Enter)) { allowSkip = true; game.ResetInputTimer(); } if (allowSkip == true && Keyboard.GetState().IsKeyUp(Keys.Enter)) { skipActive = true; } if (skipActive == true && Keyboard.GetState().IsKeyDown(Keys.Enter)) { CleanUp(); AIE.StateManager.ChangeState("GameState"); game.ResetInputTimer(); } } /*if (Keyboard.GetState().IsKeyDown(Keys.Right)) * camera.Move(new Vector2(300, 0) * deltaTime); * if (Keyboard.GetState().IsKeyDown(Keys.Left)) * camera.Move(new Vector2(-300, 0) * deltaTime); * if (Keyboard.GetState().IsKeyDown(Keys.Down)) * camera.Move(new Vector2(0, 300) * deltaTime); * if (Keyboard.GetState().IsKeyDown(Keys.Up)) * camera.Move(new Vector2(0, -300) * deltaTime);*/ Cutscene(gameTime); }
public override void Update(ContentManager content, GameTime gameTime) { if (isLoaded == false) { isLoaded = true; font = content.Load <SpriteFont>("ps2p"); } if (game.AllowInput == true) { if (showControls == false) { if (Keyboard.GetState().IsKeyDown(Keys.Down)) { switch (mc) { case menuCursor._continue: mc = menuCursor._options; break; case menuCursor._options: mc = menuCursor._controls; break; case menuCursor._controls: mc = menuCursor._exit; break; case menuCursor._exit: mc = menuCursor._continue; break; } game.ResetInputTimer(); } if (Keyboard.GetState().IsKeyDown(Keys.Up)) { switch (mc) { case menuCursor._continue: mc = menuCursor._exit; break; case menuCursor._options: mc = menuCursor._continue; break; case menuCursor._controls: mc = menuCursor._options; break; case menuCursor._exit: mc = menuCursor._controls; break; } game.ResetInputTimer(); } if (mc == menuCursor._continue && Keyboard.GetState().IsKeyDown(Keys.Enter)) { game.ResetInputTimer(); AIE.StateManager.PopState(); } if (mc == menuCursor._options && Keyboard.GetState().IsKeyDown(Keys.Enter)) { game.ResetInputTimer(); AIE.StateManager.ChangeState("OptionsState"); } if (mc == menuCursor._exit && Keyboard.GetState().IsKeyDown(Keys.Enter)) { game.Exit(); } } if (mc == menuCursor._controls && Keyboard.GetState().IsKeyDown(Keys.Enter)) { if (showControls == false) { showControls = true; game.ResetInputTimer(); } else { showControls = false; game.ResetInputTimer(); } } } }
public override void Update(ContentManager Content, GameTime gameTime) { switch (level) { case Level.W1_L1: map = Content.Load <TiledMap>("Level_1"); break; case Level.W1_L2: map = Content.Load <TiledMap>("Level_2"); break; case Level.W1_L3: map = Content.Load <TiledMap>("Level_3"); break; } if (isLoaded == false) { isLoaded = true; ventureFont = Content.Load <SpriteFont>("3Dventure"); psFont = Content.Load <SpriteFont>("ps2p"); //bgm = Content.Load<Song>("sacrifice"); heart = Content.Load <Texture2D>("heart_x16"); var viewportAdapter = new BoxingViewportAdapter(game.Window, game.GraphicsDevice, ScreenWidth, ScreenHeight); camera = new Camera2D(viewportAdapter); camera.Position = new Vector2(0, ScreenHeight); foreach (TiledTileLayer layer in map.TileLayers) { if (layer.Name == "collision") { collisionLayer = layer; } } foreach (TiledObjectGroup group in map.ObjectGroups) { if (group.Name == "player_spawn") { foreach (TiledObject obj in group.Objects) { player = new Player(this); player.Load(Content); player.Position = new Vector2(obj.X, obj.Y); } } if (group.Name == "enemy_spawn") { foreach (TiledObject obj in group.Objects) { Enemy enemy = new Enemy(this); enemy.Load(Content); enemy.Position = new Vector2(obj.X, obj.Y); enemies.Add(enemy); } } if (group.Name == "goal") { foreach (TiledObject obj in group.Objects) { goal = new Goal(this); goal.Load(Content); goal.Position = new Vector2(obj.X, obj.Y); } } if (group.Name == "key") { foreach (TiledObject obj in group.Objects) { key = new Key(this); key.Load(Content); key.Position = new Vector2(obj.X, obj.Y); } } if (group.Name == "lock") { foreach (TiledObject obj in group.Objects) { LockedWall lockedWall = new LockedWall(this); lockedWall.Load(Content); lockedWall.Position = new Vector2(obj.X, obj.Y); lockedWalls.Add(lockedWall); } } if (group.Name == "extralife") { foreach (TiledObject obj in group.Objects) { extralife = new ExtraLife(this); extralife.Load(Content); extralife.Position = new Vector2(obj.X, obj.Y); } } } } if (musicLoad == false) { musicLoad = true; //MediaPlayer.Play(bgm); } keyS = Content.Load <SoundEffect>("keys"); splat = Content.Load <SoundEffect>("splat"); keyInst = keyS.CreateInstance(); splatInst = splat.CreateInstance(); float deltaTime = (float)gameTime.ElapsedGameTime.TotalSeconds; camera.Position = player.Position - new Vector2(ScreenWidth / 2, ScreenHeight / 1.5f); CameraMechanics(); timer -= deltaTime; CheckCollisions(); goal.Update(deltaTime); player.Update(deltaTime); key.Update(deltaTime); extralife.Update(deltaTime); foreach (Enemy e in enemies) { e.Update(deltaTime); e.ParticleUpdate(gameTime); } foreach (LockedWall lw in lockedWalls) { lw.Update(deltaTime); } if (game.AllowInput && game.AllowMenu == true) { if (Keyboard.GetState().IsKeyDown(Keys.Enter)) { AIE.StateManager.PushState("PauseState"); game.ResetInputTimer(); } } if (game.AllowMenu == false) { if (Keyboard.GetState().IsKeyUp(Keys.Enter)) { game.AllowMenu = true; } } }
public override void Update(ContentManager content, GameTime gameTime) { if (isLoaded == false) { isLoaded = true; ps2p = content.Load <SpriteFont>("ps2p"); font04b = content.Load <SpriteFont>("funsize"); kitty = content.Load <Texture2D>("jett_run_x1000"); grass = content.Load <Texture2D>("grass"); aniTimer = 0; runTimer = 0; rotateTimer = 0; } float deltaTime = (float)gameTime.ElapsedGameTime.TotalSeconds; aniTimer += deltaTime; runTimer += deltaTime * 4; rotateTimer += deltaTime * 1.5f; if (aniTimer > 1) { aniTimer = 0; } if (runTimer > 1) { runTimer = 0; } if (rotateTimer > 360) { rotateTimer = 0; } if (game.AllowInput == true) { if (start == true) { if (Keyboard.GetState().IsKeyDown(Keys.Enter) == true) { AIE.StateManager.ChangeState("IntroCutscene"); game.ResetInputTimer(); CleanUp(); } if ((Keyboard.GetState().IsKeyDown(Keys.Down) || Keyboard.GetState().IsKeyDown(Keys.Up))) { start = false; game.ResetInputTimer(); } } else { if (Keyboard.GetState().IsKeyDown(Keys.Enter) == true) { game.Exit(); } if ((Keyboard.GetState().IsKeyDown(Keys.Down) || Keyboard.GetState().IsKeyDown(Keys.Up))) { start = true; game.ResetInputTimer(); } } } }
public override void Update(ContentManager content, GameTime gameTime) { if (isLoaded == false) { isLoaded = true; font = content.Load <SpriteFont>("ps2p"); oc = optionsCursor._sounds; } if (game.AllowInput == true) { if (Keyboard.GetState().IsKeyDown(Keys.Down)) { switch (oc) { case optionsCursor._sounds: oc = optionsCursor._back; break; case optionsCursor._back: oc = optionsCursor._sounds; break; } game.ResetInputTimer(); } if (Keyboard.GetState().IsKeyDown(Keys.Up)) { switch (oc) { case optionsCursor._sounds: oc = optionsCursor._back; break; case optionsCursor._back: oc = optionsCursor._sounds; break; } game.ResetInputTimer(); } if ((oc == optionsCursor._sounds) && (Keyboard.GetState().IsKeyDown(Keys.Right) || Keyboard.GetState().IsKeyDown(Keys.Left))) { if (soundOn == false) { soundOn = true; game.ResetInputTimer(); } else { soundOn = false; game.ResetInputTimer(); } } if (oc == optionsCursor._back && Keyboard.GetState().IsKeyDown(Keys.Enter)) { AIE.StateManager.ChangeState("PauseState"); game.ResetInputTimer(); CleanUp(); } } }