improved harpoon gun, misc ui stuff & bugfixes

This commit is contained in:
Regalis
2015-05-29 16:29:32 +03:00
parent 80648ffd46
commit 562164af36
27 changed files with 316 additions and 103 deletions
+19 -4
View File
@@ -164,7 +164,7 @@ namespace Subsurface.Items.Components
if (hideItems) return;
Vector2 transformedItemPos;
Vector2 transformedItemPos = itemPos;
Vector2 transformedItemInterval = itemInterval;
float currentRotation = itemRotation;
//float transformedItemRotation = itemRotation;
@@ -177,8 +177,18 @@ namespace Subsurface.Items.Components
{
Matrix transform = Matrix.CreateRotationZ(item.body.Rotation);
transformedItemPos = ConvertUnits.ToDisplayUnits(item.body.Position) + Vector2.Transform(itemPos, transform);
if (item.body.Dir==-1.0f)
{
transformedItemPos.X = -transformedItemPos.X;
transformedItemInterval.X = -transformedItemInterval.X;
}
transformedItemPos = Vector2.Transform(transformedItemPos, transform);
transformedItemInterval = Vector2.Transform(transformedItemInterval, transform);
transformedItemPos += ConvertUnits.ToDisplayUnits(item.body.Position);
currentRotation += item.body.Rotation;
}
@@ -186,8 +196,13 @@ namespace Subsurface.Items.Components
{
if (containedItem == null) continue;
containedItem.sprite.Draw(spriteBatch, new Vector2(transformedItemPos.X, -transformedItemPos.Y), -currentRotation, 1.0f);
containedItem.sprite.Draw(
spriteBatch,
new Vector2(transformedItemPos.X, -transformedItemPos.Y),
-currentRotation,
1.0f,
(item.body != null && item.body.Dir == -1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None);
transformedItemPos += transformedItemInterval;
}
}
+1 -1
View File
@@ -283,7 +283,7 @@ namespace Subsurface.Items.Components
Game1.world.RemoveBody(body.FarseerBody);
linkedGap.Remove();
if (linkedGap!=null) linkedGap.Remove();
doorSprite.Remove();
+2 -2
View File
@@ -137,7 +137,7 @@ namespace Subsurface.Items.Components
private bool OnProjectileCollision(Fixture f1, Fixture f2, Contact contact)
{
//doesn't collide with items
if (f2.Body.UserData is Item) return false;
//if (f2.Body.UserData is Item) return false;
if (ignoredBodies.Contains(f2.Body)) return false;
@@ -219,7 +219,7 @@ namespace Subsurface.Items.Components
stickJoint = new PrismaticJoint(targetBody, item.body.FarseerBody, item.body.Position, axis, true);
stickJoint.MotorEnabled = true;
stickJoint.MaxMotorForce = 15.0f;
stickJoint.MaxMotorForce = 30.0f;
stickJoint.LimitEnabled = true;
stickJoint.UpperLimit = ConvertUnits.ToSimUnits(item.sprite.size.X*0.7f);