forked from s425077/PotatoPlan
Fix
This commit is contained in:
parent
c17adf52cd
commit
e4d2086bf9
@ -5,7 +5,7 @@ class HandleRotation
|
|||||||
{
|
{
|
||||||
int rotationSpeed = 5, Rotation = 180;
|
int rotationSpeed = 5, Rotation = 180;
|
||||||
private float oldSpeed, movementSpeed;
|
private float oldSpeed, movementSpeed;
|
||||||
private Vector2 oldTile;
|
private Vector2 oldTile, oldPosition;
|
||||||
|
|
||||||
public Vector2 UpdatePosition(int Destination, float tractorSpeed, Vector2 Position, Crops crops)
|
public Vector2 UpdatePosition(int Destination, float tractorSpeed, Vector2 Position, Crops crops)
|
||||||
{
|
{
|
||||||
@ -14,7 +14,7 @@ class HandleRotation
|
|||||||
{
|
{
|
||||||
Position = new Vector2((int)Math.Round(Position.X), (int)Math.Round(Position.Y));
|
Position = new Vector2((int)Math.Round(Position.X), (int)Math.Round(Position.Y));
|
||||||
}
|
}
|
||||||
if (Destination == 0)
|
if (Destination == 0) // down
|
||||||
{
|
{
|
||||||
if (Rotation == 0)
|
if (Rotation == 0)
|
||||||
{
|
{
|
||||||
@ -37,7 +37,7 @@ class HandleRotation
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (Destination == 1)
|
else if (Destination == 1) // up
|
||||||
{
|
{
|
||||||
if (Rotation == 180)
|
if (Rotation == 180)
|
||||||
{
|
{
|
||||||
@ -57,7 +57,7 @@ class HandleRotation
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (Destination == 2)
|
else if (Destination == 2) // right
|
||||||
{
|
{
|
||||||
if (Rotation == 270)
|
if (Rotation == 270)
|
||||||
{
|
{
|
||||||
@ -80,7 +80,7 @@ class HandleRotation
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (Destination == 3)
|
else if (Destination == 3) // left
|
||||||
{
|
{
|
||||||
if (Rotation == 90)
|
if (Rotation == 90)
|
||||||
{
|
{
|
||||||
@ -105,6 +105,7 @@ class HandleRotation
|
|||||||
|
|
||||||
}
|
}
|
||||||
oldSpeed = crops.getSpeedFactor(tractorSpeed);
|
oldSpeed = crops.getSpeedFactor(tractorSpeed);
|
||||||
|
oldPosition = Position;
|
||||||
return Position;
|
return Position;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ class Tractor
|
|||||||
Spacing = input.getSpacing();
|
Spacing = input.getSpacing();
|
||||||
Position = housePos;
|
Position = housePos;
|
||||||
TargetPosition = new Vector2(house.X, house.Y);
|
TargetPosition = new Vector2(house.X, house.Y);
|
||||||
smartTractor.init();
|
smartTractor.init(new Vector2(house.X, house.Y));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Runs when the tractor reaches a tile
|
// Runs when the tractor reaches a tile
|
||||||
|
@ -46,9 +46,10 @@ class SmartTractor
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void init()
|
public void init(Vector2 nHousePos)
|
||||||
{
|
{
|
||||||
ai.init();
|
ai.init();
|
||||||
|
housePos = nHousePos;
|
||||||
farm.init(new Vector2(100, (GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height / tileSize) - 125 / tileSize), housePos / (tileSize + Spacing));
|
farm.init(new Vector2(100, (GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height / tileSize) - 125 / tileSize), housePos / (tileSize + Spacing));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user