mirror of
https://github.com/MaddyThorson/StrawberryBF.git
synced 2025-12-15 13:27:06 +08:00
Numerics ToString overrides. Moving Solids work. Actor.Pushed
This commit is contained in:
@ -10,6 +10,13 @@ namespace Strawberry
|
||||
Hitbox = hitbox;
|
||||
}
|
||||
|
||||
public override void Update()
|
||||
{
|
||||
base.Update();
|
||||
|
||||
MoveY(0.1f);
|
||||
}
|
||||
|
||||
public override List<Actor> GetRiders(List<Actor> into)
|
||||
{
|
||||
for (var a in Scene.All<Actor>(scope List<Actor>))
|
||||
@ -20,18 +27,74 @@ namespace Strawberry
|
||||
|
||||
public override void MoveExactX(int amount)
|
||||
{
|
||||
if (amount != 0)
|
||||
if (Collidable)
|
||||
{
|
||||
let riders = GetRiders(scope List<Actor>);
|
||||
|
||||
X += amount;
|
||||
Collidable = false;
|
||||
|
||||
for (Actor a in Scene.All<Actor>(scope List<Actor>))
|
||||
{
|
||||
if (Check(a))
|
||||
{
|
||||
//Push
|
||||
int move;
|
||||
if (amount > 0)
|
||||
move = Right - a.Left;
|
||||
else
|
||||
move = Left - a.Right;
|
||||
a.MoveExactX(move, scope => a.Squish, this);
|
||||
a.Pushed += Point.UnitX * move;
|
||||
}
|
||||
else if (riders.Contains(a))
|
||||
{
|
||||
//Carry
|
||||
a.MoveExactX(amount);
|
||||
a.Pushed += Point.UnitX * amount;
|
||||
}
|
||||
}
|
||||
|
||||
Collidable = true;
|
||||
}
|
||||
else
|
||||
X += amount;
|
||||
}
|
||||
|
||||
public override void MoveExactY(int amount)
|
||||
{
|
||||
if (amount != 0)
|
||||
if (Collidable)
|
||||
{
|
||||
let riders = GetRiders(scope List<Actor>);
|
||||
|
||||
Y += amount;
|
||||
Collidable = false;
|
||||
|
||||
for (Actor a in Scene.All<Actor>(scope List<Actor>))
|
||||
{
|
||||
if (Check(a))
|
||||
{
|
||||
//Push
|
||||
int move;
|
||||
if (amount > 0)
|
||||
move = Bottom - a.Top;
|
||||
else
|
||||
move = Top - a.Bottom;
|
||||
a.MoveExactY(move, scope => a.Squish, this);
|
||||
a.Pushed += Point.UnitY * move;
|
||||
}
|
||||
else if (riders.Contains(a))
|
||||
{
|
||||
//Carry
|
||||
a.MoveExactY(amount);
|
||||
a.Pushed += Point.UnitY * amount;
|
||||
}
|
||||
}
|
||||
|
||||
Collidable = true;
|
||||
}
|
||||
else
|
||||
Y += amount;
|
||||
}
|
||||
|
||||
public override void Draw()
|
||||
|
||||
Reference in New Issue
Block a user