How make camrea follo wplay in gmermaker

broken image
broken image
broken image
broken image

We were scaling all of our Sprites to 1/4 size by specifying a Scale of 0.25f. Next we are going to go through all of our SpriteBatch.Draw( … ) calls and remove all of the hardcoded scale variables. Now everyplace we have a spriteBatch.Draw with float specifying the layer depth like 0.8f, replace it with a static member variable from this class like LayerDepth.Cellsįollow along with all the replacements on the Bitbucket code Removing Sprite Scaling Code Public static readonly float Figures = 0.5f Public static readonly float Paths = 0.6f Public static readonly float Cells = 0.8f We’re going to refactor those into a class so that we don’t have to memorize those numbers.Īdd a new class named LayerDepth.cs with the following code: Refactoring LayerDepthīefore we get started with the camera class, lets fix those magic numbers for the sprite layer depth that we had in all of our SpriteBatch.Draw( … ). This post is in response to a comment from Joe asking how to do this. The camera will also provide the ability to zoom in and out. Additionally when the Player is moving, the camera should always remain centered on the Player. In this tutorial we will add a Camera class to our game that can be manipulated with the keyboard. If you missed part 4 of the tutorial you can find it here: Goal It is meant to serve as an introduction to the RogueSharp library. This is part 5 in a set of tutorials for using RogueSharp and MonoGame to create a basic Roguelike game.

broken image