diff --git a/DangerousD/GameCore/GameObjects/Entities/SilasBall.cs b/DangerousD/GameCore/GameObjects/Entities/SilasBall.cs index b14d8af..1c11e0e 100644 --- a/DangerousD/GameCore/GameObjects/Entities/SilasBall.cs +++ b/DangerousD/GameCore/GameObjects/Entities/SilasBall.cs @@ -1,7 +1,9 @@ using DangerousD.GameCore.Graphics; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using System; using System.Collections.Generic; + using System.Linq; using System.Text; using System.Threading.Tasks; @@ -10,6 +12,7 @@ namespace DangerousD.GameCore.GameObjects.Entities { public class SilasBall : LivingEntity { + private bool IsVisibility=true; public SilasBall(Vector2 position) : base(position) { Height = 60; @@ -30,7 +33,18 @@ namespace DangerousD.GameCore.GameObjects.Entities public override void Update(GameTime gameTime) { base.Update(gameTime); - + if (AppManager.Instance.GameManager.physicsManager.CheckRectangle(Rectangle).Count>0) + { + IsVisibility = false; + } + } + public override void Draw(SpriteBatch spriteBatch) + { + if (IsVisibility) + { + base.Draw(spriteBatch); + } + } } } diff --git a/DangerousD/GameCore/GameObjects/LivingEntities/Player/Player.cs b/DangerousD/GameCore/GameObjects/LivingEntities/Player/Player.cs index 39b1926..8249673 100644 --- a/DangerousD/GameCore/GameObjects/LivingEntities/Player/Player.cs +++ b/DangerousD/GameCore/GameObjects/LivingEntities/Player/Player.cs @@ -100,7 +100,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities public override void Update(GameTime gameTime) { - GraphicsComponent.CameraPosition = (_pos-new Vector2(200, 350)).ToPoint(); + GraphicsComponent.SetCameraPosition(Pos); if (!isAttacked) { Move(gameTime); diff --git a/DangerousD/GameCore/Graphics/GraphicsComponent.cs b/DangerousD/GameCore/Graphics/GraphicsComponent.cs index e4546b5..f218ba6 100644 --- a/DangerousD/GameCore/Graphics/GraphicsComponent.cs +++ b/DangerousD/GameCore/Graphics/GraphicsComponent.cs @@ -16,6 +16,7 @@ namespace DangerousD.GameCore.Graphics private List textures; private List texturesNames; private AnimationContainer currentAnimation; + static private int scaling=3; public AnimationContainer CurrentAnimation { get @@ -167,6 +168,8 @@ namespace DangerousD.GameCore.Graphics destinationRectangle.X -= CameraPosition.X; destinationRectangle.Y -= CameraPosition.Y; + + destinationRectangle = Scaling(destinationRectangle); _spriteBatch.Draw(texture, destinationRectangle, sourceRectangle, Color.White); } @@ -191,10 +194,18 @@ namespace DangerousD.GameCore.Graphics destinationRectangle.X -= CameraPosition.X; destinationRectangle.Y -= CameraPosition.Y; + destinationRectangle = Scaling(destinationRectangle); _spriteBatch.Draw(texture, destinationRectangle, sourceRectangle, Color.White); } - + private Rectangle Scaling(Rectangle destinationRectangle) + { + destinationRectangle.X *= scaling; + destinationRectangle.Y *= scaling; + destinationRectangle.Width *= scaling; + destinationRectangle.Height *= scaling; + return destinationRectangle; + } private void buildSourceRectangle() { sourceRectangle = new Rectangle(); @@ -222,6 +233,12 @@ namespace DangerousD.GameCore.Graphics interval = lastInterval; } } - public static Point CameraPosition = new Point(0, 0); + public static void SetCameraPosition(Vector2 playerPosition) + { + CameraPosition=(playerPosition).ToPoint(); + CameraPosition.X -= 300; + CameraPosition.Y -= 200; + } + public static Point CameraPosition = new Point(-700, 300); } } diff --git a/DangerousD/GameCore/Managers/AppManager.cs b/DangerousD/GameCore/Managers/AppManager.cs index 9c07648..488442f 100644 --- a/DangerousD/GameCore/Managers/AppManager.cs +++ b/DangerousD/GameCore/Managers/AppManager.cs @@ -26,7 +26,7 @@ namespace DangerousD.GameCore public GameState gameState { get; private set; } public MultiPlayerStatus multiPlayerStatus { get; private set; } = MultiPlayerStatus.SinglePlayer; public Point resolution = new Point(1920, 1080); - public Point inGameResolution = new Point(1366, 768); + public Point inGameResolution = new Point(1920, 1080); IDrawableObject MenuGUI; IDrawableObject OptionsGUI; IDrawableObject LoginGUI;