protected override void Initialize() { Window.Title = "Felicitas"; //Load tile Textures here. Loading them in LoadContent was causing incorrect behavior, and the textures were not loading properly. #region TextureInitialize BasicTileTexture = Content.Load<Texture2D>("basicTile.dds"); PlayerTexture = Content.Load<Texture2D>("player.dds"); #endregion currentLevel = new FileGenerated(); currentLevel.Generate("MAP.txt"); player = new Player(10, 400, PlayerTexture); base.Initialize(); }
public override bool CheckCollision(Player player) { //throw new Exception("Implement check collision"); float leftA, leftB; float rightA, rightB; float topA, topB; float bottomA, bottomB; leftA = Pos.X * SpriteTexture.Width; rightA = Pos.X * SpriteTexture.Width + SpriteTexture.Width; topA = Pos.Y * SpriteTexture.Height; bottomA = Pos.Y * SpriteTexture.Height + SpriteTexture.Height; leftB = player.Pos.X; rightB = player.Pos.X + player.SpriteTexture.Width; topB = player.Pos.Y; bottomB = player.Pos.Y + player.SpriteTexture.Height; if (bottomA <= topB) { return false; } if (topA >= bottomB) { return false; } if (rightA <= leftB) { return false; } if (leftA >= rightB) { return false; } return true; }
public override bool CheckCollision(Player player) { return false; }
public virtual bool CheckCollision(Player player) { throw new Exception("Implement check collision"); }