public void Move(CodePlane code, char aheui, bool reversed = false)
{
int height = code.Height;
V.Update(aheui, reversed);
int effSpeed = V.Speed;
switch (V.Direction)
{
case Direction.Up:
effSpeed = -1;
break;
case Direction.Down:
effSpeed = 1;
break;
case Direction.Left:
effSpeed *= -1;
break;
}
if (V.Direction == Direction.Up || V.Direction == Direction.Down)
{
int width;
for (int i = 0; i < V.Speed; i++)
{
do
{
Y += effSpeed;
Y %= height;
if (Y < 0) Y += height;
width = code.WidthAt(Y);
} while (X < 0 || X >= width);
}
}
else
{
int width = code.WidthAt(Y);
X += effSpeed;
X %= width;
if (X < 0) X += width;
}
}