From 5af50f8d3b53ba53efbc601f14ddf607658bb285 Mon Sep 17 00:00:00 2001 From: BOTLester <58360400+BOTLester@users.noreply.github.com> Date: Mon, 4 May 2020 01:17:10 +0200 Subject: [PATCH] added rotation and rotation cost, RC for T2 --- Game1/Content/Content.mgcb | 12 ++ Game1/Content/Markers.png | Bin 0 -> 578 bytes Game1/Content/Tractor.png | Bin 573 -> 1183 bytes Game1/Game1.cs | 31 ++++- Game1/Game1.csproj | 1 + Game1/Sources/Crops/Crops.cs | 2 +- Game1/Sources/Objects/Tractor.cs | 129 +++++++++++++++++- Game1/Sources/Pathing/A-Star/Astar.cs | 42 ++++-- .../Sources/Pathing/A-Star/PathSaver/Nodes.cs | 4 +- Game1/Sources/Smart/SmartTractor.cs | 7 +- 10 files changed, 197 insertions(+), 31 deletions(-) create mode 100644 Game1/Content/Markers.png diff --git a/Game1/Content/Content.mgcb b/Game1/Content/Content.mgcb index be7215e..0b600c6 100644 --- a/Game1/Content/Content.mgcb +++ b/Game1/Content/Content.mgcb @@ -44,6 +44,18 @@ /processorParam:TextureFormat=Color /build:house.png +#begin Markers.png +/importer:TextureImporter +/processor:TextureProcessor +/processorParam:ColorKeyColor=255,0,255,255 +/processorParam:ColorKeyEnabled=True +/processorParam:GenerateMipmaps=False +/processorParam:PremultiplyAlpha=True +/processorParam:ResizeToPowerOfTwo=False +/processorParam:MakeSquare=False +/processorParam:TextureFormat=Color +/build:Markers.png + #begin Mountain.png /importer:TextureImporter /processor:TextureProcessor diff --git a/Game1/Content/Markers.png b/Game1/Content/Markers.png new file mode 100644 index 0000000000000000000000000000000000000000..947c42cfd38bdca81af6d1c229f750396fd45720 GIT binary patch literal 578 zcmV-I0=@l-P)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGmbN~PnbOGLGA9w%&0oO@HK~!i%)!M;r z!!Qhm;UshPRP@jVx8B#pgG-6wpM3GMx|4R(y!Y{NHAjtLi>E(Wz zd;5Hyuj2Oo@iSljcbi|Qwr@r&HUA2Tq9Tvx-T_fGWNzLh5Jf@e=ERwD%N;DEBTG0m zZ7?FT28WhgG!n8FhgQ#E1f&Lsc8AQ!NG%Q}Ptg&PEjW|}qLGlTICKa^BOom}lm((Q zkyack0?`>r4;-ojqMk@E9I6JQ9!O6dQUMVY>5W5bAYvdHIMf70o=6rBH3N|cl8Hkm zAhICYICOpfdS8B3vsA)t2kwDG<_$`vp&miKaL8?gQfZU9ym82FgHr2|3>gM z2DJm{5T2WK0k&?V2ht3*-fC>5324PhOk^|A3n#IVO+as)#6YTnES%(xQ~}vI$rD)( z?1huOkX69mILQN91fGSHtjH|zY@B349s)^AOBh>JJ&)e QXaE2J07*qoM6N<$f-v0Xw*UYD literal 0 HcmV?d00001 diff --git a/Game1/Content/Tractor.png b/Game1/Content/Tractor.png index 479d069e36efc6b9f8db53f9d23e5f1f0733fe8f..d0b8c062b2fe701a4d366845291564e6f2a3276b 100644 GIT binary patch delta 1134 zcmV-!1d;o_1fL0zKz{=KNkl~3_zbfU6<93NnM$ijoAx{BPN+)K!oRM z@1MdjB$s6Pcy)KX-M&77Wkmn<=uX719^IM6OQOl|a=BcuR~ZaB91h3hk&W5Lb42U? zJhP3biHhP3KaUts&_%Qo!Yaqaq_fuP}OC{`}49J$C0<|1cB z!&r=*PNx?w1%ePNOcBP9MRS&mC=RJl6o{^7DO9ElMCpi5zwIWy{t#uzSaK$BHr-hT z`Z=r%KGaUOAEMiqQ$RFV)Th=DLD8(&b;uP}MSb77vaLkJqN=Fr`&Q)?!lK5l->RH~ zFDhi$=y#(NH4Ajxz6-wl-J8k0-1$hEihq7$&7u~{*`Xi)cbIBi*=0}@-b@@e|KG%gF81oX+nC2~mnOfOrd?SDnzXnL)XNEA1$$HwI z`b4oPIc5JH71yd`8sA#??9#(zn!#!?i`qfp3MLP-<~t|WsLH|ILE zEGR<35|;cebhq1?KR(IL2q`dNm-{T;Y6fP$^joMP2}qXH1u>SHI+PhSAjd_H{<=KU z`XN}3#F_}vq*t1t$OKU!D4`e8B}k>BP}O=vYGrvbgy1Jna#CAL^6hgbdrOq zet*i>*I&5uqO%y!HmU#s002ovPDHLkV1m3nKx|032*MyhmlYvB!vQjR_GB%0ZB|- zXqm4Sm9){;W&@IO^t1!I-IkU-p%B#y%pv(y3oX3|n}utzbJHs&5mG9lKq$~Nn!snV z3-;sPVzCIdqLSmZ(bnk?$yg+%5{iWaGv$12(D?_0^?L1QTr6@{D=`?Hj-d0!C};Z_ zT&{I8ndCgHRWvDDvu*nuevNA7NY)|%oUZCYSbZ2b*7D19X*2i2wiq07*qoM6N<$g1R6j AR{#J2 delta 520 zcmbQwxtC>vLp=j$fk$L91A|Zr2s7SGldoW4V7%n%;uwsUb>T{zIpeIP=6W_+XNiXb?1yI5U+4R1d#0$v`;_E+olTW9 zvL{-$Hi(Pe%<9xzdV!;l{%ISp6WsSn?p9}Z%lbX-WsjsDYQJANcZb`LQ`H&jAgO+S-LUVE_#6$n z%;4ljcF%L$9x%09*@x-n9b|3FD#@7ix_e`^;t#o56F63716eC%W(ll06xRA6#a?IC z>J6ca7FYRvA|zyk_BI#hu2~WFo yc#WKLzERn?2TvzN_ZzS4xLAIEj%L4gpZwC7tgW3f)n*Jp;OXk;vd$@iu?YYtLF!xp diff --git a/Game1/Game1.cs b/Game1/Game1.cs index b87c073..e9478bc 100644 --- a/Game1/Game1.cs +++ b/Game1/Game1.cs @@ -16,9 +16,11 @@ namespace Game1 private Texture2D[] tile = new Texture2D[5]; private Texture2D tractor; private Texture2D house; + private Texture2D markers; private Tractor tractorUnit = new Tractor(); private Input input = new Input(); private House houseUnit = new House(); + private Vector2 mousePosition; public Game1() @@ -63,6 +65,7 @@ namespace Game1 tractor = Content.Load("Tractor"); Bold = Content.Load("Font"); house = Content.Load("house"); + markers = Content.Load("Markers"); } @@ -77,12 +80,19 @@ namespace Game1 { if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape)) Exit(); + + + MouseState state = Mouse.GetState(); + mousePosition = new Vector2(state.X, state.Y); + tractorUnit.updateSizing(input, 0, houseUnit.getVector()); //Updates the size tractorUnit.setSpeed(input.changeSpeed(tractorUnit.getSpeed())); //Updates the Simulation Speed tractorUnit.setTractorSpeed(input.changeTractorSpeed(tractorUnit.getTractorSpeed(), tractorUnit.getPos())); //Updates the Tractor Speed input.controlWindowSize(); //Controls the size of the screen depending on the number of tiles houseUnit.updateRectangle(input.getSize(), input.getTileSize(), input.getSpacing()); //Updates the position of the house if the house appears out of bound + + base.Update(gameTime); } @@ -100,21 +110,32 @@ namespace Game1 spriteBatch.Draw(tile[tractorUnit.getFarm().getCrop(i, j).Status], new Rectangle(i * (input.getSpacingTile()), j * (input.getSpacingTile()), input.getTileSize(), input.getTileSize()), Color.White); } } - spriteBatch.Draw(tractor, new Rectangle((int)tractorUnit.getTargetPosition().X / input.getSpacingTile() * (input.getTileSize() + input.getSpacing()) + input.getTileSize() / 4, (int)tractorUnit.getTargetPosition().Y / input.getSpacingTile() * (input.getTileSize() + input.getSpacing()) + input.getTileSize() / 4, input.getTileSize()/2, input.getTileSize()/2), Color.Green); + spriteBatch.Draw(markers, new Rectangle((int)tractorUnit.getTargetPosition().X / input.getSpacingTile() * (input.getTileSize() + input.getSpacing()) + input.getTileSize() / 4, (int)tractorUnit.getTargetPosition().Y / input.getSpacingTile() * (input.getTileSize() + input.getSpacing()) + input.getTileSize() / 4, input.getTileSize()/2, input.getTileSize()/2), Color.Green); for (int i = 0; i < tractorUnit.getPath().getCount() + 1; i++) { - spriteBatch.Draw(tractor, new Rectangle((int)tractorUnit.getPath().getByIndex(i).getCords().X * (input.getSpacingTile()) + input.getTileSize() / 4, (int)tractorUnit.getPath().getByIndex(i).getCords().Y * (input.getSpacingTile()) + input.getTileSize() / 4, input.getTileSize()/2, input.getTileSize()/2), Color.Green); + spriteBatch.Draw(markers, new Rectangle((int)tractorUnit.getPath().getByIndex(i).getCords().X * (input.getSpacingTile()) + input.getTileSize() / 4, (int)tractorUnit.getPath().getByIndex(i).getCords().Y * (input.getSpacingTile()) + input.getTileSize() / 4, input.getTileSize()/2, input.getTileSize()/2), Color.Green); } - spriteBatch.Draw(tractor, new Rectangle((int)tractorUnit.getPos().X, (int)tractorUnit.getPos().Y, input.getTileSize(), input.getTileSize()), Color.White); + + + spriteBatch.Draw(house, houseUnit.GetRectangle(), Color.White); + spriteBatch.Draw(markers, new Rectangle((int)tractorUnit.getPath().getFinalDest().getCords().X * (input.getSpacingTile()) + Convert.ToInt32(input.getTileSize() / 6), (int)tractorUnit.getPath().getFinalDest().getCords().Y * (input.getSpacingTile()) + Convert.ToInt32(input.getTileSize() / 6), Convert.ToInt32(input.getTileSize() / 1.5), Convert.ToInt32(input.getTileSize() / 1.5)), Color.Red); //Draws the current target of the tractor + spriteBatch.Draw(tractor, new Vector2((int)tractorUnit.getPos().X + input.getTileSize() / 2, (int)tractorUnit.getPos().Y + input.getTileSize() / 2), new Rectangle(0, 0, input.getTileSize(), input.getTileSize()), Color.White, tractorUnit.getRotation(), new Vector2(input.getTileSize() / 2, input.getTileSize() / 2), 1.0f, SpriteEffects.None, 1); + + + spriteBatch.DrawString(Bold, "Speed:" + tractorUnit.getSpeed().ToString(), new Vector2(10, input.getSize().Y * (input.getTileSize() + input.getSpacing()) + 20) , Color.White); //Draws the speed value - spriteBatch.Draw(tractor, new Rectangle((int)tractorUnit.getPath().getFinalDest().getCords().X * (input.getSpacingTile()) + Convert.ToInt32(input.getTileSize() / 6), (int)tractorUnit.getPath().getFinalDest().getCords().Y * (input.getSpacingTile()) + Convert.ToInt32(input.getTileSize() / 6), Convert.ToInt32(input.getTileSize() / 1.5), Convert.ToInt32(input.getTileSize() / 1.5)), Color.Red); //Draws the current target of the tractor + spriteBatch.DrawString(Bold, "Tractor Speed:" + tractorUnit.getTractorSpeed().ToString(), new Vector2(100, input.getSize().Y * (input.getTileSize() + input.getSpacing()) + 20), Color.White); spriteBatch.DrawString(Bold, "Tile Size:" + input.getTileSize().ToString() + "pix", new Vector2(10, input.getSize().Y * (input.getTileSize() + input.getSpacing()) + 40), Color.White); //Draws the tile size - spriteBatch.DrawString(Bold, "Matrix Size: " + input.getSize().X.ToString() + " X " + input.getSize().Y.ToString(), new Vector2(10, input.getSize().Y * (input.getTileSize() + input.getSpacing()) + 60), Color.White); + spriteBatch.DrawString(Bold, "Matrix Size: " + input.getSize().X.ToString() + " X " + input.getSize().Y.ToString(), new Vector2(10, input.getSize().Y * (input.getTileSize() + input.getSpacing()) + 60), Color.White);spriteBatch.DrawString(Bold, "Tile Size:" + input.getTileSize().ToString() + "pix", new Vector2(10, input.getSize().Y * (input.getTileSize() + input.getSpacing()) + 40), Color.White); + spriteBatch.DrawString(Bold, "Tractor Rotation:" + tractorUnit.getRotation().ToString() + " Degrees", new Vector2(250, input.getSize().Y * (input.getTileSize() + input.getSpacing()) + 20), Color.White); spriteBatch.DrawString(Bold, tractorUnit.getCurrentTask(), new Vector2(10, input.getSize().Y * (input.getTileSize() + input.getSpacing()) + 80), Color.White); //Draws the tile size spriteBatch.DrawString(Bold, tractorUnit.getScore().ToString(), new Vector2(10, input.getSize().Y * (input.getTileSize() + input.getSpacing()) + 100), Color.White); + + spriteBatch.Draw(tractor, new Rectangle((int)mousePosition.X, (int)mousePosition.Y, input.getTileSize() / 4, input.getTileSize() / 4), Color.White); + spriteBatch.End(); base.Draw(gameTime); diff --git a/Game1/Game1.csproj b/Game1/Game1.csproj index 6d43d60..2416809 100644 --- a/Game1/Game1.csproj +++ b/Game1/Game1.csproj @@ -69,6 +69,7 @@ + diff --git a/Game1/Sources/Crops/Crops.cs b/Game1/Sources/Crops/Crops.cs index ccbdcb7..64cc648 100644 --- a/Game1/Sources/Crops/Crops.cs +++ b/Game1/Sources/Crops/Crops.cs @@ -41,7 +41,7 @@ class Crops } else if (Status == 3) { - return 20; + return 15; } else { diff --git a/Game1/Sources/Objects/Tractor.cs b/Game1/Sources/Objects/Tractor.cs index 0eb1c83..97a6813 100644 --- a/Game1/Sources/Objects/Tractor.cs +++ b/Game1/Sources/Objects/Tractor.cs @@ -9,7 +9,7 @@ class Tractor - private int Spacing, sizeTile, Speed = 1; + private int Spacing, sizeTile, Speed = 1, Rotation = 180, rotationSpeed = 5; private float tractorSpeed = 1; private String currentTask; @@ -46,6 +46,7 @@ class Tractor private void updateDirection(Vector2 Size, Vector2 newPosition) { Vector2 DeltaPosition = TargetPosition - Position; + if (DeltaPosition.X == 0) { if (DeltaPosition.Y == 0) @@ -54,20 +55,20 @@ class Tractor } else if (DeltaPosition.Y > 0) { - Direction = new Vector2(0, 1) * tractorSpeed; + updateRotation(0); } else if (DeltaPosition.Y < 0) { - Direction = new Vector2(0, -1) * tractorSpeed; + updateRotation(1); } } else if (DeltaPosition.X > 0) { - Direction = new Vector2(1, 0) * tractorSpeed; + updateRotation(2); } else if (DeltaPosition.X < 0) { - Direction = new Vector2(-1, 0) * tractorSpeed; + updateRotation(3); } } @@ -79,8 +80,8 @@ class Tractor farm.updateSize(Size, sizeTile, Spacing); for (int i = 0; i < Speed; i++) //Where all the choices the tractor does comes from { - smartTractor.updateMap(Position, housePos, farm.getCrops(), Size, sizeTile, Spacing, scoreSystem.getScore()); - Position = Position + Direction; + smartTractor.updateMap(Position, housePos, farm.getCrops(), Size, sizeTile, Spacing, scoreSystem.getScore(), Rotation); + updateDirection(Size, Position); } @@ -120,7 +121,121 @@ class Tractor } } + private void updateRotation(int Destination) + { + if (Destination == 0) + { + if (Rotation == 0) + { + Direction = new Vector2(0, 1) * tractorSpeed; + Position = Position + Direction; + } + else + { + if (Rotation == 0) + { + //Do nothing + } + else if (Rotation > 180) + { + if (Rotation >= 360) + { + Rotation = 0; + } + Rotation = Rotation + rotationSpeed; + } + else if (Rotation <= 180 && Rotation > 0) + { + Rotation = Rotation - rotationSpeed; + } + } + } + else if (Destination == 1) + { + if (Rotation == 180) + { + Direction = new Vector2(0, -1) * tractorSpeed; + Position = Position + Direction; + } + else + { + if (Rotation == 180) + { + //Do nothing + } + else if (Rotation >= 0 && Rotation < 180) + { + Rotation = Rotation + rotationSpeed; + } + else if (Rotation < 360 && Rotation > 180) + { + Rotation = Rotation - rotationSpeed; + } + } + } + else if (Destination == 2) + { + if (Rotation == 270) + { + Direction = new Vector2(1, 0) * tractorSpeed; + Position = Position + Direction; + } + else + { + if (Rotation == 270) + { + //Do nothing + } + else if (Rotation > 90 && Rotation < 270) + { + Rotation = Rotation + rotationSpeed; + } + else if (Rotation < 90 || Rotation < 360) + { + if (Rotation <= 0) + { + Rotation = 360; + } + Rotation = Rotation - rotationSpeed; + } + } + } + else if (Destination == 3) + { + if (Rotation == 90) + { + Direction = new Vector2(-1, 0) * tractorSpeed; + Position = Position + Direction; + } + else + { + if (Rotation == 90) + { + //Do nothing + } + else if ( Rotation < 270 && Rotation > 90) + { + Rotation = Rotation - rotationSpeed; + } + else if (Rotation >= 0 || Rotation > 270) + { + if (Rotation >= 360) + { + Rotation = 0; + } + Rotation = Rotation + rotationSpeed; + } + } + + } + } + + public float getRotation() + { + return MathHelper.ToRadians(Rotation); + + } public Vector2 getPos() { diff --git a/Game1/Sources/Pathing/A-Star/Astar.cs b/Game1/Sources/Pathing/A-Star/Astar.cs index a089a44..808129f 100644 --- a/Game1/Sources/Pathing/A-Star/Astar.cs +++ b/Game1/Sources/Pathing/A-Star/Astar.cs @@ -14,15 +14,16 @@ class Astar private Vector2 Size; private PriorityQueue allPaths; private Vector2 targetPos; + private int Rotation; - public void update(Crops[,] newCrops, Vector2 newSize, Vector2 newTractorPos, Vector2 newHousePos, Vector2 newtargetPos) + public void update(Crops[,] newCrops, Vector2 newSize, Vector2 newTractorPos, Vector2 newHousePos, Vector2 newtargetPos, int rotation) { tractorPos = new Vector2((int)newTractorPos.X, (int)newTractorPos.Y); housePos = new Vector2((int)newHousePos.X, (int)newHousePos.Y); targetPos = newtargetPos; crops = newCrops; Size = newSize; - + Rotation = rotation; } public Nodes getOptimalPath() @@ -30,7 +31,7 @@ class Astar return allPaths.Peek(); } - private List GetAdjacentNodes(Vector2 currentPos) + private List GetAdjacentNodes(Vector2 currentPos) { var adjacentNodes = new List() @@ -42,7 +43,7 @@ class Astar }; //check if out of range - for (int i = 3; i >=0; i--) + for (int i = 3; i >= 0; i--) { if (adjacentNodes[i].getCords().X < 0 || adjacentNodes[i].getCords().Y < 0) adjacentNodes.Remove(adjacentNodes[i]); @@ -68,12 +69,26 @@ class Astar if (currDir == newDir) return 0; else if (Math.Abs(currDir - newDir) == 1 || Math.Abs(currDir - newDir) == 3) - return 1; + return 3; else if (Math.Abs(currDir - newDir) == 0 || Math.Abs(currDir - newDir) == 2) //its for turning back, so it never should happen anyway, remove this check then? - return 10; + return 9; return 0; } + public int ConvertRotation() + { + int rotation = 0; + if (Rotation == 180) + rotation = 0; + else if (Rotation == 270) + rotation = 1; + else if (Rotation == 0) + rotation = 2; + else if (Rotation == 90) + rotation = -1; + return rotation; + } + public Path FindPath() { Path path = new Path(); @@ -82,10 +97,11 @@ class Astar //PriorityQueue closedList = new PriorityQueue(); MinHeap closedList = new MinHeap(); Nodes target = new Nodes(targetPos); - Nodes startPos = new Nodes (tractorPos); + int direction = ConvertRotation(); + Nodes startPos = new Nodes(tractorPos, direction); Nodes current = null; - int direction = 6; int g = 0; + //int direction = SmartTractor.update //openList.Enqueue(startPos); openList.Insert(startPos); @@ -103,7 +119,7 @@ class Astar direction = current.getDirection(); if (current.getCords() == target.getCords()) - break; + break; //if (closedList.Exists(target.getCords())) @@ -111,14 +127,14 @@ class Astar var adjacentNodes = GetAdjacentNodes(current.getCords()); //g++; - foreach(var adjacentNode in adjacentNodes) + foreach (var adjacentNode in adjacentNodes) { if (closedList.Exists(adjacentNode.getCords())) continue; g = current.getG() + crops[(int)adjacentNode.getCords().X, (int)adjacentNode.getCords().Y].getCostOnMovement() + CalculateRotationCost(direction, adjacentNode.getDirection()); if (!(openList.Exists(adjacentNode.getCords()))) { - + adjacentNode.setG(g); adjacentNode.setH(ComputeHScore(adjacentNode.getCords(), target.getCords())); adjacentNode.calculateF(); @@ -128,7 +144,7 @@ class Astar } else { - if(g + adjacentNode.getH() < adjacentNode.getF()) + if (g + adjacentNode.getH() < adjacentNode.getF()) { adjacentNode.setG(g); adjacentNode.calculateF(); @@ -154,4 +170,4 @@ class Astar return path; } -} \ No newline at end of file +} \ No newline at end of file diff --git a/Game1/Sources/Pathing/A-Star/PathSaver/Nodes.cs b/Game1/Sources/Pathing/A-Star/PathSaver/Nodes.cs index 7413965..76450ad 100644 --- a/Game1/Sources/Pathing/A-Star/PathSaver/Nodes.cs +++ b/Game1/Sources/Pathing/A-Star/PathSaver/Nodes.cs @@ -27,7 +27,7 @@ class Nodes Direction = direction; } - public Nodes (Nodes node) + public Nodes(Nodes node) { F = node.F; G = node.G; @@ -94,4 +94,4 @@ class Nodes { return Direction; } -} +} \ No newline at end of file diff --git a/Game1/Sources/Smart/SmartTractor.cs b/Game1/Sources/Smart/SmartTractor.cs index ea35145..fa7112c 100644 --- a/Game1/Sources/Smart/SmartTractor.cs +++ b/Game1/Sources/Smart/SmartTractor.cs @@ -15,6 +15,7 @@ class SmartTractor private int Spacing; private Random r = new Random(); private Astar astar = new Astar(); + private int Rotation; //What to do next @@ -30,7 +31,7 @@ class SmartTractor //To the fields getTargetPosition(r.Next(0, (int)Size.X), r.Next(0, (int)Size.Y)); } - astar.update(crops, Size, tractorPos / (tileSize + Spacing), housePos / (tileSize + Spacing), Target/(tileSize+Spacing)); + astar.update(crops, Size, tractorPos / (tileSize + Spacing), housePos / (tileSize + Spacing), Target/(tileSize+Spacing), Rotation); //astar.FindPath(); return astar.FindPath(); } @@ -41,7 +42,7 @@ class SmartTractor //Updates the variables every frame - public void updateMap(Vector2 newTractorPos, Vector2 newHousePos, Crops[,] newCropsStatus, Vector2 newSize, int newTileSize, int newSpacing, int newScore) + public void updateMap(Vector2 newTractorPos, Vector2 newHousePos, Crops[,] newCropsStatus, Vector2 newSize, int newTileSize, int newSpacing, int newScore, int rotation) { crops = newCropsStatus; housePos = newHousePos; @@ -50,8 +51,8 @@ class SmartTractor tileSize = newTileSize; Spacing = newSpacing; Score = newScore; + Rotation = rotation; - } private void getTargetPosition(int x, int y)