Commits

Anonymous committed 0b5aee3

First commit

Comments (0)

Files changed (17)

+syntax: glob
+*/obj/*
+*/bin/*
+tools/*
+*.user
+*.suo
+*/_ReSharper*/
+src/packages/*
+*.docstates
+build/*
+StyleCop.Cache
+*.vs10x
+*.orig
+*.dotCover
+*.csproj.Debug.cachefile

MoreSteeringBehaviours.sln

+
+Microsoft Visual Studio Solution File, Format Version 11.00
+# Visual Studio 2010
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MoreSteeringBehaviours", "MoreSteeringBehaviours\MoreSteeringBehaviours.csproj", "{9FE9477A-E615-454E-9E69-E13597F00D90}"
+EndProject
+Project("{96E2B04D-8817-42C6-938A-82C39BA4D311}") = "MoreSteeringBehavioursContent", "MoreSteeringBehavioursContent\MoreSteeringBehavioursContent.contentproj", "{7E3E6A9A-7D70-4965-A816-4B68C7E7A01D}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|x86 = Debug|x86
+		Release|x86 = Release|x86
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{9FE9477A-E615-454E-9E69-E13597F00D90}.Debug|x86.ActiveCfg = Debug|x86
+		{9FE9477A-E615-454E-9E69-E13597F00D90}.Debug|x86.Build.0 = Debug|x86
+		{9FE9477A-E615-454E-9E69-E13597F00D90}.Release|x86.ActiveCfg = Release|x86
+		{9FE9477A-E615-454E-9E69-E13597F00D90}.Release|x86.Build.0 = Release|x86
+		{7E3E6A9A-7D70-4965-A816-4B68C7E7A01D}.Debug|x86.ActiveCfg = Debug|x86
+		{7E3E6A9A-7D70-4965-A816-4B68C7E7A01D}.Release|x86.ActiveCfg = Release|x86
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+EndGlobal

MoreSteeringBehaviours/Entity.cs

+using Microsoft.Xna.Framework;
+using Microsoft.Xna.Framework.Graphics;
+
+namespace SeekSteeringBehaviour
+{
+	public class Entity : DrawableGameComponent
+	{
+		private ISteeringBehaviour _steeringBehaviour;
+		private readonly SpriteBatch _spriteBatch;
+		private Vehicle _vehicle;
+		private Texture2D _texture;
+
+
+		public Entity(Game game, SpriteBatch spriteBatch, Vehicle vehicle)
+			: base(game)
+		{
+			_spriteBatch = spriteBatch;
+			_vehicle = vehicle;
+		}
+
+		public Vehicle Vehicle
+		{
+			get
+			{
+				return _vehicle;
+			}
+			set
+			{
+				_vehicle = value;
+			}
+		}
+
+		public void SetSteeringBehaviour(ISteeringBehaviour steeringBehaviour)
+		{
+			_steeringBehaviour = steeringBehaviour;
+		}
+
+		protected override void LoadContent()
+		{
+			_texture = Game.Content.Load<Texture2D>("Arrow");
+
+			base.LoadContent();
+		}
+
+		public override void Update(GameTime gameTime)
+		{
+			var steeringDirection = _steeringBehaviour.Update(_vehicle, gameTime);
+			_vehicle.Update(steeringDirection, gameTime);
+
+			base.Update(gameTime);
+		}
+
+		public override void Draw(GameTime gameTime)
+		{
+			base.Draw(gameTime);
+			_spriteBatch.Draw(_texture, _vehicle.Position, null, Color.White, _vehicle.Rotation, new Vector2(37, 32), 0.4f, SpriteEffects.None, 0);
+		}
+	}
+}

MoreSteeringBehaviours/FleeBehaviour.cs

+using Microsoft.Xna.Framework;
+
+namespace SeekSteeringBehaviour
+{
+	public class FleeBehaviour : ISteeringBehaviour
+	{
+		private SteeringTarget _target;
+
+		public FleeBehaviour(SteeringTarget target)
+		{
+			_target = target;
+		}
+		
+		public Vector2 Update(Vehicle vehicle, GameTime gameTime)
+		{
+			// Todo:
+			// Create a Vector2 instance that represents a steering vector in a direction away from the target. You can get the coordinates of
+			//  the target from the _target.Position property. Return the new Vector2 instance.
+
+			// Hint:
+			// To calculate the desired velocity vector, create a vector pointing from the vehicle position to the target, normalize it, and 
+			//  multiply by the vehicle's max speed.
+
+			var vectorToTarget = vehicle.Position - _target.Position;
+			vectorToTarget.Normalize();
+			var desiredVelocity = vectorToTarget * vehicle.MaxSpeed;
+			return desiredVelocity - vehicle.Velocity;
+		}
+	}
+}

MoreSteeringBehaviours/Game.ico

Added
New image

MoreSteeringBehaviours/GameThumbnail.png

Added
New image

MoreSteeringBehaviours/ISteeringBehaviour.cs

+using Microsoft.Xna.Framework;
+
+namespace SeekSteeringBehaviour
+{
+	public interface ISteeringBehaviour
+	{
+		Vector2 Update(Vehicle vehicle, GameTime gameTime);
+	}
+}

MoreSteeringBehaviours/MoreSteeringBehaviours.csproj

+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <ProjectGuid>{9FE9477A-E615-454E-9E69-E13597F00D90}</ProjectGuid>
+    <ProjectTypeGuids>{6D335F3A-9D43-41b4-9D22-F6F17C4BE596};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
+    <OutputType>WinExe</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>SeekSteeringBehaviour</RootNamespace>
+    <AssemblyName>SeekSteeringBehaviour</AssemblyName>
+    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+    <TargetFrameworkProfile>Client</TargetFrameworkProfile>
+    <XnaFrameworkVersion>v4.0</XnaFrameworkVersion>
+    <XnaPlatform>Windows</XnaPlatform>
+    <XnaProfile>HiDef</XnaProfile>
+    <XnaCrossPlatformGroupID>10949c56-b6c5-494e-8254-19b6c92f4754</XnaCrossPlatformGroupID>
+    <XnaOutputType>Game</XnaOutputType>
+    <ApplicationIcon>Game.ico</ApplicationIcon>
+    <Thumbnail>GameThumbnail.png</Thumbnail>
+    <PublishUrl>publish\</PublishUrl>
+    <Install>true</Install>
+    <InstallFrom>Disk</InstallFrom>
+    <UpdateEnabled>false</UpdateEnabled>
+    <UpdateMode>Foreground</UpdateMode>
+    <UpdateInterval>7</UpdateInterval>
+    <UpdateIntervalUnits>Days</UpdateIntervalUnits>
+    <UpdatePeriodically>false</UpdatePeriodically>
+    <UpdateRequired>false</UpdateRequired>
+    <MapFileExtensions>true</MapFileExtensions>
+    <ApplicationRevision>0</ApplicationRevision>
+    <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
+    <IsWebBootstrapper>false</IsWebBootstrapper>
+    <UseApplicationTrust>false</UseApplicationTrust>
+    <BootstrapperEnabled>true</BootstrapperEnabled>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\x86\Debug</OutputPath>
+    <DefineConstants>DEBUG;TRACE;WINDOWS</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <NoStdLib>true</NoStdLib>
+    <UseVSHostingProcess>false</UseVSHostingProcess>
+    <PlatformTarget>x86</PlatformTarget>
+    <XnaCompressContent>false</XnaCompressContent>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\x86\Release</OutputPath>
+    <DefineConstants>TRACE;WINDOWS</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <NoStdLib>true</NoStdLib>
+    <UseVSHostingProcess>false</UseVSHostingProcess>
+    <PlatformTarget>x86</PlatformTarget>
+    <XnaCompressContent>true</XnaCompressContent>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="Microsoft.Xna.Framework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86">
+      <Private>False</Private>
+    </Reference>
+    <Reference Include="Microsoft.Xna.Framework.Game, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86">
+      <Private>False</Private>
+    </Reference>
+    <Reference Include="Microsoft.Xna.Framework.Graphics, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86">
+      <Private>False</Private>
+    </Reference>
+    <Reference Include="Microsoft.Xna.Framework.GamerServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86">
+      <Private>False</Private>
+    </Reference>
+    <Reference Include="Microsoft.Xna.Framework.Xact, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86">
+      <Private>False</Private>
+    </Reference>
+    <Reference Include="Microsoft.Xna.Framework.Video, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86">
+      <Private>False</Private>
+    </Reference>
+    <Reference Include="Microsoft.Xna.Framework.Avatar, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86">
+      <Private>False</Private>
+    </Reference>
+    <Reference Include="Microsoft.Xna.Framework.Net, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86">
+      <Private>False</Private>
+    </Reference>
+    <Reference Include="Microsoft.Xna.Framework.Storage, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86">
+      <Private>False</Private>
+    </Reference>
+    <Reference Include="mscorlib">
+      <Private>False</Private>
+    </Reference>
+    <Reference Include="System">
+      <Private>False</Private>
+    </Reference>
+    <Reference Include="System.Xml">
+      <Private>False</Private>
+    </Reference>
+    <Reference Include="System.Core">
+      <Private>False</Private>
+    </Reference>
+    <Reference Include="System.Xml.Linq">
+      <Private>False</Private>
+    </Reference>
+    <Reference Include="System.Net">
+      <Private>False</Private>
+    </Reference>
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="Entity.cs" />
+    <Compile Include="FleeBehaviour.cs" />
+    <Compile Include="ISteeringBehaviour.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+    <Compile Include="Program.cs" />
+    <Compile Include="WanderSteeringBehaviours.cs" />
+    <Compile Include="SeekBehaviour.cs" />
+    <Compile Include="SteeringTarget.cs" />
+    <Compile Include="Vehicle.cs" />
+    <Compile Include="WanderBehaviour.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <Content Include="Game.ico" />
+    <Content Include="GameThumbnail.png" />
+  </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\SeekSteeringBehaviourContent\SeekSteeringBehaviourContent.contentproj">
+      <Name>SeekSteeringBehaviourContent</Name>
+      <XnaReferenceType>Content</XnaReferenceType>
+    </ProjectReference>
+  </ItemGroup>
+  <ItemGroup>
+    <BootstrapperPackage Include=".NETFramework,Version=v4.0,Profile=Client">
+      <Visible>False</Visible>
+      <ProductName>Microsoft .NET Framework 4 Client Profile %28x86 and x64%29</ProductName>
+      <Install>true</Install>
+    </BootstrapperPackage>
+    <BootstrapperPackage Include="Microsoft.Net.Client.3.5">
+      <Visible>False</Visible>
+      <ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
+      <Install>false</Install>
+    </BootstrapperPackage>
+    <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
+      <Visible>False</Visible>
+      <ProductName>.NET Framework 3.5 SP1</ProductName>
+      <Install>false</Install>
+    </BootstrapperPackage>
+    <BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
+      <Visible>False</Visible>
+      <ProductName>Windows Installer 3.1</ProductName>
+      <Install>true</Install>
+    </BootstrapperPackage>
+    <BootstrapperPackage Include="Microsoft.Xna.Framework.4.0">
+      <Visible>False</Visible>
+      <ProductName>Microsoft XNA Framework Redistributable 4.0</ProductName>
+      <Install>true</Install>
+    </BootstrapperPackage>
+  </ItemGroup>
+  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+  <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\Microsoft.Xna.GameStudio.targets" />
+  <!--
+      To modify your build process, add your task inside one of the targets below and uncomment it. 
+      Other similar extension points exist, see Microsoft.Common.targets.
+      <Target Name="BeforeBuild">
+      </Target>
+      <Target Name="AfterBuild">
+      </Target>
+    -->
+</Project>

MoreSteeringBehaviours/Program.cs

+using System;
+
+namespace SeekSteeringBehaviour
+{
+#if WINDOWS || XBOX
+    static class Program
+    {
+        /// <summary>
+        /// The main entry point for the application.
+        /// </summary>
+        static void Main(string[] args)
+        {
+            using (WanderSteeringBehaviours game = new WanderSteeringBehaviours())
+            {
+                game.Run();
+            }
+        }
+    }
+#endif
+}
+

MoreSteeringBehaviours/Properties/AssemblyInfo.cs

+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following 
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("SeekSteeringBehaviour")]
+[assembly: AssemblyProduct("SeekSteeringBehaviour")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyCompany("Microsoft")]
+[assembly: AssemblyCopyright("Copyright © Microsoft 2012")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible 
+// to COM components.  If you need to access a type in this assembly from 
+// COM, set the ComVisible attribute to true on that type. Only Windows
+// assemblies support COM.
+[assembly: ComVisible(false)]
+
+// On Windows, the following GUID is for the ID of the typelib if this
+// project is exposed to COM. On other platforms, it unique identifies the
+// title storage container when deploying this assembly to the device.
+[assembly: Guid("dd8b4f36-abab-4f22-aabc-7225083289d3")]
+
+// Version information for an assembly consists of the following four values:
+//
+//      Major Version
+//      Minor Version 
+//      Build Number
+//      Revision
+//
+[assembly: AssemblyVersion("1.0.0.0")]

MoreSteeringBehaviours/SeekBehaviour.cs

+using Microsoft.Xna.Framework;
+
+namespace SeekSteeringBehaviour
+{
+	public class SeekBehaviour : ISteeringBehaviour
+	{
+		private readonly SteeringTarget _target;
+
+		public SeekBehaviour(SteeringTarget target)
+		{
+			_target = target;
+		}
+		
+		public Vector2 Update(Vehicle vehicle, GameTime gameTime)
+		{
+			// Todo:
+			// Create a Vector2 instance that represents a steering vector in the direction of the target. You can get the coordinates of
+			//  the target from the _target.Position property. Return the new Vector2 instance.
+
+			// Hint:
+			// To calculate the desired velocity vector, create a vector pointing from the vehicle position to the target, normalize it, and 
+			//  multiply by the vehicle's max speed.
+
+			var vectorToTarget = _target.Position - vehicle.Position;
+			vectorToTarget.Normalize();
+			var desiredVelocity = vectorToTarget * vehicle.MaxSpeed;
+			return desiredVelocity - vehicle.Velocity;
+		}
+	}
+}

MoreSteeringBehaviours/SteeringTarget.cs

+using Microsoft.Xna.Framework;
+
+namespace SeekSteeringBehaviour
+{
+	public class SteeringTarget
+	{
+		public SteeringTarget(Vector2 position)
+		{
+			Position = position;
+		}
+
+		public Vector2 Position { get; set; }
+	}
+}

MoreSteeringBehaviours/Vehicle.cs

+using System;
+using Microsoft.Xna.Framework;
+
+namespace SeekSteeringBehaviour
+{
+	public class Vehicle
+	{
+		public Vector2 Position;
+		public Vector2 Velocity;
+		public float MaxForce;
+		public float MaxSpeed;
+		public float Mass;
+		public float Rotation;
+
+		public void Update(Vector2 steeringDirection, GameTime gameTime)
+		{
+			// Todo:
+			// Use the TruncateVector method to make sure the steeringDirection vector is less than MaxForce units long.
+
+			steeringDirection = TruncateVector(steeringDirection, MaxForce);
+			
+			// Todo:
+			// Create an acceleration vector that represents an acceleration in the X and Y dimensions. The vector should
+			//  take the vehicles mass into account. Apply the acceleration to the vehicles velocity. Remember that we're
+			//  dealing with "pixels per second" units, so scale the acceleration value appropriately by elapsed time.
+
+			// Hint:
+			// The equation you need is acceleration = force / mass.
+
+			var acceleration = steeringDirection / Mass;
+			Velocity = Velocity + (acceleration * (float) gameTime.ElapsedGameTime.TotalSeconds);
+
+
+			// Todo:
+			// Use the TruncateVector method to make sure the Velocity vector is less than MaxSpeed units long.
+
+			Velocity = TruncateVector(Velocity, MaxSpeed);
+
+			SetRotation();
+			SetPosition(gameTime);
+		}
+
+		private Vector2 TruncateVector(Vector2 vector, float maxLength)
+		{
+			if (vector.Length() > maxLength)
+			{
+				vector.Normalize();
+				vector *= maxLength;
+			}
+			return vector;
+		}
+
+		private void SetRotation()
+		{
+			Rotation = (float) Math.Atan2(Velocity.Y, Velocity.X);
+
+			if (Rotation < 0)
+				Rotation += MathHelper.TwoPi;
+		}
+
+		private void SetPosition(GameTime gameTime)
+		{
+			Position += Velocity * (float)gameTime.ElapsedGameTime.TotalSeconds;
+		}
+	}
+}

MoreSteeringBehaviours/WanderBehaviour.cs

+using System;
+using Microsoft.Xna.Framework;
+
+namespace SeekSteeringBehaviour
+{
+	public class WanderBehaviour : ISteeringBehaviour
+	{
+		private readonly Random _random;
+		private float _currentWanderAngle;
+		private int _lastDirectionChangeTime;
+
+		public WanderBehaviour(Random random)
+		{
+			_random = random;
+			
+			RateOfChangeOfDirection = 1.75f;
+			CircleDistance = 200;
+			CircleRadius = 400;
+		}
+
+		public float CircleRadius { get; set; }
+		public float CircleDistance { get; set; }
+		public float RateOfChangeOfDirection { get; set; }
+
+		public Vector2 Update(Vehicle vehicle, GameTime gameTime)
+		{
+			// Todo:
+			// Add a value of between -RateOfChangeOfDirection and RateOfChangeOfDirection to the _currentWanderAngle variable.
+			//  For extra pride, only update the variable every 500 milliseconds, so the changes in steering are more obvious
+			//  when the game is run.
+
+			// Hint:
+			// You can use the _random variable that was passed in to the constructor to get a random value between -1 and 1.
+			//  Use _random.NextDouble() * 2 - 1. 
+
+			if(gameTime.TotalGameTime.TotalMilliseconds - _lastDirectionChangeTime > 500)
+			{
+				_currentWanderAngle += ((float)(_random.NextDouble() * 2 - 1) * RateOfChangeOfDirection);
+				_lastDirectionChangeTime = (int) gameTime.TotalGameTime.TotalMilliseconds;
+			}
+
+
+			// Todo:
+			// Figure out the circle position by taking the vehicles velocity (vehicle is a parameter passed into this method),
+			//  normalising it, multiplying by the circle distance, and finally adding the vehicles position.
+
+			var circlePosition = vehicle.Velocity;
+			circlePosition.Normalize();
+			circlePosition *= CircleDistance;
+			circlePosition += vehicle.Position;
+
+			// Todo:
+			// Calculate an offset on the steering circle based on the value in the _currentWanderAngle variable and the radius
+			//  of the circle, whose value is stored in CircleRadius.
+
+			var circleOffset = new Vector2(CircleRadius * (float)Math.Cos(_currentWanderAngle), CircleRadius * (float)Math.Sin(_currentWanderAngle));
+
+
+			// Todo:
+			// Return a steering direction that represents a vector from the vehicles position to the point on the steering cirle
+			//  you just calculated.
+			return (circlePosition + circleOffset) - vehicle.Position;
+		}
+	}
+}

MoreSteeringBehaviours/WanderSteeringBehaviours.cs

+using System;
+using Microsoft.Xna.Framework;
+using Microsoft.Xna.Framework.Graphics;
+
+namespace SeekSteeringBehaviour
+{
+	public class WanderSteeringBehaviours : Game
+	{
+		private GraphicsDeviceManager _graphics;
+		private SpriteBatch _spriteBatch;
+
+		public WanderSteeringBehaviours()
+		{
+			_graphics = new GraphicsDeviceManager(this){PreferredBackBufferWidth = 1280, PreferredBackBufferHeight = 720};
+			Content.RootDirectory = "Content";
+			IsMouseVisible = true;
+		}
+
+		protected override void Initialize()
+		{
+			_spriteBatch = new SpriteBatch(GraphicsDevice);
+			var random = new Random((int)DateTime.Now.Ticks);
+
+			for (var i = 0; i < 50; i++)
+			{
+				var entity = new Entity(this, _spriteBatch, new Vehicle
+				{
+					Position = new Vector2(random.Next(GraphicsDevice.Viewport.Width), random.Next(GraphicsDevice.Viewport.Height)),
+					Velocity = Vector2.One,
+
+					// Todo if you like:
+					// Tweak these values to see how they affect the steering behaviours.
+
+					MaxSpeed = 350,
+					MaxForce = 750,
+					Mass = 1f
+				});
+				entity.SetSteeringBehaviour(new WanderBehaviour(random));
+				Components.Add(entity);
+			}
+
+			base.Initialize();
+		}
+
+		protected override void Update(GameTime gameTime)
+		{
+			base.Update(gameTime);
+
+			foreach (var component in Components)
+			{
+				var entity = component as Entity;
+				if (entity == null)
+					continue;
+
+				if (entity.Vehicle.Position.X < 0)
+					entity.Vehicle.Position = new Vector2(GraphicsDevice.Viewport.Width, entity.Vehicle.Position.Y);
+				else if(entity.Vehicle.Position.X > GraphicsDevice.Viewport.Width)
+					entity.Vehicle.Position = new Vector2(0, entity.Vehicle.Position.Y);
+
+				if (entity.Vehicle.Position.Y < 0)
+					entity.Vehicle.Position = new Vector2(entity.Vehicle.Position.X, GraphicsDevice.Viewport.Height);
+				else if (entity.Vehicle.Position.Y > GraphicsDevice.Viewport.Height)
+					entity.Vehicle.Position = new Vector2(entity.Vehicle.Position.X, 0);
+			}
+		}
+
+		protected override void Draw(GameTime gameTime)
+		{
+			GraphicsDevice.Clear(Color.CornflowerBlue);
+
+			_spriteBatch.Begin();
+			base.Draw(gameTime);
+			_spriteBatch.End();
+		}
+	}
+}

MoreSteeringBehavioursContent/MoreSteeringBehavioursContent.contentproj

+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <ProjectGuid>{7E3E6A9A-7D70-4965-A816-4B68C7E7A01D}</ProjectGuid>
+    <ProjectTypeGuids>{96E2B04D-8817-42c6-938A-82C39BA4D311};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
+    <OutputType>Library</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+    <XnaFrameworkVersion>v4.0</XnaFrameworkVersion>
+    <OutputPath>bin\$(Platform)\$(Configuration)</OutputPath>
+    <ContentRootDirectory>Content</ContentRootDirectory>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
+    <PlatformTarget>x86</PlatformTarget>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
+    <PlatformTarget>x86</PlatformTarget>
+  </PropertyGroup>
+  <PropertyGroup>
+    <RootNamespace>SeekSteeringBehaviourContent</RootNamespace>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="Microsoft.Xna.Framework.Content.Pipeline.EffectImporter, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=MSIL">
+      <Private>False</Private>
+    </Reference>
+    <Reference Include="Microsoft.Xna.Framework.Content.Pipeline.FBXImporter, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=MSIL">
+      <Private>False</Private>
+    </Reference>
+    <Reference Include="Microsoft.Xna.Framework.Content.Pipeline.TextureImporter, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=MSIL">
+      <Private>False</Private>
+    </Reference>
+    <Reference Include="Microsoft.Xna.Framework.Content.Pipeline.XImporter, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=MSIL">
+      <Private>False</Private>
+    </Reference>
+    <Reference Include="Microsoft.Xna.Framework.Content.Pipeline.AudioImporters, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=MSIL">
+      <Private>False</Private>
+    </Reference>
+    <Reference Include="Microsoft.Xna.Framework.Content.Pipeline.VideoImporters, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=MSIL">
+      <Private>False</Private>
+    </Reference>
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="arrow.tga">
+      <Name>arrow</Name>
+      <Importer>TextureImporter</Importer>
+      <Processor>TextureProcessor</Processor>
+    </Compile>
+  </ItemGroup>
+  <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" />
+  <!--  To modify your build process, add your task inside one of the targets below and uncomment it. 
+       Other similar extension points exist, see Microsoft.Common.targets.
+  <Target Name="BeforeBuild">
+  </Target>
+  <Target Name="AfterBuild">
+  </Target>
+  -->
+</Project>

MoreSteeringBehavioursContent/arrow.tga

Added
New image