Anonymous avatar Anonymous committed 3eceeed

RunEscape. My submissions. I might add one last feature before I submit it... maybe.

Comments (0)

Files changed (20)

+glob:*.suo
+glob:*.user
+glob:bin/*
+glob:obj/*
+glob:*.Debug.cachefile
+glob:*.Release.cachefile

RunEscape/RunEscape.sln

+
+Microsoft Visual Studio Solution File, Format Version 11.00
+# Visual C# Express 2010
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RunEscape", "RunEscape\RunEscape\RunEscape.csproj", "{7BE17E39-5789-4F03-893D-B0DDA54759BC}"
+EndProject
+Project("{96E2B04D-8817-42C6-938A-82C39BA4D311}") = "RunEscapeContent", "RunEscape\RunEscapeContent\RunEscapeContent.contentproj", "{8831316F-C2D9-460E-BD31-F033DA55E212}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|x86 = Debug|x86
+		Release|x86 = Release|x86
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{7BE17E39-5789-4F03-893D-B0DDA54759BC}.Debug|x86.ActiveCfg = Debug|x86
+		{7BE17E39-5789-4F03-893D-B0DDA54759BC}.Debug|x86.Build.0 = Debug|x86
+		{7BE17E39-5789-4F03-893D-B0DDA54759BC}.Release|x86.ActiveCfg = Release|x86
+		{7BE17E39-5789-4F03-893D-B0DDA54759BC}.Release|x86.Build.0 = Release|x86
+		{8831316F-C2D9-460E-BD31-F033DA55E212}.Debug|x86.ActiveCfg = Debug|x86
+		{8831316F-C2D9-460E-BD31-F033DA55E212}.Release|x86.ActiveCfg = Release|x86
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+EndGlobal

RunEscape/RunEscape/RunEscape/AQuickLevel.cs

+//Press_Escape_To_Begin._Welcome_To_RunEscape._Space_Pauses_The_Game_and_Escape_makes_you jump
+//Yo_dawg,_I_heard_you_like_escaping_from_Ludum_Dare_with_your_escaped_character_while_pressing_escape
+namespace RunEscape
+{ //_making_bigger_platforms
+    //_This_doesn't_do_anything._I_just_wanted_to_make_it_the_first_level.
+    class AQuickLevel{}
+} //Onto_the_code_now

RunEscape/RunEscape/RunEscape/Enemy.cs

+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using Microsoft.Xna.Framework;
+using Microsoft.Xna.Framework.Graphics;
+using Microsoft.Xna.Framework.Content;
+
+namespace RunEscape
+{
+    class Enemy : GameObject
+    {
+        public Enemy(Vector2 drawPosition)
+        {
+            Position = drawPosition;
+        }
+
+        public void LoadContent(ContentManager content)
+        {
+            this.Texture = content.Load<Texture2D>("Enemy");
+        }
+
+        public override void Update(GameTime gameTime)
+        { }
+
+        public override void Draw(GameTime gameTime, SpriteBatch spriteBatch)
+        {
+            spriteBatch.Draw(Texture, Position, Color.White);
+        }
+    }
+}
Add a comment to this file

RunEscape/RunEscape/RunEscape/Game.ico

Added
New image

RunEscape/RunEscape/RunEscape/Game1.cs

+//Onto the main game driver!
+using System;
+using Microsoft.Xna.Framework;
+using Microsoft.Xna.Framework.Graphics;
+using Microsoft.Xna.Framework.Input;
+
+namespace RunEscape
+{
+    public class Game1 : Microsoft.Xna.Framework.Game
+    {
+        GraphicsDeviceManager graphics;
+        SpriteBatch spriteBatch;
+        SpriteFont font;
+        Player player;
+        WordManager wordManager;
+        static long TARGET_FRAME_RATE = 60;
+        private Enemy enemy;
+
+        public Game1()
+        {
+            graphics = new GraphicsDeviceManager(this);
+            graphics.PreferredBackBufferWidth = 640;
+            graphics.PreferredBackBufferHeight = 480;
+            TargetElapsedTime = TimeSpan.FromTicks(TimeSpan.TicksPerSecond / TARGET_FRAME_RATE);
+            Content.RootDirectory = "Content";
+        }
+
+        protected override void Initialize()
+        {
+            // TODO: Add your initialization logic here
+            font = Content.Load<SpriteFont>("Word");
+            wordManager = new WordManager(graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight);
+            player = new Player(new Vector2(graphics.PreferredBackBufferWidth / 3, wordManager.StartingPosition.Y), wordManager, graphics.PreferredBackBufferHeight);
+            enemy = new Enemy(new Vector2(0, graphics.PreferredBackBufferHeight * 2 / 3));
+            base.Initialize();
+        }
+
+        protected override void LoadContent()
+        {
+            // Create a new SpriteBatch, which can be used to draw textures.
+            spriteBatch = new SpriteBatch(GraphicsDevice);
+
+            // TODO: use this.Content to load your game content here
+            player.LoadContent(Content);
+            wordManager.LoadContent(Content);
+            enemy.LoadContent(Content);
+        }
+
+        protected override void UnloadContent()
+        {
+            // TODO: Unload any non ContentManager content here
+            // NAAAAAAAAAAAAAH, Memdor, memorating the country side, memorating the peasants.
+        }
+
+        // This is where the magic happens ;)
+        protected override void Update(GameTime gameTime)
+        {
+            if (player.Alive)
+            {
+                player.Update(gameTime);
+                wordManager.Update(gameTime, player.Speed);
+            }
+            else
+            {
+                KeyboardState keyState = Keyboard.GetState();
+
+                if (keyState.IsKeyDown(Keys.Escape))
+                    Restart();
+            }
+
+            base.Update(gameTime);
+        }
+
+        // This is where you see the magic happen ;)
+        protected override void Draw(GameTime gameTime)
+        {
+            GraphicsDevice.Clear(Color.LightSlateGray);
+
+            spriteBatch.Begin();
+            wordManager.Draw(gameTime, spriteBatch);
+            enemy.Draw(gameTime, spriteBatch);
+            player.Draw(gameTime, spriteBatch);
+            if (!player.Alive)
+                DrawRestartInstructions();
+            spriteBatch.End();
+            base.Draw(gameTime);
+        }
+
+        public void DrawRestartInstructions()
+        {
+            string instructions = "Press Escape to Restart";
+            Vector2 drawPosition = new Vector2();
+            drawPosition.X = graphics.PreferredBackBufferWidth / 2;
+            drawPosition.Y = graphics.PreferredBackBufferHeight / 2;
+
+            Vector2 stringSize = font.MeasureString(instructions);
+
+            drawPosition.X -= stringSize.X / 2;
+            spriteBatch.DrawString(font, instructions, drawPosition, Color.Black);
+        }
+
+        public void Restart()
+        {
+            Initialize();
+            //LoadContent();
+        }
+    }
+}

RunEscape/RunEscape/RunEscape/GameObject.cs

+using Microsoft.Xna.Framework;
+using Microsoft.Xna.Framework.Graphics;
+
+namespace RunEscape
+{
+    abstract class GameObject
+    {
+        public Vector2 Position;
+        public Rectangle Collision;
+        public Texture2D Texture;
+
+        public bool Alive = true;
+
+        public abstract void Update(GameTime gameTime);
+
+        public abstract void Draw(GameTime gameTime, SpriteBatch spriteBatch);
+    }
+}
Add a comment to this file

RunEscape/RunEscape/RunEscape/GameThumbnail.png

Added
New image

RunEscape/RunEscape/RunEscape/LevelWordPair.cs

+
+namespace RunEscape
+{
+    public class LevelWordPair
+    {
+        public string Level;
+        public string Word;
+        public bool Comment;
+
+        public LevelWordPair(string level, string word, bool comment)
+        {
+            this.Level = level;
+            this.Word = word;
+            this.Comment = comment;
+        }
+    }
+}

RunEscape/RunEscape/RunEscape/Player.cs

+using Microsoft.Xna.Framework;
+using Microsoft.Xna.Framework.Content;
+using Microsoft.Xna.Framework.Graphics;
+using Microsoft.Xna.Framework.Input;
+
+namespace RunEscape
+{
+    class Player : GameObject
+    {
+        const float JUMP_MAX = 0.7f;
+        const float JUMP_APEX_MAX = 0.1f;
+
+        PlayerAction currentAction;
+        string DrawAction
+        {
+            get 
+            {
+                switch (currentAction)
+	            {
+		            case PlayerAction.Stopped:
+                        return "\\s";
+                    case PlayerAction.Running:
+                        return "\\r";
+                    case PlayerAction.Jumping:
+                        return "\\j";
+                    case PlayerAction.Falling:
+                        return "\\f";
+                    default:
+                        return "\\d";
+                }
+            }
+        }
+
+        bool previousEscapeWasPressed;
+        public SpriteFont font;
+        private float jumpTimer;
+        private float jumpApexTimer;
+        private PlayerAction previousAction;
+        public int Speed { get; set; }
+        public int Bottom { get; set; }
+
+        WordManager WordManager { get; set; }
+
+        public Player(Vector2 startingPosition, WordManager wordManager, int bottom)
+        {
+            currentAction = PlayerAction.Stopped;
+            Speed = 0;
+            this.Bottom = bottom;
+            Position = startingPosition;
+            Position.X += 1;
+            this.WordManager = wordManager;
+        }
+
+        public void LoadContent(ContentManager content)
+        {
+            this.Texture = content.Load<Texture2D>("ObjectBackground");
+            this.font = content.Load<SpriteFont>("Word");
+
+            Vector2 textSize = this.font.MeasureString(DrawAction);
+
+            Position.Y -= textSize.Y;
+
+            Collision = new Rectangle();
+
+            UpdateCollisionRect();
+        }
+
+        private void UpdateCollisionRect()
+        {
+            var currentString = string.Format("{0}", DrawAction);
+
+            Vector2 textSize = this.font.MeasureString(currentString);
+
+            Collision.X = (int)this.Position.X;
+            Collision.Y = (int)this.Position.Y;
+            Collision.Width = (int)textSize.X;
+            Collision.Height = (int)textSize.Y;
+        }
+
+        public override void Update(GameTime gameTime)
+        {
+            HandleInput(gameTime);
+
+            if (currentAction == PlayerAction.Running || currentAction == PlayerAction.Jumping)
+                Speed = 5;
+            else if (currentAction == PlayerAction.Stopped)
+                Speed = 0;
+
+            if (currentAction == PlayerAction.Running || currentAction == PlayerAction.Falling)
+            {
+                Position.Y += 10;
+                currentAction = PlayerAction.Falling;
+            }
+
+            UpdateCollisionRect();
+            CheckCollision();
+            UpdateCollisionRect();
+
+            if (Position.Y > Bottom)
+            {
+                Alive = false;
+                Speed = 0;
+            }
+        }
+
+        public void CheckCollision()
+        {
+            foreach (var word in WordManager.StreamingWords)
+            {
+                if (word.Collision.Intersects(this.Collision))
+                {
+                    if (word.Position.X < this.Position.X + this.Collision.Width && word.Position.Y < this.Position.Y)
+                    {
+                        //this.Position.X = word.Position.X - this.Collision.Width;
+                        //currentAction = PlayerAction.Falling;
+                        //Speed = 0;
+                    }
+                    else if (word.Position.Y < this.Position.Y + this.Collision.Height)
+                    {
+                        this.Position.Y = word.Position.Y - this.Collision.Height;
+                        jumpTimer = 0.0f;
+                        if (currentAction != PlayerAction.Stopped)
+                            currentAction = PlayerAction.Running;
+                    }
+
+                    break;
+                }
+            }
+        }
+
+        // This code is UGLY. But Meh, it gets the job done (barely).
+        public void HandleInput(GameTime gameTime)
+        {
+            bool jumpHigher = false;
+            KeyboardState keyState = Keyboard.GetState();
+
+            bool currentEscapePress = keyState.IsKeyDown(Keys.Escape);
+
+            if (currentEscapePress && !previousEscapeWasPressed)
+            {
+                if (currentAction == PlayerAction.Stopped)
+                    currentAction = PlayerAction.Running;
+                else if (currentAction == PlayerAction.Running)
+                {
+                    currentAction = PlayerAction.Jumping;
+                    jumpHigher = true;
+                    jumpTimer = 0.0f;
+                    jumpApexTimer = 0.0f;
+                }
+            }
+            else if (currentEscapePress && previousEscapeWasPressed && currentAction == PlayerAction.Jumping)
+                jumpHigher = true;
+
+            if (currentAction == PlayerAction.Running && keyState.IsKeyDown(Keys.Space))
+                currentAction = PlayerAction.Stopped;
+
+            if (!currentEscapePress)
+            {
+                previousEscapeWasPressed = false;
+                if (previousAction == PlayerAction.Stopped && currentAction == PlayerAction.Running)
+                    previousAction = currentAction;
+            }
+
+            if (jumpHigher)
+                StartOrContinueJump(gameTime);
+            else if (!jumpHigher && currentAction == PlayerAction.Jumping)
+                StopJumping(gameTime);
+
+            previousEscapeWasPressed = keyState.IsKeyDown(Keys.Escape);
+        }
+
+        private void StopJumping(GameTime gameTime)
+        {
+            jumpTimer += (float)gameTime.ElapsedGameTime.TotalSeconds;
+            if (jumpApexTimer < JUMP_APEX_MAX)
+            {
+                jumpApexTimer += (float)gameTime.ElapsedGameTime.TotalSeconds;
+                Position.Y -= 3;
+            }
+            else
+                Position.Y += 10;
+        }
+
+        private void StartOrContinueJump(GameTime gameTime)
+        {
+            // Maybe I need sleep, but jump looks like a weird word now. Just look at it...
+            if (jumpTimer < JUMP_MAX && jumpApexTimer == 0.0f)
+            {
+                jumpTimer += (float)gameTime.ElapsedGameTime.TotalSeconds;
+                Position.Y -= 8;
+            }
+            else
+                StopJumping(gameTime);
+        }
+
+        public override void Draw(GameTime gameTime, SpriteBatch spriteBatch)
+        {
+            spriteBatch.Draw(Texture, Collision, Color.BurlyWood);
+            spriteBatch.DrawString(font, DrawAction, Position, Color.Black);
+        }
+    }
+}

RunEscape/RunEscape/RunEscape/PlayerAction.cs

+
+namespace RunEscape
+{
+    enum PlayerAction
+    {
+        Stopped,
+        Running,
+        Jumping,
+        Falling,
+    }
+}

RunEscape/RunEscape/RunEscape/Program.cs

+
+namespace RunEscape
+{
+    static class Program
+    {
+        static void Main(string[] args)
+        {
+            using (Game1 game = new Game1())
+            {
+                game.Run();
+            }
+        }
+    }
+}
+

RunEscape/RunEscape/RunEscape/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("RunEscape")]
+[assembly: AssemblyProduct("RunEscape")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyCompany("Microsoft")]
+[assembly: AssemblyCopyright("Copyright © Microsoft 2011")]
+[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("8aff3601-fde0-4e3e-8460-f746c3ab841a")]
+
+// Version information for an assembly consists of the following four values:
+//
+//      Major Version
+//      Minor Version 
+//      Build Number
+//      Revision
+//
+[assembly: AssemblyVersion("1.0.0.0")]

RunEscape/RunEscape/RunEscape/RunEscape.csproj

+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <ProjectGuid>{7BE17E39-5789-4F03-893D-B0DDA54759BC}</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>RunEscape</RootNamespace>
+    <AssemblyName>RunEscape</AssemblyName>
+    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+    <TargetFrameworkProfile>Client</TargetFrameworkProfile>
+    <XnaFrameworkVersion>v4.0</XnaFrameworkVersion>
+    <XnaPlatform>Windows</XnaPlatform>
+    <XnaProfile>Reach</XnaProfile>
+    <XnaCrossPlatformGroupID>1022cfbd-14d2-4d24-9e57-5a970073f408</XnaCrossPlatformGroupID>
+    <XnaOutputType>Game</XnaOutputType>
+    <ApplicationIcon>
+    </ApplicationIcon>
+    <Thumbnail>
+    </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="AQuickLevel.cs">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </Compile>
+    <Compile Include="Enemy.cs">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </Compile>
+    <Compile Include="GameObject.cs">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </Compile>
+    <Compile Include="LevelWordPair.cs">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </Compile>
+    <Compile Include="Player.cs">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </Compile>
+    <Compile Include="PlayerAction.cs">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </Compile>
+    <Compile Include="Properties\AssemblyInfo.cs" />
+    <Compile Include="Program.cs">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </Compile>
+    <Compile Include="Game1.cs">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </Compile>
+    <Compile Include="Word.cs">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </Compile>
+    <Compile Include="WordManager.cs">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </Compile>
+  </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\RunEscapeContent\RunEscapeContent.contentproj">
+      <Name>RunEscapeContent</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>

RunEscape/RunEscape/RunEscape/Word.cs

+using System;
+using Microsoft.Xna.Framework;
+using Microsoft.Xna.Framework.Graphics;
+
+namespace RunEscape
+{
+    class Word : GameObject
+    {
+        // OMG! This is the container class to what you are jumping across right now!\
+        public int CurrentSpeed { get; set; }
+        public SpriteFont font;
+        private Color wordColor;
+        public LevelWordPair WordToDisplay { get; set; }
+        //private Rectangle collision;
+        //public Rectangle Collision { get { return collision; } set { collision = value; } }
+
+        public Word(LevelWordPair word, Vector2 startingPosition, SpriteFont font, Texture2D texture)
+        {
+            WordToDisplay = word;
+
+            this.Position = startingPosition;
+
+            this.font = font;
+            this.Texture = texture;
+
+            Collision = new Rectangle();
+            Vector2 textSize = this.font.MeasureString(WordToDisplay.Word);
+
+            Collision.X = (int)this.Position.X;
+            Collision.Y = (int)this.Position.Y;
+            Collision.Width = (int)textSize.X;
+            Collision.Height = (int)textSize.Y;
+
+            if (this.WordToDisplay.Comment)
+                wordColor = Color.DarkGreen;
+            else if (IsWordAKeyword())
+                wordColor = Color.Blue;
+            else
+                wordColor = Color.Black;
+        }
+
+        public override void Update(GameTime gameTime)
+        {
+            Position.X -= CurrentSpeed;
+            Collision.X = (int)this.Position.X;
+            Collision.Y = (int)this.Position.Y;
+
+            if (Position.X + Collision.Width < 0)
+                Alive = false;
+        }
+
+        public override void Draw(GameTime gameTime, SpriteBatch spriteBatch)
+        {
+            spriteBatch.Draw(Texture, Collision, Color.White);
+
+            spriteBatch.DrawString(font, WordToDisplay.Word, Position, wordColor);
+        }
+
+        public bool IsWordAKeyword()
+        {
+            // This won't be perfect, oh well.
+            string[] keywords = new string[] {"abstract", "event", "new", "struct",
+                                              "as", "explicit", "null", "switch",
+                                              "base", "extern", "object", "this",
+                                              "bool", "false", "operator", "throw",
+                                              "break", "finally", "out", "true",
+                                              "byte", "fixed", "override", "try",
+                                              "case", "float", "params", "typeof",
+                                              "catch", "for", "private", "uint",
+                                              "char", "foreach", "protected", "ulong",
+                                              "checked", "goto", "public", "unchecked",
+                                              "class", "if", "readonly", "unsafe",
+                                              "const", "implicit", "ref", "ushort",
+                                              "continue", "in", "return", "using",
+                                              "decimal", "int", "sbyte", "virtual",
+                                              "default", "interface", "sealed", "volatile",
+                                              "delegate", "internal", "short", "void",
+                                              "do", "is", "sizeof", "while",
+                                              "double", "lock", "stackalloc",
+                                              "else", "long", "static",
+                                              "enum", "namespace", "string"};
+            return Array.Exists(keywords, FindWordInKeyords);
+        }
+
+        private bool FindWordInKeyords(string keyword)
+        {
+            return this.WordToDisplay.Word == keyword;
+        }
+    }
+}

RunEscape/RunEscape/RunEscape/WordManager.cs

+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using Microsoft.Xna.Framework;
+using Microsoft.Xna.Framework.Content;
+using Microsoft.Xna.Framework.Graphics;
+
+namespace RunEscape
+{
+    class WordManager
+    {
+        int SPACE_GAP = 60;
+        int NEWLINE_GAP = 200;
+
+        public Vector2 StartingPosition;
+        Vector2 levelInformationPosition;
+
+        public Queue<Word> StreamingWords;
+        Queue<LevelWordPair> UpcomingWords;
+
+        public int Score { get; set; }
+
+        private int width;
+        private int height;
+        private SpriteFont font;
+        private Texture2D texture;
+
+        public WordManager(int width, int height)
+        {
+            this.width = width;
+            this.height = height;
+
+            StartingPosition = new Vector2(width / 8, height * 4 / 5);
+            levelInformationPosition = new Vector2(width / 2, height / 8);
+
+            StreamingWords = new Queue<Word>();
+            UpcomingWords = new Queue<LevelWordPair>();
+        }
+
+        public void LoadContent(ContentManager content)
+        {
+            this.texture = content.Load<Texture2D>("ObjectBackground");
+            this.font = content.Load<SpriteFont>("Word");
+
+
+            string[] filePaths = Directory.GetFiles(".", "*.cs");
+            var levels = new Dictionary<String, Queue<string>>();
+
+
+            foreach (var path in filePaths)
+            {
+                string text = System.IO.File.ReadAllText(path);
+                string level = path.Split('\\').Last();
+                AddWordsToQueue(text, level);
+            }
+
+            if (StreamingWords.Count == 0)
+            {
+
+                var startingWords = WordifyLine(StartingPosition);
+                foreach (var word in startingWords)
+                    StreamingWords.Enqueue(word);
+            }
+        }
+
+        public void AddWordsToQueue(string words, string level)
+        {
+            var newLineDeliminatedWords = words.Split(new Char[] {'\n', '\r'});
+
+            foreach (var line in newLineDeliminatedWords)
+            {
+                var spaceDeliminatedWords = line.Split(' ');
+
+                bool comment = false;
+                bool wordsAdded = false;
+                foreach (var word in spaceDeliminatedWords)
+                {
+                    var trimmedWord = word.Trim();
+                    if (trimmedWord.Length > 0)
+                    {
+                        if (trimmedWord.Length >= 2)
+                        {
+                            // This ignores the possibilty that a comment could be up against code. Oh well.
+                            if (trimmedWord[0] == '/' && trimmedWord[1] == '/')
+                                comment = true;
+                        }
+                        UpcomingWords.Enqueue(new LevelWordPair(level, trimmedWord, comment));
+                        UpcomingWords.Enqueue(new LevelWordPair(level, " ", comment));
+                        wordsAdded = true;
+                    }
+                }
+                if (wordsAdded)
+                    UpcomingWords.Enqueue(new LevelWordPair(level, "\n", comment));
+            }
+        }
+
+        public List<Word> WordifyLine(Vector2 position)
+        {
+            List<Word> newWords = new List<Word>();
+            LevelWordPair nextWord;
+
+            if (UpcomingWords.Count == 0)
+                return newWords;
+
+            do
+            {
+                nextWord = UpcomingWords.Dequeue();
+                position.X += SPACE_GAP;
+            }
+            while (nextWord.Word == " " && UpcomingWords.Count != 0);
+
+            while (nextWord.Word != "\n" && UpcomingWords.Count != 0)
+            {
+                var newWord = new Word(nextWord, position, font, texture);
+                position.X += newWord.Collision.Width;
+                newWords.Add(newWord);
+
+                do
+                {
+                    nextWord = UpcomingWords.Dequeue();
+                    position.X += SPACE_GAP;
+                }
+                while (nextWord.Word == " " && UpcomingWords.Count != 0);
+            }
+
+            return newWords;
+        }
+
+        public void Update(GameTime gameTime, int speed)
+        {
+            foreach (var word in StreamingWords)
+            {
+                word.CurrentSpeed = speed;
+                word.Update(gameTime);
+            }
+
+            AddNewWords();
+            
+            RemoveDeadWords();
+        }
+
+        private void AddNewWords()
+        {
+            var position = StartingPosition;
+            Word lastWord = null;
+
+            if (StreamingWords.Count > 0)
+            {
+                lastWord = StreamingWords.Last<Word>();
+                position = lastWord.Position;
+            }
+
+            int space = height - (int)position.Y;
+
+            if (space > 0)
+            {
+                var newPosition = position;
+                if (lastWord != null)
+                    newPosition.X += NEWLINE_GAP + lastWord.Collision.Width;
+                var newWords = WordifyLine(newPosition);
+
+                foreach (var word in newWords)
+                    StreamingWords.Enqueue(word);
+            }
+        }
+
+        public void RemoveDeadWords()
+        {
+            while (StreamingWords.Count > 0 && !StreamingWords.Peek().Alive)
+            {
+                StreamingWords.Dequeue();
+                Score++;
+            }
+        }
+
+        public void Draw(GameTime gameTime, SpriteBatch spriteBatch)
+        {
+            DrawLevelInformation(gameTime, spriteBatch);
+            DrawScoreInformation(gameTime, spriteBatch);
+
+            foreach (var word in StreamingWords)
+            {
+                if (word.Position.X > width)
+                    break;
+                word.Draw(gameTime, spriteBatch);
+            }
+        }
+
+        public void DrawLevelInformation(GameTime gameTime, SpriteBatch spriteBatch)
+        {
+            string level;
+            if (StreamingWords.Count > 0)
+                level = StreamingWords.Peek().WordToDisplay.Level;
+            else
+                level = "Congratulations, you win!";
+
+            var positionToDraw = levelInformationPosition;
+            positionToDraw.X -= font.MeasureString(level).X / 2;
+
+            spriteBatch.DrawString(font, level, positionToDraw, Color.White);
+        }
+
+        public void DrawScoreInformation(GameTime gameTime, SpriteBatch spriteBatch)
+        {
+            string score = string.Format("{0}", Score);
+
+            var positionToDraw = new Vector2(width, 0);
+            positionToDraw.X -= font.MeasureString(score).X + 10;
+
+            spriteBatch.DrawString(font, score, positionToDraw, Color.White);
+        }
+    }
+}
+//Congratulations!_You_have_made_it_to_the_end_of_the_game._If_you_actually_made_it_this_far,_I_salute_you._I_haven't_even_tried_to_make_it_through_all_of_the_code._Make_sure_to_jump_so_that_the_Ludum_Dare_monster_will_eat_the_rest_of_the_words._JUMP!
Add a comment to this file

RunEscape/RunEscape/RunEscapeContent/Enemy.png

Added
New image
Add a comment to this file

RunEscape/RunEscape/RunEscapeContent/ObjectBackground.png

Added
New image

RunEscape/RunEscape/RunEscapeContent/RunEscapeContent.contentproj

+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <ProjectGuid>{8831316F-C2D9-460E-BD31-F033DA55E212}</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>
+    <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'">
+    <PlatformTarget>x86</PlatformTarget>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
+    <PlatformTarget>x86</PlatformTarget>
+  </PropertyGroup>
+  <PropertyGroup>
+    <RootNamespace>RunEscapeContent</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="Word.spritefont">
+      <Name>Word</Name>
+      <Importer>FontDescriptionImporter</Importer>
+      <Processor>FontDescriptionProcessor</Processor>
+    </Compile>
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="ObjectBackground.png">
+      <Name>ObjectBackground</Name>
+      <Importer>TextureImporter</Importer>
+      <Processor>TextureProcessor</Processor>
+    </Compile>
+  </ItemGroup>
+  <ItemGroup>
+    <BootstrapperPackage Include=".NETFramework,Version=v4.0">
+      <Visible>False</Visible>
+      <ProductName>Microsoft .NET Framework 4 %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>
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="Enemy.png">
+      <Name>Enemy</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>

RunEscape/RunEscape/RunEscapeContent/Word.spritefont

+<?xml version="1.0" encoding="utf-8"?>
+<!--
+This file contains an xml description of a font, and will be read by the XNA
+Framework Content Pipeline. Follow the comments to customize the appearance
+of the font in your game, and to change the characters which are available to draw
+with.
+-->
+<XnaContent xmlns:Graphics="Microsoft.Xna.Framework.Content.Pipeline.Graphics">
+  <Asset Type="Graphics:FontDescription">
+
+    <!--
+    Modify this string to change the font that will be imported.
+    -->
+    <FontName>Segoe UI Mono</FontName>
+
+    <!--
+    Size is a float value, measured in points. Modify this value to change
+    the size of the font.
+    -->
+    <Size>18</Size>
+
+    <!--
+    Spacing is a float value, measured in pixels. Modify this value to change
+    the amount of spacing in between characters.
+    -->
+    <Spacing>0</Spacing>
+
+    <!--
+    UseKerning controls the layout of the font. If this value is true, kerning information
+    will be used when placing characters.
+    -->
+    <UseKerning>true</UseKerning>
+
+    <!--
+    Style controls the style of the font. Valid entries are "Regular", "Bold", "Italic",
+    and "Bold, Italic", and are case sensitive.
+    -->
+    <Style>Regular</Style>
+
+    <!--
+    If you uncomment this line, the default character will be substituted if you draw
+    or measure text that contains characters which were not included in the font.
+    -->
+    <!-- <DefaultCharacter>*</DefaultCharacter> -->
+
+    <!--
+    CharacterRegions control what letters are available in the font. Every
+    character from Start to End will be built and made available for drawing. The
+    default range is from 32, (ASCII space), to 126, ('~'), covering the basic Latin
+    character set. The characters are ordered according to the Unicode standard.
+    See the documentation for more information.
+    -->
+    <CharacterRegions>
+      <CharacterRegion>
+        <Start>&#32;</Start>
+        <End>&#126;</End>
+      </CharacterRegion>
+    </CharacterRegions>
+  </Asset>
+</XnaContent>
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.