private void LoadContent(ref ContentManager contentMan) { normalmapEffect = ScreenManager.contentMan.Load <Effect>("normalmap"); MapEngine.LoadContent(ScreenManager.contentMan); InfoWriter.LoadContent(); MapEngine.NewMap(); MapEngine.LoadMap(); mapLoaded = true; curPlayer = new Player(ref ScreenManager.contentMan, "test_hero", MapEngine.currMap.startPoint, Directions.S, CharacterLoader.LoadCharacter(ref ScreenManager.contentMan, "test_hero", "Player")); curPlayer.MapSprite.texture = ScreenManager.contentMan.Load <Texture2D>(curPlayer.MapSprite.textureName); curPlayer.MapSprite.FrameDimensions = new Point(55, 55); curPlayer.MapSprite.ResetAnimation(); }
public override void HandleInput() { prevPlayerPos = curPlayerPos; if (InputManager.IsActionTriggered(InputManager.Action.Back)) { ScreenManager.AddScreen(new MainMenuStartScreen(Color.Blue, Fonts.normFont, GameMain.VPCenter)); return; } // player input if (InputManager.IsActionPressedTimed(InputManager.Action.MoveCharN, 100)) { if (!VisionHelper.isBlocked(GameSession.curPlayer.tilePosition, 0, -1)) { GameSession.curPlayer.SetMapPosition(0, -55, MapEngine.currMap.widthTiles, MapEngine.currMap.heightTiles); VisionHelper.centerViewport(GameSession.curPlayer.mapPosition); } } if (InputManager.IsActionPressedTimed(InputManager.Action.MoveCharNE, 100)) { if (!VisionHelper.isBlocked(GameSession.curPlayer.tilePosition, 1, -1)) { GameSession.curPlayer.SetMapPosition(55, -55, MapEngine.currMap.widthTiles, MapEngine.currMap.heightTiles); VisionHelper.centerViewport(GameSession.curPlayer.mapPosition); } } if (InputManager.IsActionPressedTimed(InputManager.Action.MoveCharE, 100)) { if (!VisionHelper.isBlocked(GameSession.curPlayer.tilePosition, 1, 0)) { GameSession.curPlayer.SetMapPosition(55, 0, MapEngine.currMap.widthTiles, MapEngine.currMap.heightTiles); VisionHelper.centerViewport(GameSession.curPlayer.mapPosition); } } if (InputManager.IsActionPressedTimed(InputManager.Action.MoveCharSE, 100)) { if (!VisionHelper.isBlocked(GameSession.curPlayer.tilePosition, 1, 1)) { GameSession.curPlayer.SetMapPosition(55, 55, MapEngine.currMap.widthTiles, MapEngine.currMap.heightTiles); VisionHelper.centerViewport(GameSession.curPlayer.mapPosition); } } if (InputManager.IsActionPressedTimed(InputManager.Action.MoveCharS, 100)) { if (!VisionHelper.isBlocked(GameSession.curPlayer.tilePosition, 0, 1)) { GameSession.curPlayer.SetMapPosition(0, 55, MapEngine.currMap.widthTiles, MapEngine.currMap.heightTiles); VisionHelper.centerViewport(GameSession.curPlayer.mapPosition); } } if (InputManager.IsActionPressedTimed(InputManager.Action.MoveCharSW, 100)) { if (!VisionHelper.isBlocked(GameSession.curPlayer.tilePosition, -1, 1)) { GameSession.curPlayer.SetMapPosition(-55, 55, MapEngine.currMap.widthTiles, MapEngine.currMap.heightTiles); VisionHelper.centerViewport(GameSession.curPlayer.mapPosition); } } if (InputManager.IsActionPressedTimed(InputManager.Action.MoveCharW, 100)) { if (!VisionHelper.isBlocked(GameSession.curPlayer.tilePosition, -1, 0)) { GameSession.curPlayer.SetMapPosition(-55, 0, MapEngine.currMap.widthTiles, MapEngine.currMap.heightTiles); VisionHelper.centerViewport(GameSession.curPlayer.mapPosition); } } if (InputManager.IsActionPressedTimed(InputManager.Action.MoveCharNW, 100)) { if (!VisionHelper.isBlocked(GameSession.curPlayer.tilePosition, -1, -1)) { GameSession.curPlayer.SetMapPosition(-55, -55, MapEngine.currMap.widthTiles, MapEngine.currMap.heightTiles); VisionHelper.centerViewport(GameSession.curPlayer.mapPosition); } } // move mapEngineViewport up if (InputManager.IsActionPressedTimed(InputManager.Action.CursorUp, 100)) { MapEngine.MoveMapEngineViewportLocation(0, -55); } // move mapEngineViewport right if (InputManager.IsActionPressedTimed(InputManager.Action.PageRight, 100)) { MapEngine.MoveMapEngineViewportLocation(55, 0); } // move mapEngineViewport down if (InputManager.IsActionPressedTimed(InputManager.Action.CursorDown, 100)) { MapEngine.MoveMapEngineViewportLocation(0, 55); } // move mapEngineViewport left if (InputManager.IsActionPressedTimed(InputManager.Action.PageLeft, 100)) { MapEngine.MoveMapEngineViewportLocation(-55, 0); } //if (InputManager.IsActionTriggered(InputManager.Action.Ok)) // MapEngine.ShowBlankStates = true; // save if (InputManager.IsActionTriggered(InputManager.Action.Save)) { MapEngine.SaveMap(); } // load if (InputManager.IsActionTriggered(InputManager.Action.Load)) { MapEngine.LoadMap(); } // new if (InputManager.IsActionTriggered(InputManager.Action.New)) { MapEngine.NewMap(); MapEngine.LoadMap(); } if (InputManager.IsActionPressedTimed(InputManager.Action.Ok, 100)) { if (!drawingLOS) { drawingLOS = true; } else { drawingLOS = false; VisionHelper.clearLOS(); } } if (InputManager.IsActionTriggered(InputManager.Action.ShowDebug)) { Globals.GetMapData = (Globals.GetMapData) ? false : true; } //if(InputManager.IsActionPressedTimed(InputManager.Action.SpritePrev, 100)) //{ // GameSession.curPlayer.MapSprite. //} curPlayerPos = GameSession.curPlayer.tilePosition; if (drawingLOS) { VisionHelper.drawLOS(); } if (curPlayerPos != prevPlayerPos) { playerMoved = true; } else { playerMoved = false; } }