Functional level generation + moving the submarine

This commit is contained in:
Regalis
2015-06-26 23:05:51 +03:00
parent bda9b31cbe
commit 9237a9efe2
48 changed files with 1629 additions and 750 deletions

View File

@@ -73,23 +73,23 @@ namespace Subsurface
public virtual void UpdatePlacing(SpriteBatch spriteBatch, Camera cam)
{
Vector2 placeSize = Map.gridSize;
Vector2 placeSize = Submarine.gridSize;
if (placePosition == Vector2.Zero)
{
if (PlayerInput.GetMouseState.LeftButton == ButtonState.Pressed)
placePosition = Map.MouseToWorldGrid(cam);
placePosition = Submarine.MouseToWorldGrid(cam);
}
else
{
Vector2 position = Map.MouseToWorldGrid(cam);
Vector2 position = Submarine.MouseToWorldGrid(cam);
if (resizeHorizontal) placeSize.X = position.X - placePosition.X;
if (resizeVertical) placeSize.Y = placePosition.Y - position.Y;
Rectangle newRect = Map.AbsRect(placePosition, placeSize);
newRect.Width = (int)Math.Max(newRect.Width, Map.gridSize.X);
newRect.Height = (int)Math.Max(newRect.Height, Map.gridSize.Y);
Rectangle newRect = Submarine.AbsRect(placePosition, placeSize);
newRect.Width = (int)Math.Max(newRect.Width, Submarine.gridSize.X);
newRect.Height = (int)Math.Max(newRect.Height, Submarine.gridSize.Y);
if (PlayerInput.GetMouseState.LeftButton == ButtonState.Released)
{