manlyMiniGames.Map.setViewPos C# (CSharp) Method

setViewPos() public method

Center the screen on the given world coordinate
public setViewPos ( Vector2 pos ) : void
pos Vector2 World Coordinate
return void
        public void setViewPos(Vector2 pos)
        {
            //Move, don't teleport, toward the center position
            center.X += (pos.X - center.X) * 0.1f;
            center.Y += (pos.Y - center.Y) * 0.1f;
        }

Usage Example

Example #1
0
        public void Update(GameTime theGameTime, Map map)
        {
            KeyboardState currentKeyboardState = Keyboard.GetState();
            UpdateMovement(currentKeyboardState);
            UpdateRocket(theGameTime, currentKeyboardState, map);
            mPreviousKeyboardState = currentKeyboardState;

            map.setViewPos(mPosition);

            base.Update(theGameTime, mSpeed, mDirection);
        }
All Usage Examples Of manlyMiniGames.Map::setViewPos