AddCamera
This commit is contained in:
parent
81dd082141
commit
0ff6c7ddea
2 changed files with 12 additions and 2 deletions
|
@ -47,5 +47,11 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities
|
|||
{
|
||||
velocity.Y = -300;
|
||||
}
|
||||
public override void Update(GameTime gameTime)
|
||||
{
|
||||
GraphicsComponent.CameraPosition = (_pos-new Vector2(200, 350)).ToPoint();
|
||||
velocity.X = 0.5f;
|
||||
base.Update(gameTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -165,7 +165,8 @@ namespace DangerousD.GameCore.Graphics
|
|||
destinationRectangle.Height = (int)(sourceRectangle.Height * scale);
|
||||
}
|
||||
|
||||
|
||||
destinationRectangle.X -= CameraPosition.X;
|
||||
destinationRectangle.Y -= CameraPosition.Y;
|
||||
_spriteBatch.Draw(texture,
|
||||
destinationRectangle, sourceRectangle, Color.White);
|
||||
}
|
||||
|
@ -187,6 +188,8 @@ namespace DangerousD.GameCore.Graphics
|
|||
destinationRectangle.Height = (int)(sourceRectangle.Height * scale);
|
||||
}
|
||||
|
||||
destinationRectangle.X -= CameraPosition.X;
|
||||
destinationRectangle.Y -= CameraPosition.Y;
|
||||
|
||||
_spriteBatch.Draw(texture,
|
||||
destinationRectangle, sourceRectangle, Color.White);
|
||||
|
@ -215,5 +218,6 @@ namespace DangerousD.GameCore.Graphics
|
|||
interval = lastInterval;
|
||||
}
|
||||
}
|
||||
public static Point CameraPosition = new Point(0, 0);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue