diff --git a/Jumpy.Shared/Camera.cs b/Jumpy.Shared/Camera.cs new file mode 100644 index 0000000..51d88da --- /dev/null +++ b/Jumpy.Shared/Camera.cs @@ -0,0 +1,10 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Jumpy { + class Camera { + public const int Width = (int) (320 * 1.5); + public const int Height = (int) (180 * 1.5); + } +} diff --git a/Jumpy.Shared/Jumpy.Shared.projitems b/Jumpy.Shared/Jumpy.Shared.projitems index 6d43ed9..e3ac01f 100644 --- a/Jumpy.Shared/Jumpy.Shared.projitems +++ b/Jumpy.Shared/Jumpy.Shared.projitems @@ -9,6 +9,7 @@ Jumpy.Shared + diff --git a/Jumpy.Shared/JumpyGame.cs b/Jumpy.Shared/JumpyGame.cs index abfcc78..812d180 100644 --- a/Jumpy.Shared/JumpyGame.cs +++ b/Jumpy.Shared/JumpyGame.cs @@ -29,7 +29,7 @@ namespace Jumpy { display.SetFullScreen(fullScreen); renderTarget = new RenderTarget2D( - GraphicsDevice, 320, 180, false /* mipmap */, + GraphicsDevice, Camera.Width, Camera.Height, false /* mipmap */, GraphicsDevice.PresentationParameters.BackBufferFormat, DepthFormat.Depth24); base.Initialize(); @@ -40,7 +40,6 @@ namespace Jumpy { spriteBatch = new SpriteBatch(GraphicsDevice); font = Content.Load("font"); player = new Player(Content.Load("player_1x")); - } // Called once per game. Unloads all game content. diff --git a/Jumpy.Shared/Player.cs b/Jumpy.Shared/Player.cs index 6aa99b1..f1bb54f 100644 --- a/Jumpy.Shared/Player.cs +++ b/Jumpy.Shared/Player.cs @@ -9,16 +9,15 @@ namespace Jumpy { enum Pose { Walking, Standing, Crouching, Stretching, SwordSwing, Jumping }; enum AirState { Jumping, Ground }; + private Texture2D texture; private const int spriteSize = 48; - private const int spriteWidth = 8; + private const int spriteWidth = 7; private const int moveSpeed = 200; private const int jumpSpeed = 600; private const int gravity = 2000; - private Texture2D texture; + private const int groundLevel = Camera.Height - spriteSize / 2; - // TODO: stop assuming 1920x1080. - private const int groundLevel = 180 - spriteSize / 2 - 10; - private Point position = new Point(200, groundLevel); + private Point position = new Point(Camera.Width / 2, groundLevel); private Facing facing = Facing.Right; private Pose pose = Pose.Standing; private AirState airState = AirState.Ground; @@ -82,7 +81,7 @@ namespace Jumpy { pose = Pose.Jumping; } - position.X = (int) Math.Min(Math.Max(position.X, 0 + spriteWidth), 320 - spriteWidth); + position.X = Math.Min(Math.Max(position.X, 0 + spriteWidth), Camera.Width - spriteWidth); } private Point spritePosition(Pose pose, GameTime time) {