Tutorial fixes

This commit is contained in:
Regalis
2015-10-09 17:18:25 +03:00
parent 4120cabd6e
commit 0a96254696
9 changed files with 42 additions and 24 deletions
@@ -33,7 +33,7 @@ namespace Subsurface
}
}
public void SpawnSprites(int count)
public void SpawnSprites(int count, Vector2? position = null)
{
activeSprites.Clear();
@@ -45,17 +45,25 @@ namespace Subsurface
{
Vector2 pos = Vector2.Zero;
if (WayPoint.WayPointList.Count>0)
if (position == null)
{
WayPoint wp = WayPoint.WayPointList[Rand.Int(WayPoint.WayPointList.Count)];
if (WayPoint.WayPointList.Count>0)
{
WayPoint wp = WayPoint.WayPointList[Rand.Int(WayPoint.WayPointList.Count)];
pos = new Vector2(wp.Rect.X, wp.Rect.Y);
pos += Rand.Vector(200.0f);
pos = new Vector2(wp.Rect.X, wp.Rect.Y);
pos += Rand.Vector(200.0f);
}
else
{
pos = Rand.Vector(2000.0f);
}
}
else
{
pos = Rand.Vector(2000.0f);
}
pos = (Vector2)position;
}
var prefab = prefabs[Rand.Int(prefabs.Count)];
@@ -831,7 +831,7 @@ namespace Subsurface
Vector2 bodyVelocity = torso.body.LinearVelocity / 60.0f;
item.body.ResetDynamics();
item.body.SetTransform(MathUtils.SmoothStep(item.body.SimPosition, transformedHoldPos + bodyVelocity, 0.5f), itemAngle);
item.SetTransform(MathUtils.SmoothStep(item.body.SimPosition, transformedHoldPos + bodyVelocity, 0.5f), itemAngle);
for (int i = 0; i < 2; i++)
{