Browse Source

Bouncing Box update to SDK and MG 3.8.*

CartBlanche 3 weeks ago
parent
commit
5c39bc231a
100 changed files with 0 additions and 5948 deletions
  1. 0 140
      BookSourceCode/XNAGameDevelopmentbyExampleCode/AsteroidBeltAssault/AsteroidBeltAssault.Linux.csproj
  2. 0 100
      BookSourceCode/XNAGameDevelopmentbyExampleCode/AsteroidBeltAssault/AsteroidBeltAssault.MacOS.csproj
  3. 0 35
      BookSourceCode/XNAGameDevelopmentbyExampleCode/AsteroidBeltAssault/AsteroidBeltAssault.sln
  4. 0 210
      BookSourceCode/XNAGameDevelopmentbyExampleCode/AsteroidBeltAssault/AsteroidManager.cs
  5. 0 144
      BookSourceCode/XNAGameDevelopmentbyExampleCode/AsteroidBeltAssault/CollisionManager.cs
  6. BIN
      BookSourceCode/XNAGameDevelopmentbyExampleCode/AsteroidBeltAssault/Content/Fonts/Pericles14.xnb
  7. BIN
      BookSourceCode/XNAGameDevelopmentbyExampleCode/AsteroidBeltAssault/Content/Sounds/Explosion1.xnb
  8. BIN
      BookSourceCode/XNAGameDevelopmentbyExampleCode/AsteroidBeltAssault/Content/Sounds/Explosion2.xnb
  9. BIN
      BookSourceCode/XNAGameDevelopmentbyExampleCode/AsteroidBeltAssault/Content/Sounds/Explosion3.xnb
  10. BIN
      BookSourceCode/XNAGameDevelopmentbyExampleCode/AsteroidBeltAssault/Content/Sounds/Explosion4.xnb
  11. BIN
      BookSourceCode/XNAGameDevelopmentbyExampleCode/AsteroidBeltAssault/Content/Sounds/Shot1.xnb
  12. BIN
      BookSourceCode/XNAGameDevelopmentbyExampleCode/AsteroidBeltAssault/Content/Sounds/Shot2.xnb
  13. BIN
      BookSourceCode/XNAGameDevelopmentbyExampleCode/AsteroidBeltAssault/Content/Textures/SpriteSheet.xnb
  14. BIN
      BookSourceCode/XNAGameDevelopmentbyExampleCode/AsteroidBeltAssault/Content/Textures/TitleScreen.xnb
  15. 0 123
      BookSourceCode/XNAGameDevelopmentbyExampleCode/AsteroidBeltAssault/Enemy.cs
  16. 0 195
      BookSourceCode/XNAGameDevelopmentbyExampleCode/AsteroidBeltAssault/EnemyManager.cs
  17. 0 132
      BookSourceCode/XNAGameDevelopmentbyExampleCode/AsteroidBeltAssault/ExplosionManager.cs
  18. BIN
      BookSourceCode/XNAGameDevelopmentbyExampleCode/AsteroidBeltAssault/Game.ico
  19. 0 318
      BookSourceCode/XNAGameDevelopmentbyExampleCode/AsteroidBeltAssault/Game1.cs
  20. BIN
      BookSourceCode/XNAGameDevelopmentbyExampleCode/AsteroidBeltAssault/GameThumbnail.png
  21. 0 16
      BookSourceCode/XNAGameDevelopmentbyExampleCode/AsteroidBeltAssault/Info.plist
  22. 0 92
      BookSourceCode/XNAGameDevelopmentbyExampleCode/AsteroidBeltAssault/Particle.cs
  23. 0 174
      BookSourceCode/XNAGameDevelopmentbyExampleCode/AsteroidBeltAssault/PlayerManager.cs
  24. 0 60
      BookSourceCode/XNAGameDevelopmentbyExampleCode/AsteroidBeltAssault/Program.cs
  25. 0 10
      BookSourceCode/XNAGameDevelopmentbyExampleCode/AsteroidBeltAssault/README.md
  26. 0 95
      BookSourceCode/XNAGameDevelopmentbyExampleCode/AsteroidBeltAssault/ShotManager.cs
  27. 0 81
      BookSourceCode/XNAGameDevelopmentbyExampleCode/AsteroidBeltAssault/SoundManager.cs
  28. 0 173
      BookSourceCode/XNAGameDevelopmentbyExampleCode/AsteroidBeltAssault/Sprite.cs
  29. 0 65
      BookSourceCode/XNAGameDevelopmentbyExampleCode/AsteroidBeltAssault/StarField.cs
  30. BIN
      BookSourceCode/XNAGameDevelopmentbyExampleCode/FloodControl/Content/Fonts/Pericles36.xnb
  31. BIN
      BookSourceCode/XNAGameDevelopmentbyExampleCode/FloodControl/Content/Textures/Background.xnb
  32. BIN
      BookSourceCode/XNAGameDevelopmentbyExampleCode/FloodControl/Content/Textures/Tile_Sheet.xnb
  33. BIN
      BookSourceCode/XNAGameDevelopmentbyExampleCode/FloodControl/Content/Textures/TitleScreen.xnb
  34. 0 28
      BookSourceCode/XNAGameDevelopmentbyExampleCode/FloodControl/FadingPiece.cs
  35. 0 28
      BookSourceCode/XNAGameDevelopmentbyExampleCode/FloodControl/FallingPiece.cs
  36. 0 98
      BookSourceCode/XNAGameDevelopmentbyExampleCode/FloodControl/FloodControl.Linux.csproj
  37. 0 90
      BookSourceCode/XNAGameDevelopmentbyExampleCode/FloodControl/FloodControl.MacOS.csproj
  38. 0 45
      BookSourceCode/XNAGameDevelopmentbyExampleCode/FloodControl/FloodControl.sln
  39. BIN
      BookSourceCode/XNAGameDevelopmentbyExampleCode/FloodControl/Game.ico
  40. 0 489
      BookSourceCode/XNAGameDevelopmentbyExampleCode/FloodControl/Game1.cs
  41. 0 261
      BookSourceCode/XNAGameDevelopmentbyExampleCode/FloodControl/GameBoard.cs
  42. 0 153
      BookSourceCode/XNAGameDevelopmentbyExampleCode/FloodControl/GamePiece.cs
  43. BIN
      BookSourceCode/XNAGameDevelopmentbyExampleCode/FloodControl/GameThumbnail.png
  44. 0 16
      BookSourceCode/XNAGameDevelopmentbyExampleCode/FloodControl/Info.plist
  45. 0 60
      BookSourceCode/XNAGameDevelopmentbyExampleCode/FloodControl/Program.cs
  46. 0 10
      BookSourceCode/XNAGameDevelopmentbyExampleCode/FloodControl/README.md
  47. 0 43
      BookSourceCode/XNAGameDevelopmentbyExampleCode/FloodControl/RotatingPiece.cs
  48. 0 44
      BookSourceCode/XNAGameDevelopmentbyExampleCode/FloodControl/ScoreZooms.cs
  49. 0 140
      BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/AnimationStrip.cs
  50. BIN
      BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/Content/Fonts/Pericles10Bold.xnb
  51. BIN
      BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/Content/Fonts/Pericles8.xnb
  52. BIN
      BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/Content/Maps/MAP000.MAP
  53. BIN
      BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/Content/Maps/MAP001.MAP
  54. BIN
      BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/Content/Textures/Gem.xnb
  55. BIN
      BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/Content/Textures/PlatformTiles.xnb
  56. BIN
      BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/Content/Textures/Sprites/Gem.xnb
  57. BIN
      BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/Content/Textures/Sprites/MonsterA/Die.xnb
  58. BIN
      BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/Content/Textures/Sprites/MonsterA/Idle.xnb
  59. BIN
      BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/Content/Textures/Sprites/MonsterA/Run.xnb
  60. BIN
      BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/Content/Textures/Sprites/MonsterB/Die.xnb
  61. BIN
      BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/Content/Textures/Sprites/MonsterB/Idle.xnb
  62. BIN
      BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/Content/Textures/Sprites/MonsterB/Run.xnb
  63. BIN
      BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/Content/Textures/Sprites/MonsterC/Die.xnb
  64. BIN
      BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/Content/Textures/Sprites/MonsterC/Idle.xnb
  65. BIN
      BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/Content/Textures/Sprites/MonsterC/Run.xnb
  66. BIN
      BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/Content/Textures/Sprites/MonsterD/Die.xnb
  67. BIN
      BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/Content/Textures/Sprites/MonsterD/Idle.xnb
  68. BIN
      BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/Content/Textures/Sprites/MonsterD/Run.xnb
  69. BIN
      BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/Content/Textures/Sprites/Player/Celebrate.xnb
  70. BIN
      BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/Content/Textures/Sprites/Player/Die.xnb
  71. BIN
      BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/Content/Textures/Sprites/Player/Idle.xnb
  72. BIN
      BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/Content/Textures/Sprites/Player/Jump.xnb
  73. BIN
      BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/Content/Textures/Sprites/Player/Run.xnb
  74. BIN
      BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/Content/Textures/TitleScreen.xnb
  75. 0 106
      BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/Enemy.cs
  76. BIN
      BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/Game.ico
  77. 0 229
      BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/Game1.cs
  78. 0 267
      BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/GameObject.cs
  79. BIN
      BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/GameThumbnail.png
  80. 0 40
      BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/Gemstone.cs
  81. 0 186
      BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/GemstoneHunter.Linux.csproj
  82. 0 115
      BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/GemstoneHunter.MacOS.csproj
  83. 0 43
      BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/GemstoneHunter.sln
  84. 0 16
      BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/Info.plist
  85. 0 171
      BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/LevelManager.cs
  86. 0 206
      BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/Player.cs
  87. 0 60
      BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/Program.cs
  88. 0 11
      BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/README.md
  89. 0 50
      BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/TileEngine/AssemblyInfo.cs
  90. 0 103
      BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/TileEngine/Camera.cs
  91. 0 43
      BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/TileEngine/MapSquare.cs
  92. 0 12
      BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/TileEngine/MyClass.cs
  93. 0 51
      BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/TileEngine/Tile Engine.Linux.csproj
  94. 0 55
      BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/TileEngine/Tile Engine.MacOS.csproj
  95. 0 335
      BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/TileEngine/TileMap.cs
  96. 0 89
      BookSourceCode/XNAGameDevelopmentbyExampleCode/RobotRampage/Camera.cs
  97. 0 92
      BookSourceCode/XNAGameDevelopmentbyExampleCode/RobotRampage/ComputerTerminal.cs
  98. BIN
      BookSourceCode/XNAGameDevelopmentbyExampleCode/RobotRampage/Content/Fonts/Pericles14.xnb
  99. BIN
      BookSourceCode/XNAGameDevelopmentbyExampleCode/RobotRampage/Content/Textures/SpriteSheet.xnb
  100. BIN
      BookSourceCode/XNAGameDevelopmentbyExampleCode/RobotRampage/Content/Textures/TitleScreen.xnb

+ 0 - 140
BookSourceCode/XNAGameDevelopmentbyExampleCode/AsteroidBeltAssault/AsteroidBeltAssault.Linux.csproj

@@ -1,140 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <PropertyGroup>
-    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
-    <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
-    <ProductVersion>9.0.21022</ProductVersion>
-    <SchemaVersion>2.0</SchemaVersion>
-    <ProjectGuid>{86A219E2-C8F0-452B-B762-C69D5BB07C99}</ProjectGuid>
-    <OutputType>Exe</OutputType>
-    <RootNamespace>AsteroidBeltAssault</RootNamespace>
-    <AssemblyName>FloodControl</AssemblyName>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
-    <DebugSymbols>True</DebugSymbols>
-    <DebugType>full</DebugType>
-    <Optimize>False</Optimize>
-    <OutputPath>bin\Debug</OutputPath>
-    <DefineConstants>DEBUG,LINUX</DefineConstants>
-    <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
-    <PlatformTarget>x86</PlatformTarget>
-    <ConsolePause>False</ConsolePause>
-    <EnvironmentVariables>
-      <EnvironmentVariables>
-        <Variable name="MONO_IOMAP" value="all" />
-      </EnvironmentVariables>
-    </EnvironmentVariables>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
-    <DebugType>none</DebugType>
-    <Optimize>False</Optimize>
-    <OutputPath>bin\Release</OutputPath>
-    <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
-    <PlatformTarget>x86</PlatformTarget>
-    <ConsolePause>False</ConsolePause>
-  </PropertyGroup>
-  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
-  <ItemGroup>
-    <Reference Include="System" />
-    <Reference Include="System.Xml" />
-    <Reference Include="System.Core" />
-    <Reference Include="System.Xml.Linq" />
-    <Reference Include="System.Drawing" />
-  </ItemGroup>
-  <ItemGroup>
-    <None Include="Game.ico">
-      <Link>Game.ico</Link>
-    </None>
-    <None Include="GameThumbnail.png">
-      <Link>GameThumbnail.png</Link>
-    </None>
-    <None Include="README.md">
-      <Link>README.md</Link>
-    </None>
-  </ItemGroup>
-  <ItemGroup>
-    <Folder Include="Content\" />
-    <Folder Include="Content\Fonts\" />
-  </ItemGroup>
-  <ItemGroup>
-    <Compile Include="AsteroidManager.cs">
-      <Link>AsteroidManager.cs</Link>
-    </Compile>
-    <Compile Include="CollisionManager.cs">
-      <Link>CollisionManager.cs</Link>
-    </Compile>
-    <Compile Include="Enemy.cs">
-      <Link>Enemy.cs</Link>
-    </Compile>
-    <Compile Include="EnemyManager.cs">
-      <Link>EnemyManager.cs</Link>
-    </Compile>
-    <Compile Include="ExplosionManager.cs">
-      <Link>ExplosionManager.cs</Link>
-    </Compile>
-    <Compile Include="Game1.cs">
-      <Link>Game1.cs</Link>
-    </Compile>
-    <Compile Include="Particle.cs">
-      <Link>Particle.cs</Link>
-    </Compile>
-    <Compile Include="PlayerManager.cs">
-      <Link>PlayerManager.cs</Link>
-    </Compile>
-    <Compile Include="ShotManager.cs">
-      <Link>ShotManager.cs</Link>
-    </Compile>
-    <Compile Include="SoundManager.cs">
-      <Link>SoundManager.cs</Link>
-    </Compile>
-    <Compile Include="Sprite.cs">
-      <Link>Sprite.cs</Link>
-    </Compile>
-    <Compile Include="StarField.cs">
-      <Link>StarField.cs</Link>
-    </Compile>
-    <Compile Include="Program.cs" />
-  </ItemGroup>
-  <ItemGroup>
-    <Content Include="Content\Fonts\Pericles14.xnb">
-      <Link>Content\Fonts\Pericles14.xnb</Link>
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
-    </Content>
-    <Content Include="Content\Sounds\Explosion1.xnb">
-      <Link>Content\Sounds\Explosion1.xnb</Link>
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
-    </Content>
-    <Content Include="Content\Sounds\Explosion2.xnb">
-      <Link>Content\Sounds\Explosion2.xnb</Link>
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
-    </Content>
-    <Content Include="Content\Sounds\Explosion3.xnb">
-      <Link>Content\Sounds\Explosion3.xnb</Link>
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
-    </Content>
-    <Content Include="Content\Sounds\Explosion4.xnb">
-      <Link>Content\Sounds\Explosion4.xnb</Link>
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
-    </Content>
-    <Content Include="Content\Sounds\Shot1.xnb">
-      <Link>Content\Sounds\Shot1.xnb</Link>
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
-    </Content>
-    <Content Include="Content\Sounds\Shot2.xnb">
-      <Link>Content\Sounds\Shot2.xnb</Link>
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
-    </Content>
-    <Content Include="Content\Textures\SpriteSheet.xnb">
-      <Link>Content\Textures\SpriteSheet.xnb</Link>
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
-    </Content>
-  </ItemGroup>
-  <ItemGroup>
-    <Resource Include="Content\Textures\TitleScreen.xnb">
-      <Link>Content\Textures\TitleScreen.xnb</Link>
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
-    </Resource>
-  </ItemGroup>
-</Project>

+ 0 - 100
BookSourceCode/XNAGameDevelopmentbyExampleCode/AsteroidBeltAssault/AsteroidBeltAssault.MacOS.csproj

@@ -1,100 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <PropertyGroup>
-    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
-    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
-    <ProductVersion>10.0.0</ProductVersion>
-    <SchemaVersion>2.0</SchemaVersion>
-    <ProjectGuid>{1585306B-CF46-479D-B234-1E10EDF4D741}</ProjectGuid>
-    <ProjectTypeGuids>{948B3504-5B70-4649-8FE4-BDE1FB46EC69};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
-    <OutputType>Exe</OutputType>
-    <RootNamespace>AsteroidBeltAssault</RootNamespace>
-    <AssemblyName>AsteroidBeltAssault</AssemblyName>
-    <SuppressXamMacUpsell>True</SuppressXamMacUpsell>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
-    <DebugSymbols>True</DebugSymbols>
-    <DebugType>full</DebugType>
-    <Optimize>False</Optimize>
-    <OutputPath>bin\Debug</OutputPath>
-    <DefineConstants>DEBUG;MONOMAC</DefineConstants>
-    <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
-    <ConsolePause>False</ConsolePause>
-    <EnableCodeSigning>False</EnableCodeSigning>
-    <CreatePackage>False</CreatePackage>
-    <EnablePackageSigning>False</EnablePackageSigning>
-    <IncludeMonoRuntime>False</IncludeMonoRuntime>
-    <UseSGen>False</UseSGen>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
-    <DebugType>none</DebugType>
-    <Optimize>False</Optimize>
-    <OutputPath>bin\Release</OutputPath>
-    <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
-    <ConsolePause>False</ConsolePause>
-    <EnableCodeSigning>False</EnableCodeSigning>
-    <CreatePackage>False</CreatePackage>
-    <EnablePackageSigning>False</EnablePackageSigning>
-    <IncludeMonoRuntime>False</IncludeMonoRuntime>
-    <DefineConstants>MONOMAC</DefineConstants>
-    <UseSGen>False</UseSGen>
-  </PropertyGroup>
-  <ItemGroup>
-    <Reference Include="System" />
-    <Reference Include="System.Xml" />
-    <Reference Include="System.Core" />
-    <Reference Include="System.Xml.Linq" />
-    <Reference Include="System.Drawing" />
-    <Reference Include="MonoMac" />
-  </ItemGroup>
-  <ItemGroup>
-    <None Include="Info.plist">
-    </None>
-    <None Include="Game.ico" />
-    <None Include="GameThumbnail.png" />
-    <None Include="README.md" />
-  </ItemGroup>
-  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
-  <Import Project="$(MSBuildExtensionsPath)\Mono\MonoMac\v0.0\Mono.MonoMac.targets" />
-  <ItemGroup>
-    <Folder Include="Content\" />
-  </ItemGroup>
-  <ItemGroup>
-    <Content Include="Content\Fonts\Pericles14.xnb" />
-    <Content Include="Content\Sounds\Explosion1.xnb" />
-    <Content Include="Content\Sounds\Explosion2.xnb" />
-    <Content Include="Content\Sounds\Explosion3.xnb" />
-    <Content Include="Content\Sounds\Explosion4.xnb" />
-    <Content Include="Content\Sounds\Shot1.xnb" />
-    <Content Include="Content\Sounds\Shot2.xnb" />
-    <Content Include="Content\Textures\SpriteSheet.xnb" />
-    <Content Include="Content\Textures\TitleScreen.xnb" />
-  </ItemGroup>
-  <ItemGroup>
-    <Compile Include="AsteroidManager.cs" />
-    <Compile Include="CollisionManager.cs" />
-    <Compile Include="Enemy.cs" />
-    <Compile Include="EnemyManager.cs" />
-    <Compile Include="ExplosionManager.cs" />
-    <Compile Include="Game1.cs" />
-    <Compile Include="Particle.cs" />
-    <Compile Include="PlayerManager.cs" />
-    <Compile Include="Program.cs" />
-    <Compile Include="ShotManager.cs" />
-    <Compile Include="SoundManager.cs" />
-    <Compile Include="Sprite.cs" />
-    <Compile Include="StarField.cs" />
-  </ItemGroup>
-  <ItemGroup>
-    <ProjectReference Include="..\..\..\..\ThirdParty\Lidgren.Network\Lidgren.Network.MacOS.csproj">
-      <Project>{AE483C29-042E-4226-BA52-D247CE7676DA}</Project>
-      <Name>Lidgren.Network.MacOS</Name>
-    </ProjectReference>
-    <ProjectReference Include="..\..\..\..\MonoGame.Framework\MonoGame.Framework.MacOS.csproj">
-      <Project>{36C538E6-C32A-4A8D-A39C-566173D7118E}</Project>
-      <Name>MonoGame.Framework.MacOS</Name>
-    </ProjectReference>
-  </ItemGroup>
-</Project>

+ 0 - 35
BookSourceCode/XNAGameDevelopmentbyExampleCode/AsteroidBeltAssault/AsteroidBeltAssault.sln

@@ -1,35 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 11.00
-# Visual Studio 2010
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AsteroidBeltAssault", "AsteroidBeltAssault.csproj", "{1585306B-CF46-479D-B234-1E10EDF4D741}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lidgren.Network", "..\..\..\..\..\..\..\Users\Jimmy\Public\Share\MonoMacSource\kjpgit\MonoGame\ThirdParty\Lidgren.Network\Lidgren.Network.csproj", "{AE483C29-042E-4226-BA52-D247CE7676DA}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MonoGame.Framework.MacOS", "..\..\..\..\..\..\..\Users\Jimmy\Public\Share\MonoMacSource\kjpgit\MonoGame\MonoGame.Framework\MonoGame.Framework.MacOS.csproj", "{36C538E6-C32A-4A8D-A39C-566173D7118E}"
-EndProject
-Global
-	GlobalSection(SolutionConfigurationPlatforms) = preSolution
-		Debug|Any CPU = Debug|Any CPU
-		Release|Any CPU = Release|Any CPU
-		Distribution|Any CPU = Distribution|Any CPU
-	EndGlobalSection
-	GlobalSection(ProjectConfigurationPlatforms) = postSolution
-		{1585306B-CF46-479D-B234-1E10EDF4D741}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{1585306B-CF46-479D-B234-1E10EDF4D741}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{1585306B-CF46-479D-B234-1E10EDF4D741}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{1585306B-CF46-479D-B234-1E10EDF4D741}.Release|Any CPU.Build.0 = Release|Any CPU
-		{36C538E6-C32A-4A8D-A39C-566173D7118E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{36C538E6-C32A-4A8D-A39C-566173D7118E}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{36C538E6-C32A-4A8D-A39C-566173D7118E}.Distribution|Any CPU.ActiveCfg = Distribution|Any CPU
-		{36C538E6-C32A-4A8D-A39C-566173D7118E}.Distribution|Any CPU.Build.0 = Distribution|Any CPU
-		{36C538E6-C32A-4A8D-A39C-566173D7118E}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{36C538E6-C32A-4A8D-A39C-566173D7118E}.Release|Any CPU.Build.0 = Release|Any CPU
-		{AE483C29-042E-4226-BA52-D247CE7676DA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{AE483C29-042E-4226-BA52-D247CE7676DA}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{AE483C29-042E-4226-BA52-D247CE7676DA}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{AE483C29-042E-4226-BA52-D247CE7676DA}.Release|Any CPU.Build.0 = Release|Any CPU
-	EndGlobalSection
-	GlobalSection(MonoDevelopProperties) = preSolution
-		StartupItem = AsteroidBeltAssault.csproj
-	EndGlobalSection
-EndGlobal

+ 0 - 210
BookSourceCode/XNAGameDevelopmentbyExampleCode/AsteroidBeltAssault/AsteroidManager.cs

@@ -1,210 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using Microsoft.Xna.Framework;
-using Microsoft.Xna.Framework.Graphics;
-
-namespace Asteroid_Belt_Assault
-{
-    class AsteroidManager
-    {
-        private int screenWidth = 800;
-        private int screenHeight = 600;
-        private int screenPadding = 10;
-
-        private Rectangle initialFrame;
-        private int asteroidFrames;
-        private Texture2D texture;
-
-        public List<Sprite> Asteroids = new List<Sprite>();
-        private int minSpeed = 60;
-        private int maxSpeed = 120;
-
-        private Random rand = new Random();
-
-        public void AddAsteroid()
-        {
-            Sprite newAsteroid = new Sprite(
-                new Vector2(-500, -500),
-                texture,
-                initialFrame,
-                Vector2.Zero);
-            for (int x = 1; x < asteroidFrames; x++)
-            {
-                newAsteroid.AddFrame(new Rectangle(
-                    initialFrame.X + (initialFrame.Width * x),
-                    initialFrame.Y,
-                    initialFrame.Width,
-                    initialFrame.Height));
-            }
-            newAsteroid.Rotation =
-                MathHelper.ToRadians((float)rand.Next(0, 360));
-            newAsteroid.CollisionRadius = 15;
-            Asteroids.Add(newAsteroid);
-        }
-
-        public void Clear()
-        {
-            Asteroids.Clear();
-        }
-
-        public AsteroidManager(
-            int asteroidCount,
-            Texture2D texture,
-            Rectangle initialFrame,
-            int asteroidFrames,    
-            int screenWidth,
-            int screenHeight)
-        {
-            this.texture = texture;
-            this.initialFrame = initialFrame;
-            this.asteroidFrames = asteroidFrames;
-            this.screenWidth = screenWidth;
-            this.screenHeight = screenHeight;
-            for (int x = 0; x < asteroidCount; x++)
-            {
-                AddAsteroid();
-            }
-        }
-
-        private Vector2 randomLocation()
-        {
-            Vector2 location = Vector2.Zero;
-            bool locationOK = true;
-            int tryCount = 0;
-
-            do
-            {
-                locationOK = true;
-                switch (rand.Next(0, 3))
-                {
-                    case 0:
-                        location.X = -initialFrame.Width;
-                        location.Y = rand.Next(0, screenHeight);
-                        break;
-
-                    case 1:
-                        location.X = screenWidth;
-                        location.Y = rand.Next(0, screenHeight);
-                        break;
-
-                    case 2:
-                        location.X = rand.Next(0, screenWidth);
-                        location.Y = -initialFrame.Height;
-                        break;
-
-                }
-                foreach (Sprite asteroid in Asteroids)
-                {
-                    if (asteroid.IsBoxColliding(
-                        new Rectangle(
-                            (int)location.X,
-                            (int)location.Y,
-                            initialFrame.Width,
-                            initialFrame.Height)))
-                    {
-                        locationOK = false;
-                    }
-                }
-                tryCount++;
-                if ((tryCount > 5) && locationOK == false)
-                {
-                    location = new Vector2(-500, -500);
-                    locationOK = true;
-                }
-            } while (locationOK == false);
-
-            return location;
-        }
-
-        private Vector2 randomVelocity()
-        {
-            Vector2 velocity = new Vector2(
-                rand.Next(0, 101) - 50,
-                rand.Next(0, 101) - 50);
-            velocity.Normalize();
-            velocity *= rand.Next(minSpeed, maxSpeed);
-            return velocity;
-        }
-
-        private bool isOnScreen(Sprite asteroid)
-        {
-            if (asteroid.Destination.Intersects(
-                new Rectangle(
-                    -screenPadding,
-                    -screenPadding,
-                    screenWidth + screenPadding,
-                    screenHeight + screenPadding)
-                    )
-                )
-            {
-                return true;
-            }
-            else
-            {
-                return false;
-            }
-        }
-
-        private void BounceAsteroids(Sprite asteroid1, Sprite asteroid2)
-        {
-            {
-                Vector2 cOfMass = (asteroid1.Velocity +
-                    asteroid2.Velocity) / 2;
-
-                Vector2 normal1 = asteroid2.Center - asteroid1.Center;
-                normal1.Normalize();
-                Vector2 normal2 = asteroid1.Center - asteroid2.Center;
-                normal2.Normalize();
-
-                asteroid1.Velocity -= cOfMass;
-                asteroid1.Velocity =
-                    Vector2.Reflect(asteroid1.Velocity, normal1);
-                asteroid1.Velocity += cOfMass;
-
-                asteroid2.Velocity -= cOfMass;
-                asteroid2.Velocity =
-                    Vector2.Reflect(asteroid2.Velocity, normal2);
-
-                asteroid2.Velocity += cOfMass;
-            }
-        }
-
-        public void Update(GameTime gameTime)
-        {
-            foreach (Sprite asteroid in Asteroids)
-            {
-                asteroid.Update(gameTime);
-                if (!isOnScreen(asteroid))
-                {
-                    asteroid.Location = randomLocation();
-                    asteroid.Velocity = randomVelocity();
-                }
-            }
-
-            for (int x = 0; x < Asteroids.Count; x++)
-            {
-                for (int y = x + 1; y < Asteroids.Count; y++)
-                {
-                    if (Asteroids[x].IsCircleColliding(
-                        Asteroids[y].Center, Asteroids[y].CollisionRadius))
-                    {
-                        BounceAsteroids(Asteroids[x], Asteroids[y]);
-                    }
-                }
-            }
-        }
-
-
-        public void Draw(SpriteBatch spriteBatch)
-        {
-            foreach (Sprite asteroid in Asteroids)
-            {
-                asteroid.Draw(spriteBatch);
-            }
-        }
-
-
-    }
-}

+ 0 - 144
BookSourceCode/XNAGameDevelopmentbyExampleCode/AsteroidBeltAssault/CollisionManager.cs

@@ -1,144 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using Microsoft.Xna.Framework;
-
-namespace Asteroid_Belt_Assault
-{
-    class CollisionManager
-    {
-        private AsteroidManager asteroidManager;
-        private PlayerManager playerManager;
-        private EnemyManager enemyManager;
-        private ExplosionManager explosionManager;
-        private Vector2 offScreen = new Vector2(-500, -500);
-        private Vector2 shotToAsteroidImpact = new Vector2(0, -20);
-        private int enemyPointValue = 100;
-
-        public CollisionManager(
-            AsteroidManager asteroidManager,
-            PlayerManager playerManager,
-            EnemyManager enemyManager,
-            ExplosionManager explosionManager)
-        {
-            this.asteroidManager = asteroidManager;
-            this.playerManager = playerManager;
-            this.enemyManager = enemyManager;
-            this.explosionManager = explosionManager;
-        }
-
-        private void checkShotToEnemyCollisions()
-        {
-            foreach (Sprite shot in playerManager.PlayerShotManager.Shots)
-            {
-                foreach (Enemy enemy in enemyManager.Enemies)
-                {
-                    if (shot.IsCircleColliding(
-                        enemy.EnemySprite.Center,
-                        enemy.EnemySprite.CollisionRadius))
-                    {
-                        shot.Location = offScreen;
-                        enemy.Destroyed = true;
-                        playerManager.PlayerScore += enemyPointValue;
-                        explosionManager.AddExplosion(
-                            enemy.EnemySprite.Center,
-                            enemy.EnemySprite.Velocity / 10);
-                    }
-
-                }
-            }
-        }
-
-        private void checkShotToAsteroidCollisions()
-        {
-            foreach (Sprite shot in playerManager.PlayerShotManager.Shots)
-            {
-                foreach (Sprite asteroid in asteroidManager.Asteroids)
-                {
-                    if (shot.IsCircleColliding(
-                        asteroid.Center,
-                        asteroid.CollisionRadius))
-                    {
-                        shot.Location = offScreen;
-                        asteroid.Velocity += shotToAsteroidImpact;
-                    }
-                }
-            }
-        }
-
-        private void checkShotToPlayerCollisions()
-        {
-            foreach (Sprite shot in enemyManager.EnemyShotManager.Shots)
-            {
-                if (shot.IsCircleColliding(
-                    playerManager.playerSprite.Center,
-                    playerManager.playerSprite.CollisionRadius))
-                {
-                    shot.Location = offScreen;
-                    playerManager.Destroyed = true;
-                    explosionManager.AddExplosion(
-                        playerManager.playerSprite.Center,
-                        Vector2.Zero);
-                }
-            }
-        }
-
-        private void checkEnemyToPlayerCollisions()
-        {
-            foreach (Enemy enemy in enemyManager.Enemies)
-            {
-                if (enemy.EnemySprite.IsCircleColliding(
-                    playerManager.playerSprite.Center,
-                    playerManager.playerSprite.CollisionRadius))
-                {
-                    enemy.Destroyed = true;
-                    explosionManager.AddExplosion(
-                        enemy.EnemySprite.Center,
-                        enemy.EnemySprite.Velocity / 10);
-
-                    playerManager.Destroyed = true;
-
-                    explosionManager.AddExplosion(
-                        playerManager.playerSprite.Center,
-                        Vector2.Zero);
-                }
-            }
-        }
-
-        private void checkAsteroidToPlayerCollisions()
-        {
-            foreach (Sprite asteroid in asteroidManager.Asteroids)
-            {
-                if (asteroid.IsCircleColliding(
-                    playerManager.playerSprite.Center,
-                    playerManager.playerSprite.CollisionRadius))
-                {
-                    explosionManager.AddExplosion(
-                        asteroid.Center,
-                        asteroid.Velocity / 10);
-
-                    asteroid.Location = offScreen;
-
-                    playerManager.Destroyed = true;
-                    explosionManager.AddExplosion(
-                        playerManager.playerSprite.Center,
-                        Vector2.Zero);
-                }
-            }
-        }
-
-        public void CheckCollisions()
-        {
-            checkShotToEnemyCollisions();
-            checkShotToAsteroidCollisions();
-            if (!playerManager.Destroyed)
-            {
-                checkShotToPlayerCollisions();
-                checkEnemyToPlayerCollisions();
-                checkAsteroidToPlayerCollisions();
-            }
-        }
-
-    }
-}

BIN
BookSourceCode/XNAGameDevelopmentbyExampleCode/AsteroidBeltAssault/Content/Fonts/Pericles14.xnb


BIN
BookSourceCode/XNAGameDevelopmentbyExampleCode/AsteroidBeltAssault/Content/Sounds/Explosion1.xnb


BIN
BookSourceCode/XNAGameDevelopmentbyExampleCode/AsteroidBeltAssault/Content/Sounds/Explosion2.xnb


BIN
BookSourceCode/XNAGameDevelopmentbyExampleCode/AsteroidBeltAssault/Content/Sounds/Explosion3.xnb


BIN
BookSourceCode/XNAGameDevelopmentbyExampleCode/AsteroidBeltAssault/Content/Sounds/Explosion4.xnb


BIN
BookSourceCode/XNAGameDevelopmentbyExampleCode/AsteroidBeltAssault/Content/Sounds/Shot1.xnb


BIN
BookSourceCode/XNAGameDevelopmentbyExampleCode/AsteroidBeltAssault/Content/Sounds/Shot2.xnb


BIN
BookSourceCode/XNAGameDevelopmentbyExampleCode/AsteroidBeltAssault/Content/Textures/SpriteSheet.xnb


BIN
BookSourceCode/XNAGameDevelopmentbyExampleCode/AsteroidBeltAssault/Content/Textures/TitleScreen.xnb


+ 0 - 123
BookSourceCode/XNAGameDevelopmentbyExampleCode/AsteroidBeltAssault/Enemy.cs

@@ -1,123 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using Microsoft.Xna.Framework;
-using Microsoft.Xna.Framework.Graphics;
-
-namespace Asteroid_Belt_Assault
-{
-    class Enemy
-    {
-        public Sprite EnemySprite;
-        public Vector2 gunOffset = new Vector2(25, 25);
-        private Queue<Vector2> waypoints = new Queue<Vector2>();
-        private Vector2 currentWaypoint = Vector2.Zero;
-        private float speed = 120f;
-        public bool Destroyed = false;
-        private int enemyRadius = 15;
-        private Vector2 previousLocation = Vector2.Zero;
-
-        public Enemy(
-            Texture2D texture,
-            Vector2 location,
-            Rectangle initialFrame,
-            int frameCount)
-        {
-            EnemySprite = new Sprite(
-                location,
-                texture,
-                initialFrame,
-                Vector2.Zero);
-
-            for (int x = 1; x < frameCount; x++)
-            {
-                EnemySprite.AddFrame(
-                    new Rectangle(
-                    initialFrame.X = (initialFrame.Width * x),
-                    initialFrame.Y,
-                    initialFrame.Width,
-                    initialFrame.Height));
-            }
-            previousLocation = location;
-            currentWaypoint = location;
-            EnemySprite.CollisionRadius = enemyRadius;
-        }
-
-        public void AddWaypoint(Vector2 waypoint)
-        {
-            waypoints.Enqueue(waypoint);
-        }
-
-        public bool WaypointReached()
-        {
-            if (Vector2.Distance(EnemySprite.Location, currentWaypoint) <
-                (float)EnemySprite.Source.Width / 2)
-            {
-                return true;
-            }
-            else
-            {
-                return false;
-            }
-        }
-
-        public bool IsActive()
-        {
-            if (Destroyed)
-            {
-                return false;
-            }
-
-            if (waypoints.Count > 0)
-            {
-                return true;
-            }
-
-            if (WaypointReached())
-            {
-                return false;
-            }
-
-            return true;
-        }
-
-        public void Update(GameTime gameTime)
-        {
-            if (IsActive())
-            {
-                Vector2 heading = currentWaypoint - EnemySprite.Location;
-                if (heading != Vector2.Zero)
-                {
-                    heading.Normalize();
-                }
-                heading *= speed;
-                EnemySprite.Velocity = heading;
-                previousLocation = EnemySprite.Location;
-                EnemySprite.Update(gameTime);
-                EnemySprite.Rotation =
-                    (float)Math.Atan2(
-                    EnemySprite.Location.Y - previousLocation.Y,
-                    EnemySprite.Location.X - previousLocation.X);
-
-                if (WaypointReached())
-                {
-                    if (waypoints.Count > 0)
-                    {
-                        currentWaypoint = waypoints.Dequeue();
-                    }
-                }
-            }
-        }
-
-        public void Draw(SpriteBatch spriteBatch)
-        {
-            if (IsActive())
-            {
-                EnemySprite.Draw(spriteBatch);
-            }
-        }
-
-
-    }
-}

+ 0 - 195
BookSourceCode/XNAGameDevelopmentbyExampleCode/AsteroidBeltAssault/EnemyManager.cs

@@ -1,195 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using Microsoft.Xna.Framework;
-using Microsoft.Xna.Framework.Graphics;
-
-namespace Asteroid_Belt_Assault
-{
-    class EnemyManager
-    {
-        private Texture2D texture;
-        private Rectangle initialFrame;
-        private int frameCount;
-
-        public List<Enemy> Enemies = new List<Enemy>();
-
-        public ShotManager EnemyShotManager;
-        private PlayerManager playerManager;
-
-        public int MinShipsPerWave = 5;
-        public int MaxShipsPerWave = 8;
-        private float nextWaveTimer = 0.0f;
-        private float nextWaveMinTimer = 8.0f;
-        private float shipSpawnTimer = 0.0f;
-        private float shipSpawnWaitTime = 0.5f;
-
-        private float shipShotChance = 0.2f;
-
-        private List<List<Vector2>> pathWaypoints =
-            new List<List<Vector2>>();
-
-        private Dictionary<int, int> waveSpawns = new Dictionary<int, int>();
-
-        public bool Active = false;
-
-        private Random rand = new Random();
-
-        private void setUpWaypoints()
-        {
-            List<Vector2> path0 = new List<Vector2>();
-            path0.Add(new Vector2(850, 300));
-            path0.Add(new Vector2(-100, 300));
-            pathWaypoints.Add(path0);
-            waveSpawns[0] = 0;
-
-            List<Vector2> path1 = new List<Vector2>();
-            path1.Add(new Vector2(-50, 225));
-            path1.Add(new Vector2(850, 225));
-            pathWaypoints.Add(path1);
-            waveSpawns[1] = 0;
-
-            List<Vector2> path2 = new List<Vector2>();
-            path2.Add(new Vector2(-100, 50));
-            path2.Add(new Vector2(150, 50));
-            path2.Add(new Vector2(200, 75));
-            path2.Add(new Vector2(200, 125));
-            path2.Add(new Vector2(150, 150));
-            path2.Add(new Vector2(150, 175));
-            path2.Add(new Vector2(200, 200));
-            path2.Add(new Vector2(600, 200));
-            path2.Add(new Vector2(850, 600));
-            pathWaypoints.Add(path2);
-            waveSpawns[2] = 0;
-
-            List<Vector2> path3 = new List<Vector2>();
-            path3.Add(new Vector2(600, -100));
-            path3.Add(new Vector2(600, 250));
-            path3.Add(new Vector2(580, 275));
-            path3.Add(new Vector2(500, 250));
-            path3.Add(new Vector2(500, 200));
-            path3.Add(new Vector2(450, 175));
-            path3.Add(new Vector2(400, 150));
-            path3.Add(new Vector2(-100, 150));
-            pathWaypoints.Add(path3);
-            waveSpawns[3] = 0;
-        }
-
-        public EnemyManager(
-            Texture2D texture,
-            Rectangle initialFrame,
-            int frameCount,
-            PlayerManager playerManager,
-            Rectangle screenBounds)
-        {
-            this.texture = texture;
-            this.initialFrame = initialFrame;
-            this.frameCount = frameCount;
-            this.playerManager = playerManager;
-
-            EnemyShotManager = new ShotManager(
-                texture,
-                new Rectangle(0, 300, 5, 5),
-                    4,
-                    2,
-                    150f,
-                    screenBounds);
-
-            setUpWaypoints();
-        }
-
-        public void SpawnEnemy(int path)
-        {
-            Enemy thisEnemy = new Enemy(
-                texture,
-                pathWaypoints[path][0],
-                initialFrame,
-                frameCount);
-            for (int x = 0; x < pathWaypoints[path].Count(); x++)
-            {
-                thisEnemy.AddWaypoint(pathWaypoints[path][x]);
-            }
-            Enemies.Add(thisEnemy);
-        }
-
-        public void SpawnWave(int waveType)
-        {
-            waveSpawns[waveType] +=
-                rand.Next(MinShipsPerWave, MaxShipsPerWave + 1);
-        }
-
-        private void updateWaveSpawns(GameTime gameTime)
-        {
-            shipSpawnTimer += (float)gameTime.ElapsedGameTime.TotalSeconds;
-            if (shipSpawnTimer > shipSpawnWaitTime)
-            {
-                for (int x = waveSpawns.Count - 1; x >= 0; x--)
-                {
-                    if (waveSpawns[x] > 0)
-                    {
-                        waveSpawns[x]--;
-                        SpawnEnemy(x);
-                    }
-                }
-                shipSpawnTimer = 0f;
-            }
-
-            nextWaveTimer += (float)gameTime.ElapsedGameTime.TotalSeconds;
-            if (nextWaveTimer > nextWaveMinTimer)
-            {
-                SpawnWave(rand.Next(0, pathWaypoints.Count));
-                nextWaveTimer = 0f;
-            }
-        }
-
-        public void Update(GameTime gameTime)
-        {
-            EnemyShotManager.Update(gameTime);
-
-            for (int x = Enemies.Count - 1; x >= 0; x--)
-            {
-                Enemies[x].Update(gameTime);
-                if (Enemies[x].IsActive() == false)
-                {
-                    Enemies.RemoveAt(x);
-                }
-                else
-                {
-                    if ((float)rand.Next(0, 1000) / 10 <= shipShotChance)
-                    {
-                        Vector2 fireLoc = Enemies[x].EnemySprite.Location;
-                        fireLoc += Enemies[x].gunOffset;
-
-                        Vector2 shotDirection =
-                            playerManager.playerSprite.Center -
-                            fireLoc;
-
-                        shotDirection.Normalize();
-
-                        EnemyShotManager.FireShot(
-                            fireLoc,
-                            shotDirection,
-                            false);
-                    }
-                }
-            }
-
-            if (Active)
-            {
-                updateWaveSpawns(gameTime);
-            }
-        }
-
-        public void Draw(SpriteBatch spriteBatch)
-        {
-            EnemyShotManager.Draw(spriteBatch);
-
-            foreach (Enemy enemy in Enemies)
-            {
-                enemy.Draw(spriteBatch);
-            }
-        }
-
-    }
-}

+ 0 - 132
BookSourceCode/XNAGameDevelopmentbyExampleCode/AsteroidBeltAssault/ExplosionManager.cs

@@ -1,132 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using Microsoft.Xna.Framework;
-using Microsoft.Xna.Framework.Graphics;
-
-namespace Asteroid_Belt_Assault
-{
-    class ExplosionManager
-    {
-        private Texture2D texture;
-        private List<Rectangle> pieceRectangles = new List<Rectangle>();
-        private Rectangle pointRectangle;
-
-        private int minPieceCount = 3;
-        private int maxPieceCount = 6;
-        private int minPointCount = 20;
-        private int maxPointCount = 30;
-
-        private int durationCount = 90;
-        private float explosionMaxSpeed = 30f;
-
-        private float pieceSpeedScale = 6f;
-        private int pointSpeedMin = 15;
-        private int pointSpeedMax = 30;
-
-        private Color initialColor = new Color(1.0f, 0.3f, 0f) * 0.5f;
-        private Color finalColor = new Color(0f, 0f, 0f, 0f);
-
-        Random rand = new Random();
-
-        private List<Particle> ExplosionParticles = new List<Particle>();
-
-        public ExplosionManager(
-            Texture2D texture,
-            Rectangle initialFrame,
-            int pieceCount,
-            Rectangle pointRectangle)
-        {
-            this.texture = texture;
-            for (int x = 0; x < pieceCount; x++)
-            {
-                pieceRectangles.Add(new Rectangle(
-                    initialFrame.X + (initialFrame.Width * x),
-                    initialFrame.Y,
-                    initialFrame.Width,
-                    initialFrame.Height));
-            }
-            this.pointRectangle = pointRectangle;
-        }
-
-        public Vector2 randomDirection(float scale)
-        {
-            Vector2 direction;
-            do
-            {
-                direction = new Vector2(
-                rand.Next(0, 101) - 50,
-                rand.Next(0, 101) - 50);
-            } while (direction.Length() == 0);
-            direction.Normalize();
-            direction *= scale;
-
-            return direction;
-        }
-
-        public void AddExplosion(Vector2 location, Vector2 momentum)
-        {
-            Vector2 pieceLocation = location -
-                new Vector2(pieceRectangles[0].Width / 2,
-                    pieceRectangles[0].Height / 2);
-
-            int pieces = rand.Next(minPieceCount, maxPieceCount + 1);
-            for (int x = 0; x < pieces; x++)
-            {
-                ExplosionParticles.Add(new Particle(
-                    pieceLocation,
-                    texture,
-                    pieceRectangles[rand.Next(0, pieceRectangles.Count)],
-                    randomDirection(pieceSpeedScale) + momentum,
-                    Vector2.Zero,
-                    explosionMaxSpeed,
-                    durationCount,
-                    initialColor,
-                    finalColor));
-            }
-
-            int points = rand.Next(minPointCount, maxPointCount + 1);
-            for (int x = 0; x < points; x++)
-            {
-                ExplosionParticles.Add(new Particle(
-                    location,
-                    texture,
-                    pointRectangle,
-                    randomDirection((float)rand.Next(
-                        pointSpeedMin, pointSpeedMax)) + momentum,
-                    Vector2.Zero,
-                    explosionMaxSpeed,
-                    durationCount,
-                    initialColor,
-                    finalColor));
-
-            }
-            SoundManager.PlayExplosion();
-        }
-
-        public void Update(GameTime gameTime)
-        {
-            for (int x = ExplosionParticles.Count - 1; x >= 0; x--)
-            {
-                if (ExplosionParticles[x].IsActive)
-                {
-                    ExplosionParticles[x].Update(gameTime);
-                }
-                else
-                {
-                    ExplosionParticles.RemoveAt(x);
-                }
-            }
-        }
-
-        public void Draw(SpriteBatch spriteBatch)
-        {
-            foreach (Particle particle in ExplosionParticles)
-            {
-                particle.Draw(spriteBatch);
-            }
-        }
-
-    }
-}

BIN
BookSourceCode/XNAGameDevelopmentbyExampleCode/AsteroidBeltAssault/Game.ico


+ 0 - 318
BookSourceCode/XNAGameDevelopmentbyExampleCode/AsteroidBeltAssault/Game1.cs

@@ -1,318 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using Microsoft.Xna.Framework;
-using Microsoft.Xna.Framework.Audio;
-using Microsoft.Xna.Framework.Content;
-using Microsoft.Xna.Framework.GamerServices;
-using Microsoft.Xna.Framework.Graphics;
-using Microsoft.Xna.Framework.Input;
-using Microsoft.Xna.Framework.Media;
-
-namespace Asteroid_Belt_Assault
-{
-    /// <summary>
-    /// This is the main type for your game
-    /// </summary>
-    public class Game1 : Microsoft.Xna.Framework.Game
-    {
-        GraphicsDeviceManager graphics;
-        SpriteBatch spriteBatch;
-
-        enum GameStates { TitleScreen, Playing, PlayerDead, GameOver };
-        GameStates gameState = GameStates.TitleScreen;
-        Texture2D titleScreen;
-        Texture2D spriteSheet;
-
-        StarField starField;
-        AsteroidManager asteroidManager;
-        PlayerManager playerManager;
-        EnemyManager enemyManager;
-        ExplosionManager explosionManager;
-
-        CollisionManager collisionManager;
-
-        SpriteFont pericles14;
-
-        private float playerDeathDelayTime = 10f;
-        private float playerDeathTimer = 0f;
-        private float titleScreenTimer = 0f;
-        private float titleScreenDelayTime = 1f;
-
-        private int playerStartingLives = 3;
-        private Vector2 playerStartLocation = new Vector2(390, 550);
-        private Vector2 scoreLocation = new Vector2(20, 10);
-        private Vector2 livesLocation = new Vector2(20, 25);
-
-
-        public Game1()
-        {
-            graphics = new GraphicsDeviceManager(this);
-            Content.RootDirectory = "Content";
-        }
-
-        /// <summary>
-        /// Allows the game to perform any initialization it needs to before starting to run.
-        /// This is where it can query for any required services and load any non-graphic
-        /// related content.  Calling base.Initialize will enumerate through any components
-        /// and initialize them as well.
-        /// </summary>
-        protected override void Initialize()
-        {
-            // TODO: Add your initialization logic here
-
-            base.Initialize();
-        }
-
-        /// <summary>
-        /// LoadContent will be called once per game and is the place to load
-        /// all of your content.
-        /// </summary>
-        protected override void LoadContent()
-        {
-            // Create a new SpriteBatch, which can be used to draw textures.
-            spriteBatch = new SpriteBatch(GraphicsDevice);
-
-            titleScreen = Content.Load<Texture2D>(@"Textures\TitleScreen");
-            spriteSheet = Content.Load<Texture2D>(@"Textures\spriteSheet");
-
-            starField = new StarField(
-                this.Window.ClientBounds.Width,
-                this.Window.ClientBounds.Height,
-                200,
-                new Vector2(0, 30f),
-                spriteSheet,
-                new Rectangle(0, 450, 2, 2));
-
-            asteroidManager = new AsteroidManager(
-                10,
-                spriteSheet,
-                new Rectangle(0, 0, 50, 50),
-                20,
-                this.Window.ClientBounds.Width,
-                this.Window.ClientBounds.Height);
-
-            playerManager = new PlayerManager(
-                spriteSheet,    
-                new Rectangle(0, 150, 50, 50),    
-                3,
-                new Rectangle(
-                    0,
-                    0,
-                    this.Window.ClientBounds.Width,
-                    this.Window.ClientBounds.Height));
-
-            enemyManager = new EnemyManager(
-                spriteSheet,
-                new Rectangle(0, 200, 50, 50),
-                6,
-                playerManager,
-                new Rectangle(
-                    0,
-                    0,
-                    this.Window.ClientBounds.Width,
-                    this.Window.ClientBounds.Height));
-
-            explosionManager = new ExplosionManager(
-                spriteSheet,
-                new Rectangle(0, 100, 50, 50),
-                3,
-                new Rectangle(0, 450, 2, 2));
-
-            collisionManager = new CollisionManager(
-                asteroidManager,
-                playerManager,
-                enemyManager,
-                explosionManager);
-
-            SoundManager.Initialize(Content);
-
-            pericles14 = Content.Load<SpriteFont>(@"Fonts\Pericles14");
-
-
-            // TODO: use this.Content to load your game content here
-        }
-
-        /// <summary>
-        /// UnloadContent will be called once per game and is the place to unload
-        /// all content.
-        /// </summary>
-        protected override void UnloadContent()
-        {
-            // TODO: Unload any non ContentManager content here
-        }
-
-        private void resetGame()
-        {
-            playerManager.playerSprite.Location = playerStartLocation;
-            foreach (Sprite asteroid in asteroidManager.Asteroids)
-            {
-                asteroid.Location = new Vector2(-500, -500);
-            }
-            enemyManager.Enemies.Clear();
-            enemyManager.Active = true;
-            playerManager.PlayerShotManager.Shots.Clear();
-            enemyManager.EnemyShotManager.Shots.Clear();
-            playerManager.Destroyed = false;
-        }
-        
-        /// <summary>
-        /// Allows the game to run logic such as updating the world,
-        /// checking for collisions, gathering input, and playing audio.
-        /// </summary>
-        /// <param name="gameTime">Provides a snapshot of timing values.</param>
-        protected override void Update(GameTime gameTime)
-        {
-            // Allows the game to exit
-            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
-                this.Exit();
-
-            // TODO: Add your update logic here
-
-            switch (gameState)
-            {
-                case GameStates.TitleScreen:
-                    titleScreenTimer +=
-                        (float)gameTime.ElapsedGameTime.TotalSeconds;
-
-                    if (titleScreenTimer >= titleScreenDelayTime)
-                    {
-                        if ((Keyboard.GetState().IsKeyDown(Keys.Space)) ||
-                            (GamePad.GetState(PlayerIndex.One).Buttons.A ==
-                            ButtonState.Pressed))
-                        {
-                            playerManager.LivesRemaining = playerStartingLives;
-                            playerManager.PlayerScore = 0;
-                            resetGame();
-                            gameState = GameStates.Playing;
-                        }
-                    }
-                    break;
-
-                case GameStates.Playing:
-
-                    starField.Update(gameTime);
-                    asteroidManager.Update(gameTime);
-                    playerManager.Update(gameTime);
-                    enemyManager.Update(gameTime);
-                    explosionManager.Update(gameTime);
-                    collisionManager.CheckCollisions();
-
-                    if (playerManager.Destroyed)
-                    {
-                        playerDeathTimer = 0f;
-                        enemyManager.Active = false;
-                        playerManager.LivesRemaining--;
-                        if (playerManager.LivesRemaining < 0)
-                        {
-                            gameState = GameStates.GameOver;
-                        }
-                        else
-                        {
-                            gameState = GameStates.PlayerDead;
-                        }
-                    }
-
-                    break;
-
-                case GameStates.PlayerDead:
-                    playerDeathTimer +=
-                        (float)gameTime.ElapsedGameTime.TotalSeconds;
-
-                    starField.Update(gameTime);
-                    asteroidManager.Update(gameTime);
-                    enemyManager.Update(gameTime);
-                    playerManager.PlayerShotManager.Update(gameTime);
-                    explosionManager.Update(gameTime);
-
-                    if (playerDeathTimer >= playerDeathDelayTime)
-                    {
-                        resetGame();
-                        gameState = GameStates.Playing;
-                    }
-                    break;
-
-                case GameStates.GameOver:
-                    playerDeathTimer +=
-                        (float)gameTime.ElapsedGameTime.TotalSeconds;
-                    starField.Update(gameTime);
-                    asteroidManager.Update(gameTime);
-                    enemyManager.Update(gameTime);
-                    playerManager.PlayerShotManager.Update(gameTime);
-                    explosionManager.Update(gameTime);
-                    if (playerDeathTimer >= playerDeathDelayTime)
-                    {
-                        gameState = GameStates.TitleScreen;
-                    }
-                    break;
-
-            }
-
-            base.Update(gameTime);
-        }
-
-        /// <summary>
-        /// This is called when the game should draw itself.
-        /// </summary>
-        /// <param name="gameTime">Provides a snapshot of timing values.</param>
-        protected override void Draw(GameTime gameTime)
-        {
-            GraphicsDevice.Clear(Color.Black);
-
-            spriteBatch.Begin();
-
-            if (gameState == GameStates.TitleScreen)
-            {
-                spriteBatch.Draw(titleScreen,
-                    new Rectangle(0, 0, this.Window.ClientBounds.Width,
-                        this.Window.ClientBounds.Height),
-                        Color.White);
-            }
-
-            if ((gameState == GameStates.Playing) ||
-                (gameState == GameStates.PlayerDead) ||
-                (gameState == GameStates.GameOver))
-            {
-                starField.Draw(spriteBatch);
-                asteroidManager.Draw(spriteBatch);
-                playerManager.Draw(spriteBatch);
-                enemyManager.Draw(spriteBatch);
-                explosionManager.Draw(spriteBatch);
-
-                spriteBatch.DrawString(
-                    pericles14,
-                    "Score: " + playerManager.PlayerScore.ToString(),
-                    scoreLocation,
-                    Color.White);
-
-                if (playerManager.LivesRemaining >= 0)
-                {
-                    spriteBatch.DrawString(
-                        pericles14,
-                        "Ships Remaining: " +
-                            playerManager.LivesRemaining.ToString(),
-                        livesLocation,
-                        Color.White);
-                }
-            }
-
-            if ((gameState == GameStates.GameOver))
-            {
-                spriteBatch.DrawString(
-                    pericles14,
-                    "G A M E  O V E R !",
-                    new Vector2(
-                        this.Window.ClientBounds.Width / 2 -
-                          pericles14.MeasureString("G A M E  O V E R !").X / 2,
-                        50),
-                    Color.White);
-            }
-
-
-            spriteBatch.End();
-
-            base.Draw(gameTime);
-        }
-
-    }
-}

BIN
BookSourceCode/XNAGameDevelopmentbyExampleCode/AsteroidBeltAssault/GameThumbnail.png


+ 0 - 16
BookSourceCode/XNAGameDevelopmentbyExampleCode/AsteroidBeltAssault/Info.plist

@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
-	<key>CFBundleIdentifier</key>
-	<string>com.yourcompany.AsteroidBeltAssault</string>
-	<key>CFBundleName</key>
-	<string>AsteroidBeltAssault</string>
-	<key>CFBundleVersion</key>
-	<string>1</string>
-	<key>LSMinimumSystemVersion</key>
-	<string>10.6</string>
-	<key>NSPrincipalClass</key>
-	<string>NSApplication</string>
-</dict>
-</plist>

+ 0 - 92
BookSourceCode/XNAGameDevelopmentbyExampleCode/AsteroidBeltAssault/Particle.cs

@@ -1,92 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using Microsoft.Xna.Framework;
-using Microsoft.Xna.Framework.Graphics;
-
-namespace Asteroid_Belt_Assault
-{
-    class Particle : Sprite
-    {
-        private Vector2 acceleration;
-        private float maxSpeed;
-        private int initialDuration;
-        private int remainingDuration;
-        private Color initialColor;
-        private Color finalColor;
-
-        public int ElapsedDuration
-        {
-            get
-            {
-                return initialDuration - remainingDuration;
-            }
-        }
-
-        public float DurationProgress
-        {
-            get
-            {
-                return (float)ElapsedDuration /
-                    (float)initialDuration;
-            }
-        }
-
-        public bool IsActive
-        {
-            get
-            {
-                return (remainingDuration > 0);
-            }
-        }
-
-        public Particle(
-            Vector2 location,
-            Texture2D texture,
-            Rectangle initialFrame,
-            Vector2 velocity,
-            Vector2 acceleration,
-            float maxSpeed,
-            int duration,
-            Color initialColor,
-            Color finalColor)
-            : base(location, texture, initialFrame, velocity)
-        {
-            initialDuration = duration;
-            remainingDuration = duration;
-            this.acceleration = acceleration;
-            this.initialColor = initialColor;
-            this.maxSpeed = maxSpeed;
-            this.finalColor = finalColor;
-        }
-
-        public override void Update(GameTime gameTime)
-        {
-            if (IsActive)
-            {
-                velocity += acceleration;
-                if (velocity.Length() > maxSpeed)
-                {
-                    velocity.Normalize();
-                    velocity *= maxSpeed;
-                }
-                TintColor = Color.Lerp(
-                    initialColor,
-                    finalColor,
-                    DurationProgress);
-                remainingDuration--;
-                base.Update(gameTime);
-            }
-        }
-
-        public override void Draw(SpriteBatch spriteBatch)
-        {
-            if (IsActive)
-            {
-                base.Draw(spriteBatch);
-            }
-        }
-
-    }
-}

+ 0 - 174
BookSourceCode/XNAGameDevelopmentbyExampleCode/AsteroidBeltAssault/PlayerManager.cs

@@ -1,174 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using Microsoft.Xna.Framework;
-using Microsoft.Xna.Framework.Input;
-using Microsoft.Xna.Framework.Graphics;
-
-namespace Asteroid_Belt_Assault
-{
-    class PlayerManager
-    {
-        public Sprite playerSprite;
-        private float playerSpeed = 160.0f;
-        private Rectangle playerAreaLimit;
-
-        public long PlayerScore = 0;
-        public int LivesRemaining = 3;
-        public bool Destroyed = false;
-
-        private Vector2 gunOffset = new Vector2(25, 10);
-        private float shotTimer = 0.0f;
-        private float minShotTimer = 0.2f;
-        private int playerRadius = 15;
-        public ShotManager PlayerShotManager;
-
-        public PlayerManager(
-            Texture2D texture,  
-            Rectangle initialFrame,
-            int frameCount,
-            Rectangle screenBounds)
-        {
-            playerSprite = new Sprite(
-                new Vector2(500, 500),
-                texture,
-                initialFrame,
-                Vector2.Zero);
-
-            PlayerShotManager = new ShotManager(
-                texture,
-                new Rectangle(0, 300, 5, 5),
-                4,
-                2,
-                250f,
-                screenBounds);
-
-            playerAreaLimit =
-                new Rectangle(
-                    0,
-                    screenBounds.Height / 2,
-                    screenBounds.Width,
-                    screenBounds.Height / 2);
-
-            for (int x = 1; x < frameCount; x++)
-            {
-                playerSprite.AddFrame(
-                    new Rectangle(
-                        initialFrame.X + (initialFrame.Width * x),
-                        initialFrame.Y,
-                        initialFrame.Width,
-                        initialFrame.Height));
-            }
-            playerSprite.CollisionRadius = playerRadius;
-        }
-
-        private void FireShot()
-        {
-            if (shotTimer >= minShotTimer)
-            {
-                PlayerShotManager.FireShot(
-                    playerSprite.Location + gunOffset,
-                    new Vector2(0, -1),
-                    true);
-                shotTimer = 0.0f;
-            }
-        }
-
-        private void HandleKeyboardInput(KeyboardState keyState)
-        {
-            if (keyState.IsKeyDown(Keys.Up))
-            {
-                playerSprite.Velocity += new Vector2(0, -1);
-            }
-
-            if (keyState.IsKeyDown(Keys.Down))
-            {
-                playerSprite.Velocity += new Vector2(0, 1);
-            }
-
-            if (keyState.IsKeyDown(Keys.Left))
-            {
-                playerSprite.Velocity += new Vector2(-1, 0);
-            }
-
-            if (keyState.IsKeyDown(Keys.Right))
-            {
-                playerSprite.Velocity += new Vector2(1, 0);
-            }
-
-            if (keyState.IsKeyDown(Keys.Space))
-            {
-                FireShot();
-            }
-        }
-
-        private void HandleGamepadInput(GamePadState gamePadState)
-        {
-            playerSprite.Velocity +=
-                new Vector2(
-                    gamePadState.ThumbSticks.Left.X,
-                    -gamePadState.ThumbSticks.Left.Y);
-
-            if (gamePadState.Buttons.A == ButtonState.Pressed)
-            {
-                FireShot();
-            }
-        }
-
-        private void imposeMovementLimits()
-        {
-            Vector2 location = playerSprite.Location;
-
-            if (location.X < playerAreaLimit.X)
-                location.X = playerAreaLimit.X;
-
-            if (location.X >
-                (playerAreaLimit.Right - playerSprite.Source.Width))
-                location.X =
-                    (playerAreaLimit.Right - playerSprite.Source.Width);
-
-            if (location.Y < playerAreaLimit.Y)
-                location.Y = playerAreaLimit.Y;
-
-            if (location.Y >
-                (playerAreaLimit.Bottom - playerSprite.Source.Height))
-                location.Y =
-                    (playerAreaLimit.Bottom - playerSprite.Source.Height);
-
-            playerSprite.Location = location;
-        }
-
-        public void Update(GameTime gameTime)
-        {
-            PlayerShotManager.Update(gameTime);
-
-            if (!Destroyed)
-            {
-                playerSprite.Velocity = Vector2.Zero;
-
-                shotTimer += (float)gameTime.ElapsedGameTime.TotalSeconds;
-
-                HandleKeyboardInput(Keyboard.GetState());
-                HandleGamepadInput(GamePad.GetState(PlayerIndex.One));
-
-                playerSprite.Velocity.Normalize();
-                playerSprite.Velocity *= playerSpeed;
-
-                playerSprite.Update(gameTime);
-                imposeMovementLimits();
-            }
-        }
-
-        public void Draw(SpriteBatch spriteBatch)
-        {
-            PlayerShotManager.Draw(spriteBatch);
-
-            if (!Destroyed)
-            {
-                playerSprite.Draw(spriteBatch);
-            }
-        }
-
-    }
-}

+ 0 - 60
BookSourceCode/XNAGameDevelopmentbyExampleCode/AsteroidBeltAssault/Program.cs

@@ -1,60 +0,0 @@
-using System;
-
-#if MONOMAC
-using MonoMac.Foundation;
-using MonoMac.AppKit;
-using MonoMac.ObjCRuntime;
-#endif
-
-namespace Asteroid_Belt_Assault
-{
-#if WINDOWS || XBOX || LINUX
-    static class Program
-    {
-        /// <summary>
-        /// The main entry point for the application.
-        /// </summary>
-        static void Main(string[] args)
-        {
-            using (Game1 game = new Game1())
-            {
-                game.Run();
-            }
-        }
-    }
-#elif MONOMAC
-	static class Program
-	{
-		/// <summary>
-		/// The main entry point for the application.
-		/// </summary>
-		static void Main (string[] args)
-		{
-			NSApplication.Init ();
-			
-			using (var p = new NSAutoreleasePool ()) {
-				NSApplication.SharedApplication.Delegate = new AppDelegate();
-				NSApplication.Main(args);
-			}
-		}
-	}
-	
-	class AppDelegate : NSApplicationDelegate
-	{
-		Game1 game;
-		public override void FinishedLaunching (MonoMac.Foundation.NSObject notification)
-		{
-			game = new Game1();
-			game.Run();
-		}
-		
-		public override bool ApplicationShouldTerminateAfterLastWindowClosed (NSApplication sender)
-		{
-			return true;
-		}
-	}		
-#else
-#error Unknown platform
-#endif
-}
-

+ 0 - 10
BookSourceCode/XNAGameDevelopmentbyExampleCode/AsteroidBeltAssault/README.md

@@ -1,10 +0,0 @@
-Asteroid Belt Assault
-=====================
-
-This project contains the Asteroid Belt Assault game as it is at the end of Chapter 5. 
-
-This was taken from the Book XNA 4.0 Game Development by Example: Beginner's Guide by Kurt Jaegers
-Published by PACKT Publishing which can be found here 
-http://www.packtpub.com/xna-4-0-game-development-by-example-beginners-guide/book
-
-For a complete discussion of the code please buy the book as it is worth the money.

+ 0 - 95
BookSourceCode/XNAGameDevelopmentbyExampleCode/AsteroidBeltAssault/ShotManager.cs

@@ -1,95 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using Microsoft.Xna.Framework;
-using Microsoft.Xna.Framework.Graphics;
-
-namespace Asteroid_Belt_Assault
-{
-    class ShotManager
-    {
-        public List<Sprite> Shots = new List<Sprite>();
-        private Rectangle screenBounds;
-
-        private static Texture2D Texture;
-        private static Rectangle InitialFrame;
-        private static int FrameCount;
-        private float shotSpeed;
-        private static int CollisionRadius;
-
-        public ShotManager(
-            Texture2D texture,
-            Rectangle initialFrame,
-            int frameCount,
-            int collisionRadius,
-            float shotSpeed,
-            Rectangle screenBounds)
-        {
-            Texture = texture;
-            InitialFrame = initialFrame;
-            FrameCount = frameCount;
-            CollisionRadius = collisionRadius;
-            this.shotSpeed = shotSpeed;
-            this.screenBounds = screenBounds;
-        }
-
-        public void FireShot(
-            Vector2 location,
-            Vector2 velocity,
-            bool playerFired)
-        {
-            Sprite thisShot = new Sprite(
-                location,
-                Texture,
-                InitialFrame,
-                velocity);
-
-            thisShot.Velocity *= shotSpeed;
-
-            for (int x = 1; x < FrameCount; x++)
-            {
-                thisShot.AddFrame(new Rectangle(
-                    InitialFrame.X + (InitialFrame.Width * x),
-                    InitialFrame.Y,
-                    InitialFrame.Width,
-                    InitialFrame.Height));
-            }
-            thisShot.CollisionRadius = CollisionRadius;
-            Shots.Add(thisShot);
-
-            if (playerFired)
-            {
-
-                SoundManager.PlayPlayerShot();
-            }
-            else
-            {
-
-                SoundManager.PlayEnemyShot();
-            }
-        }
-
-        public void Update(GameTime gameTime)
-        {
-            for (int x = Shots.Count - 1; x >= 0; x--)
-            {
-                Shots[x].Update(gameTime);
-                if (!screenBounds.Intersects(Shots[x].Destination))
-                {
-                    Shots.RemoveAt(x);
-                }
-            }
-        }
-
-        public void Draw(SpriteBatch spriteBatch)
-        {
-            foreach (Sprite shot in Shots)
-            {
-                shot.Draw(spriteBatch);
-            }
-        }
-
-    
-    }
-}

+ 0 - 81
BookSourceCode/XNAGameDevelopmentbyExampleCode/AsteroidBeltAssault/SoundManager.cs

@@ -1,81 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Diagnostics;
-using Microsoft.Xna.Framework;
-using Microsoft.Xna.Framework.Audio;
-using Microsoft.Xna.Framework.Content;
-
-
-namespace Asteroid_Belt_Assault
-{
-    public static class SoundManager
-    {
-        private static List<SoundEffect> explosions = new
-            List<SoundEffect>();
-        private static int explosionCount = 4;
-
-        private static SoundEffect playerShot;
-        private static SoundEffect enemyShot;
-
-        private static Random rand = new Random();
-
-        public static void Initialize(ContentManager content)
-        {
-            try
-            {
-                playerShot = content.Load<SoundEffect>(@"Sounds\Shot1");
-                enemyShot = content.Load<SoundEffect>(@"Sounds\Shot2");
-
-                for (int x = 1; x <= explosionCount; x++)
-                {
-                    explosions.Add(
-                        content.Load<SoundEffect>(@"Sounds\Explosion" +
-                            x.ToString()));
-                }
-            }
-            catch
-            {
-                Debug.Write("SoundManager Initialization Failed");
-            }
-        }
-
-        public static void PlayExplosion()
-        {
-            try
-            {
-                explosions[rand.Next(0, explosionCount)].Play();
-            }
-            catch
-            {
-                Debug.Write("PlayExplosion Failed");
-            }
-        }
-
-        public static void PlayPlayerShot()
-        {
-            try
-            {
-                playerShot.Play();
-            }
-            catch
-            {
-                Debug.Write("PlayPlayerShot Failed");
-            }
-        }
-
-        public static void PlayEnemyShot()
-        {
-            try
-            {
-                enemyShot.Play();
-            }
-            catch
-            {
-                Debug.Write("PlayEnemyShot Failed");
-            }
-        }
-
-    }
-}

+ 0 - 173
BookSourceCode/XNAGameDevelopmentbyExampleCode/AsteroidBeltAssault/Sprite.cs

@@ -1,173 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using Microsoft.Xna.Framework;
-using Microsoft.Xna.Framework.Graphics;
-
-namespace Asteroid_Belt_Assault
-{
-    class Sprite
-    {
-        public Texture2D Texture;
-
-        protected List<Rectangle> frames = new List<Rectangle>();
-        private int frameWidth = 0;
-        private int frameHeight = 0;
-        private int currentFrame;
-        private float frameTime = 0.1f;
-        private float timeForCurrentFrame = 0.0f;
-
-        private Color tintColor = Color.White;
-        private float rotation = 0.0f;
-
-        public int CollisionRadius = 0;
-        public int BoundingXPadding = 0;
-        public int BoundingYPadding = 0;
-
-        protected Vector2 location = Vector2.Zero;
-        protected Vector2 velocity = Vector2.Zero;
-
-        public Sprite(
-            Vector2 location,
-            Texture2D texture,
-            Rectangle initialFrame,
-            Vector2 velocity)
-        {
-            this.location = location;
-            Texture = texture;
-            this.velocity = velocity;
-
-            frames.Add(initialFrame);
-            frameWidth = initialFrame.Width;
-            frameHeight = initialFrame.Height;
-        }
-
-        public Vector2 Location
-        {
-            get { return location; }
-            set { location = value; }
-        }
-
-        public Vector2 Velocity
-        {
-            get { return velocity; }
-            set { velocity = value; }
-        }
-
-        public Color TintColor
-        {
-            get { return tintColor; }
-            set { tintColor = value; }
-        }
-
-        public float Rotation
-        {
-            get { return rotation; }
-            set { rotation = value % MathHelper.TwoPi; }
-        }
-
-        public int Frame
-        {
-            get { return currentFrame; }
-            set
-            {
-                currentFrame = (int)MathHelper.Clamp(value, 0,
-                frames.Count - 1);
-            }
-        }
-
-        public float FrameTime
-        {
-            get { return frameTime; }
-            set { frameTime = MathHelper.Max(0, value); }
-        }
-
-        public Rectangle Source
-        {
-            get { return frames[currentFrame]; }
-        }
-
-        public Rectangle Destination
-        {
-            get
-            {
-                return new Rectangle(
-                    (int)location.X,
-                    (int)location.Y,
-                    frameWidth,
-                    frameHeight);
-            }
-        }
-
-        public Vector2 Center
-        {
-            get
-            {
-                return location +
-                    new Vector2(frameWidth / 2, frameHeight / 2);
-            }
-        }
-
-        public Rectangle BoundingBoxRect
-        {
-            get
-            {
-                return new Rectangle(
-                    (int)location.X + BoundingXPadding,
-                    (int)location.Y + BoundingYPadding,
-                    frameWidth - (BoundingXPadding * 2),
-                    frameHeight - (BoundingYPadding * 2));
-            }
-        }
-
-        public bool IsBoxColliding(Rectangle OtherBox)
-        {
-            return BoundingBoxRect.Intersects(OtherBox);
-        }
-
-        public bool IsCircleColliding(Vector2 otherCenter, float otherRadius)
-        {
-            if (Vector2.Distance(Center, otherCenter) <
-                (CollisionRadius + otherRadius))
-                return true;
-            else
-                return false;
-        }
-
-        public void AddFrame(Rectangle frameRectangle)
-        {
-            frames.Add(frameRectangle);
-        }
-
-        public virtual void Update(GameTime gameTime)
-        {
-            float elapsed = (float)gameTime.ElapsedGameTime.TotalSeconds;
-
-            timeForCurrentFrame += elapsed;
-
-            if (timeForCurrentFrame >= FrameTime)
-            {
-                currentFrame = (currentFrame + 1) % (frames.Count);
-                timeForCurrentFrame = 0.0f;
-            }
-
-            location += (velocity * elapsed);
-        }
-
-        public virtual void Draw(SpriteBatch spriteBatch)
-        {
-            spriteBatch.Draw(
-                Texture,
-                Center,
-                Source,
-                tintColor,
-                rotation,
-                new Vector2(frameWidth / 2, frameHeight / 2),
-                1.0f,
-                SpriteEffects.None,
-                0.0f);
-        }
-
-    }
-}

+ 0 - 65
BookSourceCode/XNAGameDevelopmentbyExampleCode/AsteroidBeltAssault/StarField.cs

@@ -1,65 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using Microsoft.Xna.Framework;
-using Microsoft.Xna.Framework.Graphics;
-
-namespace Asteroid_Belt_Assault
-{
-    class StarField
-    {
-        private List<Sprite> stars = new List<Sprite>();
-        private int screenWidth = 800;
-        private int screenHeight = 600;
-        private Random rand = new Random();
-        private Color[] colors = { Color.White, Color.Yellow, 
-                           Color.Wheat, Color.WhiteSmoke, 
-                           Color.SlateGray };
-
-        public StarField(
-            int screenWidth,
-            int screenHeight,
-            int starCount,
-            Vector2 starVelocity,
-            Texture2D texture,
-            Rectangle frameRectangle)
-        {
-            this.screenWidth = screenWidth;
-            this.screenHeight = screenHeight;
-            for (int x = 0; x < starCount; x++)
-            {
-                stars.Add(new Sprite(
-                    new Vector2(rand.Next(0, screenWidth),
-                        rand.Next(0, screenHeight)),
-                    texture,
-                    frameRectangle,
-                    starVelocity));
-                Color starColor = colors[rand.Next(0, colors.Count())];
-                starColor *= (float)(rand.Next(30, 80) / 100f); stars[stars.Count() - 1].TintColor = starColor;
-            }
-        }
-
-        public void Update(GameTime gameTime)
-        {
-            foreach (Sprite star in stars)
-            {
-                star.Update(gameTime);
-                if (star.Location.Y > screenHeight)
-                {
-                    star.Location = new Vector2(
-                        rand.Next(0, screenWidth), 0);
-                }
-            }
-        }
-
-        public void Draw(SpriteBatch spriteBatch)
-        {
-            foreach (Sprite star in stars)
-            {
-                star.Draw(spriteBatch);
-            }
-        }
-
-    }
-}

BIN
BookSourceCode/XNAGameDevelopmentbyExampleCode/FloodControl/Content/Fonts/Pericles36.xnb


BIN
BookSourceCode/XNAGameDevelopmentbyExampleCode/FloodControl/Content/Textures/Background.xnb


BIN
BookSourceCode/XNAGameDevelopmentbyExampleCode/FloodControl/Content/Textures/Tile_Sheet.xnb


BIN
BookSourceCode/XNAGameDevelopmentbyExampleCode/FloodControl/Content/Textures/TitleScreen.xnb


+ 0 - 28
BookSourceCode/XNAGameDevelopmentbyExampleCode/FloodControl/FadingPiece.cs

@@ -1,28 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using Microsoft.Xna.Framework;
-
-namespace Flood_Control
-{
-    class FadingPiece : GamePiece 
-    {
-        public float alphaLevel = 1.0f;
-        public static float alphaChangeRate = 0.02f;
-
-        public FadingPiece(string pieceType, string suffix)
-            : base(pieceType, suffix)
-        {
-
-        }
-
-        public void UpdatePiece()
-        {
-            alphaLevel = MathHelper.Max(
-                0,
-                alphaLevel - alphaChangeRate);
-        }
-
-    }
-}

+ 0 - 28
BookSourceCode/XNAGameDevelopmentbyExampleCode/FloodControl/FallingPiece.cs

@@ -1,28 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using Microsoft.Xna.Framework;
-
-namespace Flood_Control
-{
-    class FallingPiece : GamePiece 
-    {
-        public int VerticalOffset;
-        public static int fallRate = 5;
-
-        public FallingPiece(string pieceType, int verticalOffset)
-            : base(pieceType)
-        {
-            VerticalOffset = verticalOffset;
-        }
-
-        public void UpdatePiece()
-        {
-            VerticalOffset = (int)MathHelper.Max(
-                0,
-                VerticalOffset - fallRate);
-        }
-
-    }
-}

+ 0 - 98
BookSourceCode/XNAGameDevelopmentbyExampleCode/FloodControl/FloodControl.Linux.csproj

@@ -1,98 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <PropertyGroup>
-    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
-    <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
-    <ProductVersion>9.0.21022</ProductVersion>
-    <SchemaVersion>2.0</SchemaVersion>
-    <ProjectGuid>{86A219E2-C8F1-422B-C762-C69D5BB07C98}</ProjectGuid>
-    <OutputType>Exe</OutputType>
-    <RootNamespace>FloodControl</RootNamespace>
-    <AssemblyName>FloodControl</AssemblyName>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
-    <DebugSymbols>True</DebugSymbols>
-    <DebugType>full</DebugType>
-    <Optimize>False</Optimize>
-    <OutputPath>bin\Debug</OutputPath>
-    <DefineConstants>DEBUG,LINUX</DefineConstants>
-    <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
-    <PlatformTarget>x86</PlatformTarget>
-    <ConsolePause>False</ConsolePause>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
-    <DebugType>none</DebugType>
-    <Optimize>False</Optimize>
-    <OutputPath>bin\Release</OutputPath>
-    <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
-    <PlatformTarget>x86</PlatformTarget>
-    <ConsolePause>False</ConsolePause>
-  </PropertyGroup>
-  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
-  <ItemGroup>
-    <Reference Include="System" />
-    <Reference Include="System.Xml" />
-    <Reference Include="System.Core" />
-    <Reference Include="System.Xml.Linq" />
-    <Reference Include="System.Drawing" />
-  </ItemGroup>
-  <ItemGroup>
-    <Folder Include="Content\" />
-    <Folder Include="Content\Fonts\" />
-  </ItemGroup>
-  <ItemGroup>
-    <Compile Include="Program.cs" />
-    <Compile Include="FadingPiece.cs">
-      <Link>FadingPiece.cs</Link>
-    </Compile>
-    <Compile Include="FallingPiece.cs">
-      <Link>FallingPiece.cs</Link>
-    </Compile>
-    <Compile Include="Game1.cs">
-      <Link>Game1.cs</Link>
-    </Compile>
-    <Compile Include="GameBoard.cs">
-      <Link>GameBoard.cs</Link>
-    </Compile>
-    <Compile Include="GamePiece.cs">
-      <Link>GamePiece.cs</Link>
-    </Compile>
-    <Compile Include="RotatingPiece.cs">
-      <Link>RotatingPiece.cs</Link>
-    </Compile>
-    <Compile Include="ScoreZooms.cs">
-      <Link>ScoreZooms.cs</Link>
-    </Compile>
-  </ItemGroup>
-  <ItemGroup>
-    <Content Include="Content\Fonts\Pericles36.xnb">
-      <Link>Content\Fonts\Pericles36.xnb</Link>
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
-    </Content>
-    <Content Include="Content\Textures\Background.xnb">
-      <Link>Content\Textures\Background.xnb</Link>
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
-    </Content>
-    <Content Include="Content\Textures\Tile_Sheet.xnb">
-      <Link>Content\Textures\Tile_Sheet.xnb</Link>
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
-    </Content>
-    <Content Include="Content\Textures\TitleScreen.xnb">
-      <Link>Content\Textures\TitleScreen.xnb</Link>
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
-    </Content>
-  </ItemGroup>
-  <ItemGroup>
-    <None Include="Game.ico">
-      <Link>Game.ico</Link>
-    </None>
-    <None Include="GameThumbnail.png">
-      <Link>GameThumbnail.png</Link>
-    </None>
-    <None Include="README.md">
-      <Link>README.md</Link>
-    </None>
-  </ItemGroup>
-</Project>

+ 0 - 90
BookSourceCode/XNAGameDevelopmentbyExampleCode/FloodControl/FloodControl.MacOS.csproj

@@ -1,90 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <PropertyGroup>
-    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
-    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
-    <ProductVersion>10.0.0</ProductVersion>
-    <SchemaVersion>2.0</SchemaVersion>
-    <ProjectGuid>{F3115910-E6D1-450D-97FB-A8168A5D622E}</ProjectGuid>
-    <ProjectTypeGuids>{948B3504-5B70-4649-8FE4-BDE1FB46EC69};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
-    <OutputType>Exe</OutputType>
-    <RootNamespace>FloodControl</RootNamespace>
-    <AssemblyName>FloodControl</AssemblyName>
-    <SuppressXamMacUpsell>True</SuppressXamMacUpsell>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
-    <DebugSymbols>True</DebugSymbols>
-    <DebugType>full</DebugType>
-    <Optimize>False</Optimize>
-    <OutputPath>bin\Debug</OutputPath>
-    <DefineConstants>DEBUG;MONOMAC</DefineConstants>
-    <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
-    <ConsolePause>False</ConsolePause>
-    <EnableCodeSigning>False</EnableCodeSigning>
-    <CreatePackage>False</CreatePackage>
-    <EnablePackageSigning>False</EnablePackageSigning>
-    <IncludeMonoRuntime>False</IncludeMonoRuntime>
-    <UseSGen>False</UseSGen>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
-    <DebugType>none</DebugType>
-    <Optimize>False</Optimize>
-    <OutputPath>bin\Release</OutputPath>
-    <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
-    <ConsolePause>False</ConsolePause>
-    <EnableCodeSigning>False</EnableCodeSigning>
-    <CreatePackage>False</CreatePackage>
-    <EnablePackageSigning>False</EnablePackageSigning>
-    <IncludeMonoRuntime>False</IncludeMonoRuntime>
-    <DefineConstants>MONOMAC</DefineConstants>
-    <UseSGen>False</UseSGen>
-  </PropertyGroup>
-  <ItemGroup>
-    <Reference Include="System" />
-    <Reference Include="System.Xml" />
-    <Reference Include="System.Core" />
-    <Reference Include="System.Xml.Linq" />
-    <Reference Include="System.Drawing" />
-    <Reference Include="MonoMac" />
-  </ItemGroup>
-  <ItemGroup>
-    <None Include="Info.plist">
-    </None>
-    <None Include="Game.ico" />
-    <None Include="GameThumbnail.png" />
-    <None Include="README.md" />
-  </ItemGroup>
-  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
-  <Import Project="$(MSBuildExtensionsPath)\Mono\MonoMac\v0.0\Mono.MonoMac.targets" />
-  <ItemGroup>
-    <Folder Include="Content\" />
-  </ItemGroup>
-  <ItemGroup>
-    <Compile Include="FadingPiece.cs" />
-    <Compile Include="FallingPiece.cs" />
-    <Compile Include="Game1.cs" />
-    <Compile Include="GameBoard.cs" />
-    <Compile Include="GamePiece.cs" />
-    <Compile Include="Program.cs" />
-    <Compile Include="RotatingPiece.cs" />
-    <Compile Include="ScoreZooms.cs" />
-  </ItemGroup>
-  <ItemGroup>
-    <Content Include="Content\Fonts\Pericles36.xnb" />
-    <Content Include="Content\Textures\Background.xnb" />
-    <Content Include="Content\Textures\Tile_Sheet.xnb" />
-    <Content Include="Content\Textures\TitleScreen.xnb" />
-  </ItemGroup>
-  <ItemGroup>
-    <ProjectReference Include="..\..\..\..\ThirdParty\Lidgren.Network\Lidgren.Network.MacOS.csproj">
-      <Project>{AE483C29-042E-4226-BA52-D247CE7676DA}</Project>
-      <Name>Lidgren.Network.MacOS</Name>
-    </ProjectReference>
-    <ProjectReference Include="..\..\..\..\MonoGame.Framework\MonoGame.Framework.MacOS.csproj">
-      <Project>{36C538E6-C32A-4A8D-A39C-566173D7118E}</Project>
-      <Name>MonoGame.Framework.MacOS</Name>
-    </ProjectReference>
-  </ItemGroup>
-</Project>

+ 0 - 45
BookSourceCode/XNAGameDevelopmentbyExampleCode/FloodControl/FloodControl.sln

@@ -1,45 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 11.00
-# Visual Studio 2010
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FloodControl", "FloodControl.csproj", "{F3115910-E6D1-450D-97FB-A8168A5D622E}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MonoGame.Framework.MacOS", "..\..\..\..\..\..\..\Users\Jimmy\Public\Share\MonoMacSource\kjpgit\MonoGame\MonoGame.Framework\MonoGame.Framework.MacOS.csproj", "{36C538E6-C32A-4A8D-A39C-566173D7118E}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lidgren.Network", "..\..\..\..\..\..\..\Users\Jimmy\Public\Share\MonoMacSource\kjpgit\MonoGame\ThirdParty\Lidgren.Network\Lidgren.Network.csproj", "{AE483C29-042E-4226-BA52-D247CE7676DA}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Peer2PeerSample", "..\Peer2PeerSample\Peer2PeerSample.csproj", "{27C1B777-4E37-4E2B-9CE4-5FDEE8CD9C40}"
-EndProject
-Global
-	GlobalSection(SolutionConfigurationPlatforms) = preSolution
-		Debug|Any CPU = Debug|Any CPU
-		Release|Any CPU = Release|Any CPU
-		Distribution|Any CPU = Distribution|Any CPU
-	EndGlobalSection
-	GlobalSection(ProjectConfigurationPlatforms) = postSolution
-		{27C1B777-4E37-4E2B-9CE4-5FDEE8CD9C40}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{27C1B777-4E37-4E2B-9CE4-5FDEE8CD9C40}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{27C1B777-4E37-4E2B-9CE4-5FDEE8CD9C40}.Distribution|Any CPU.ActiveCfg = Debug|Any CPU
-		{27C1B777-4E37-4E2B-9CE4-5FDEE8CD9C40}.Distribution|Any CPU.Build.0 = Debug|Any CPU
-		{27C1B777-4E37-4E2B-9CE4-5FDEE8CD9C40}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{27C1B777-4E37-4E2B-9CE4-5FDEE8CD9C40}.Release|Any CPU.Build.0 = Release|Any CPU
-		{36C538E6-C32A-4A8D-A39C-566173D7118E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{36C538E6-C32A-4A8D-A39C-566173D7118E}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{36C538E6-C32A-4A8D-A39C-566173D7118E}.Distribution|Any CPU.ActiveCfg = Distribution|Any CPU
-		{36C538E6-C32A-4A8D-A39C-566173D7118E}.Distribution|Any CPU.Build.0 = Distribution|Any CPU
-		{36C538E6-C32A-4A8D-A39C-566173D7118E}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{36C538E6-C32A-4A8D-A39C-566173D7118E}.Release|Any CPU.Build.0 = Release|Any CPU
-		{AE483C29-042E-4226-BA52-D247CE7676DA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{AE483C29-042E-4226-BA52-D247CE7676DA}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{AE483C29-042E-4226-BA52-D247CE7676DA}.Distribution|Any CPU.ActiveCfg = Debug|Any CPU
-		{AE483C29-042E-4226-BA52-D247CE7676DA}.Distribution|Any CPU.Build.0 = Debug|Any CPU
-		{AE483C29-042E-4226-BA52-D247CE7676DA}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{AE483C29-042E-4226-BA52-D247CE7676DA}.Release|Any CPU.Build.0 = Release|Any CPU
-		{F3115910-E6D1-450D-97FB-A8168A5D622E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{F3115910-E6D1-450D-97FB-A8168A5D622E}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{F3115910-E6D1-450D-97FB-A8168A5D622E}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{F3115910-E6D1-450D-97FB-A8168A5D622E}.Release|Any CPU.Build.0 = Release|Any CPU
-	EndGlobalSection
-	GlobalSection(MonoDevelopProperties) = preSolution
-		StartupItem = FloodControl.csproj
-	EndGlobalSection
-EndGlobal

BIN
BookSourceCode/XNAGameDevelopmentbyExampleCode/FloodControl/Game.ico


+ 0 - 489
BookSourceCode/XNAGameDevelopmentbyExampleCode/FloodControl/Game1.cs

@@ -1,489 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using Microsoft.Xna.Framework;
-using Microsoft.Xna.Framework.Audio;
-using Microsoft.Xna.Framework.Content;
-using Microsoft.Xna.Framework.GamerServices;
-using Microsoft.Xna.Framework.Graphics;
-using Microsoft.Xna.Framework.Input;
-using Microsoft.Xna.Framework.Media;
-
-namespace Flood_Control
-{
-    /// <summary>
-    /// This is the main type for your game
-    /// </summary>
-    public class Game1 : Microsoft.Xna.Framework.Game
-    {
-        GraphicsDeviceManager graphics;
-        SpriteBatch spriteBatch;
-
-        Texture2D playingPieces;
-        Texture2D backgroundScreen;
-        Texture2D titleScreen;
-
-        GameBoard gameBoard;
-
-        SpriteFont pericles36Font;
-        Vector2 scorePosition = new Vector2(605, 215);
-
-        Vector2 gameBoardDisplayOrigin = new Vector2(70, 89);
-
-        int playerScore = 0;
-
-        enum GameStates { TitleScreen, Playing, GameOver };
-        GameStates gameState = GameStates.TitleScreen;
-
-        Rectangle EmptyPiece = new Rectangle(1, 247, 40, 40);
-
-        const float MinTimeSinceLastInput = 0.25f;
-        float timeSinceLastInput = 0.0f;
-
-        Queue<ScoreZoom> ScoreZooms = new Queue<ScoreZoom>();
-
-        Vector2 gameOverLocation = new Vector2(200, 260);
-        float gameOverTimer;
-
-        const float MaxFloodCounter = 100.0f;
-        float floodCount = 0.0f;
-        float timeSinceLastFloodIncrease = 0.0f;
-        float timeBetweenFloodIncreases = 1.0f;
-        float floodIncreaseAmount = 0.5f;
-
-        const int MaxWaterHeight = 244;
-        const int WaterWidth = 297;
-
-        Vector2 waterOverlayStart = new Vector2(85, 245);
-        Vector2 waterPosition = new Vector2(478, 338);
-
-        int currentLevel = 0;
-        int linesCompletedThisLevel = 0;
-
-        const float floodAccelerationPerLevel = 0.5f;
-
-        Vector2 levelTextPosition = new Vector2(512, 215);
-
-        public Game1()
-        {
-            graphics = new GraphicsDeviceManager(this);
-            Content.RootDirectory = "Content";
-        }
-
-        /// <summary>
-        /// Allows the game to perform any initialization it needs to before starting to run.
-        /// This is where it can query for any required services and load any non-graphic
-        /// related content.  Calling base.Initialize will enumerate through any components
-        /// and initialize them as well.
-        /// </summary>
-        protected override void Initialize()
-        {
-            // TODO: Add your initialization logic here
-            this.IsMouseVisible = true;
-            graphics.PreferredBackBufferWidth = 800;
-            graphics.PreferredBackBufferHeight = 600;
-            graphics.ApplyChanges();
-            gameBoard = new GameBoard();
-            base.Initialize();
-        }
-
-        /// <summary>
-        /// LoadContent will be called once per game and is the place to load
-        /// all of your content.
-        /// </summary>
-        protected override void LoadContent()
-        {
-            // Create a new SpriteBatch, which can be used to draw textures.
-            spriteBatch = new SpriteBatch(GraphicsDevice);
-
-            playingPieces = Content.Load<Texture2D>(@"Textures\Tile_Sheet");
-            backgroundScreen = Content.Load<Texture2D>(@"Textures\Background");
-            titleScreen = Content.Load<Texture2D>(@"Textures\TitleScreen");
-            pericles36Font = Content.Load<SpriteFont>(@"Fonts\Pericles36");
-
-            // TODO: use this.Content to load your game content here
-        }
-
-        /// <summary>
-        /// UnloadContent will be called once per game and is the place to unload
-        /// all content.
-        /// </summary>
-        protected override void UnloadContent()
-        {
-            // TODO: Unload any non ContentManager content here
-        }
-
-        private int DetermineScore(int SquareCount)
-        {
-            return (int)((Math.Pow((SquareCount / 5), 2) + SquareCount) * 10);
-        }
-
-        private void CheckScoringChain(List<Vector2> WaterChain)
-        {
-
-            if (WaterChain.Count > 0)
-            {
-                Vector2 LastPipe = WaterChain[WaterChain.Count - 1];
-
-                if (LastPipe.X == GameBoard.GameBoardWidth - 1)
-                {
-                    if (gameBoard.HasConnector(
-                        (int)LastPipe.X, (int)LastPipe.Y, "Right"))
-                    {
-                        playerScore += DetermineScore(WaterChain.Count);
-
-                        linesCompletedThisLevel++;
-
-                        floodCount = MathHelper.Clamp(floodCount -
-                            (DetermineScore(WaterChain.Count) / 10), 0.0f, 100.0f);
-
-                        ScoreZooms.Enqueue(new ScoreZoom("+" +
-                            DetermineScore(WaterChain.Count).ToString(),
-                            new Color(1.0f, 0.0f, 0.0f, 0.4f)));
-
-                        foreach (Vector2 ScoringSquare in WaterChain)
-                        {
-                            gameBoard.AddFadingPiece(
-                                (int)ScoringSquare.X,
-                                (int)ScoringSquare.Y,
-                                gameBoard.GetSquare(
-                                  (int)ScoringSquare.X,
-                                  (int)ScoringSquare.Y));
-
-                            gameBoard.SetSquare((int)ScoringSquare.X,
-                                (int)ScoringSquare.Y, "Empty");
-                        }
-
-                        if (linesCompletedThisLevel >= 10)
-                        {
-                            StartNewLevel();
-                        }
-                    }
-                }
-            }
-        }
-
-        private void HandleMouseInput(MouseState mouseState)
-        {
-
-            int x = ((mouseState.X -
-                (int)gameBoardDisplayOrigin.X) / GamePiece.PieceWidth);
-
-            int y = ((mouseState.Y -
-                (int)gameBoardDisplayOrigin.Y) / GamePiece.PieceHeight);
-
-            if ((x >= 0) && (x < GameBoard.GameBoardWidth) &&
-              (y >= 0) && (y < GameBoard.GameBoardHeight))
-            {
-                if (mouseState.LeftButton == ButtonState.Pressed)
-                {
-                    gameBoard.AddRotatingPiece(x, y,
-                        gameBoard.GetSquare(x, y), false);
-                    gameBoard.RotatePiece(x, y, false);
-                    timeSinceLastInput = 0.0f;
-                }
-
-                if (mouseState.RightButton == ButtonState.Pressed)
-                {
-                    gameBoard.AddRotatingPiece(x, y,
-                        gameBoard.GetSquare(x, y), true);
-                    gameBoard.RotatePiece(x, y, true);
-                    timeSinceLastInput = 0.0f;
-                }
-            }
-        }
-
-        private void UpdateScoreZooms()
-        {
-            int dequeueCounter = 0;
-            foreach (ScoreZoom zoom in ScoreZooms)
-            {
-                zoom.Update();
-                if (zoom.IsCompleted)
-                    dequeueCounter++;
-            }
-            for (int d = 0; d < dequeueCounter; d++)
-                ScoreZooms.Dequeue();
-        }
-
-        private void StartNewLevel()
-        {
-            currentLevel++;
-            floodCount = 0.0f;
-            linesCompletedThisLevel = 0;
-            floodIncreaseAmount += floodAccelerationPerLevel;
-            gameBoard.ClearBoard();
-            gameBoard.GenerateNewPieces(false);
-        }
-
-        /// <summary>
-        /// Allows the game to run logic such as updating the world,
-        /// checking for collisions, gathering input, and playing audio.
-        /// </summary>
-        /// <param name="gameTime">Provides a snapshot of timing values.</param>
-        protected override void Update(GameTime gameTime)
-        {
-            // Allows the game to exit
-            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
-                this.Exit();
-
-            // TODO: Add your update logic here
-
-            switch (gameState)
-            {
-                case GameStates.TitleScreen:
-                    if (Keyboard.GetState().IsKeyDown(Keys.Space))
-                    {
-                        gameBoard.ClearBoard();
-                        gameBoard.GenerateNewPieces(false);
-                        playerScore = 0;
-                        currentLevel = 0;
-                        floodIncreaseAmount = 0.0f;
-                        StartNewLevel();
-                        gameState = GameStates.Playing;
-                    }
-                    break;
-
-                case GameStates.Playing:
-                    timeSinceLastInput +=
-                        (float)gameTime.ElapsedGameTime.TotalSeconds;
-
-                    timeSinceLastFloodIncrease += 
-                        (float)gameTime.ElapsedGameTime.TotalSeconds;
-
-                        if (timeSinceLastFloodIncrease >= timeBetweenFloodIncreases)
-                        {
-                            floodCount += floodIncreaseAmount;
-                            timeSinceLastFloodIncrease = 0.0f;
-                            if (floodCount >= MaxFloodCounter)
-                            {
-                                gameOverTimer = 8.0f;
-                                gameState = GameStates.GameOver;
-                            }
-                        }
-
-                    if (gameBoard.ArePiecesAnimating())
-                    {
-                        gameBoard.UpdateAnimatedPieces();
-                    }
-                    else
-                    {
-                        gameBoard.ResetWater();
-
-                        for (int y = 0; y < GameBoard.GameBoardHeight; y++)
-                        {
-                            CheckScoringChain(gameBoard.GetWaterChain(y));
-                        }
-
-                        gameBoard.GenerateNewPieces(true);
-
-                        if (timeSinceLastInput >= MinTimeSinceLastInput)
-                        {
-                            HandleMouseInput(Mouse.GetState());
-                        }
-                    }
-                    UpdateScoreZooms();
-
-                    break;
-
-                case GameStates.GameOver:
-                    gameOverTimer -= (float)gameTime.ElapsedGameTime.TotalSeconds;
-                    if (gameOverTimer <= 0)
-                    {
-                        gameState = GameStates.TitleScreen;
-                    }
-                    break;
-
-            }
-
-            base.Update(gameTime);
-        }
-
-        private void DrawEmptyPiece(int pixelX, int pixelY)
-        {
-            spriteBatch.Draw(
-                playingPieces,
-                new Rectangle(pixelX, pixelY,
-                    GamePiece.PieceWidth, GamePiece.PieceHeight),
-                EmptyPiece,
-                Color.White);
-        }
-
-        private void DrawStandardPiece(int x, int y,
-            int pixelX, int pixelY)
-        {
-            spriteBatch.Draw(
-                playingPieces, new Rectangle(pixelX, pixelY,
-                    GamePiece.PieceWidth, GamePiece.PieceHeight),
-                gameBoard.GetSourceRect(x, y),
-                Color.White);
-        }
-
-        private void DrawFallingPiece(int pixelX, int pixelY,
-            string positionName)
-        {
-            spriteBatch.Draw(
-               playingPieces,
-               new Rectangle(pixelX, pixelY -
-                gameBoard.fallingPieces[positionName].VerticalOffset,
-                 GamePiece.PieceWidth, GamePiece.PieceHeight),
-                 gameBoard.fallingPieces[positionName].GetSourceRect(),
-               Color.White);
-        }
-
-        private void DrawFadingPiece(int pixelX, int pixelY,
-            string positionName)
-        {
-            spriteBatch.Draw(
-                playingPieces,
-                new Rectangle(pixelX, pixelY,
-                    GamePiece.PieceWidth, GamePiece.PieceHeight),
-                gameBoard.fadingPieces[positionName].GetSourceRect(),
-                Color.White *
-                    gameBoard.fadingPieces[positionName].alphaLevel);
-        }
-
-        private void DrawRotatingPiece(int pixelX, int pixelY,
-            string positionName)
-        {
-            spriteBatch.Draw(
-              playingPieces,
-              new Rectangle(pixelX + (GamePiece.PieceWidth / 2),
-                  pixelY + (GamePiece.PieceHeight / 2),
-                  GamePiece.PieceWidth,
-                  GamePiece.PieceHeight),
-              gameBoard.rotatingPieces[positionName].GetSourceRect(),
-              Color.White,
-              gameBoard.rotatingPieces[positionName].RotationAmount,
-              new Vector2(GamePiece.PieceWidth / 2,
-                  GamePiece.PieceHeight / 2),
-              SpriteEffects.None, 0.0f);
-        }
-
-        /// <summary>
-        /// This is called when the game should draw itself.
-        /// </summary>
-        /// <param name="gameTime">Provides a snapshot of timing values.</param>
-        protected override void Draw(GameTime gameTime)
-        {
-            GraphicsDevice.Clear(Color.CornflowerBlue);
-
-            // TODO: Add your drawing code here
-
-            if (gameState == GameStates.TitleScreen)
-            {
-                spriteBatch.Begin();
-                spriteBatch.Draw(titleScreen,
-                    new Rectangle(0, 0,
-                        this.Window.ClientBounds.Width,
-                        this.Window.ClientBounds.Height),
-                    Color.White);
-                spriteBatch.End();
-            }
-
-            if ((gameState == GameStates.Playing) ||
-                (gameState == GameStates.GameOver))
-
-            {
-                spriteBatch.Begin();
-
-                spriteBatch.Draw(backgroundScreen,
-                    new Rectangle(0, 0,
-                        this.Window.ClientBounds.Width,
-                        this.Window.ClientBounds.Height),
-                    Color.White);
-
-                for (int x = 0; x < GameBoard.GameBoardWidth; x++)
-                    for (int y = 0; y < GameBoard.GameBoardHeight; y++)
-                    {
-                        int pixelX = (int)gameBoardDisplayOrigin.X +
-                            (x * GamePiece.PieceWidth);
-                        int pixelY = (int)gameBoardDisplayOrigin.Y +
-                            (y * GamePiece.PieceHeight);
-
-                        DrawEmptyPiece(pixelX, pixelY);
-
-                        bool pieceDrawn = false;
-
-                        string positionName = x.ToString() + "_" + y.ToString();
-
-                        if (gameBoard.rotatingPieces.ContainsKey(positionName))
-                        {
-                            DrawRotatingPiece(pixelX, pixelY, positionName);
-                            pieceDrawn = true;
-                        }
-
-                        if (gameBoard.fadingPieces.ContainsKey(positionName))
-                        {
-                            DrawFadingPiece(pixelX, pixelY, positionName);
-                            pieceDrawn = true;
-                        }
-
-                        if (gameBoard.fallingPieces.ContainsKey(positionName))
-                        {
-                            DrawFallingPiece(pixelX, pixelY, positionName);
-                            pieceDrawn = true;
-                        }
-
-                        if (!pieceDrawn)
-                        {
-                            DrawStandardPiece(x, y, pixelX, pixelY);
-                        }
-                    }
-
-                foreach (ScoreZoom zoom in ScoreZooms)
-                {
-                    spriteBatch.DrawString(pericles36Font, zoom.Text,
-                        new Vector2(this.Window.ClientBounds.Width / 2,
-                            this.Window.ClientBounds.Height / 2),
-                        zoom.DrawColor, 0.0f,
-                        new Vector2(pericles36Font.MeasureString(zoom.Text).X / 2,
-                            pericles36Font.MeasureString(zoom.Text).Y / 2),
-                        zoom.Scale, SpriteEffects.None, 0.0f);
-                }
-
-                spriteBatch.DrawString(pericles36Font,
-                    playerScore.ToString(),
-                    scorePosition,
-                    Color.Black);
-
-                spriteBatch.DrawString(pericles36Font,
-                    currentLevel.ToString(),
-                    levelTextPosition,
-                    Color.Black);
-
-                int waterHeight = (int)(MaxWaterHeight * (floodCount / 100));
-
-                spriteBatch.Draw(backgroundScreen,
-                    new Rectangle(
-                        (int)waterPosition.X,
-                        (int)waterPosition.Y + (MaxWaterHeight - waterHeight),
-                        WaterWidth,
-                        waterHeight),
-                    new Rectangle(
-                        (int)waterOverlayStart.X,
-                        (int)waterOverlayStart.Y + (MaxWaterHeight - waterHeight),
-                        WaterWidth,
-                        waterHeight),
-                    new Color(255, 255, 255, 180));
-
-                spriteBatch.End();
-            }
-
-            if (gameState == GameStates.GameOver)
-            {
-                spriteBatch.Begin();
-                spriteBatch.DrawString(pericles36Font,
-                    "G A M E  O V E R!",
-                    gameOverLocation,
-                    Color.Yellow);
-                spriteBatch.End();
-            }
-
-
-            base.Draw(gameTime);
-        }
-
-
-    }
-}

+ 0 - 261
BookSourceCode/XNAGameDevelopmentbyExampleCode/FloodControl/GameBoard.cs

@@ -1,261 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using Microsoft.Xna.Framework;
-
-namespace Flood_Control
-{
-    class GameBoard
-    {
-        Random rand = new Random();
-
-        public const int GameBoardWidth = 8;
-        public const int GameBoardHeight = 10;
-
-        private GamePiece[,] boardSquares =
-          new GamePiece[GameBoardWidth, GameBoardHeight];
-
-        private List<Vector2> WaterTracker = new List<Vector2>();
-
-        public Dictionary<string, FallingPiece> fallingPieces =
-            new Dictionary<string, FallingPiece>();
-        public Dictionary<string, RotatingPiece> rotatingPieces =
-            new Dictionary<string, RotatingPiece>();
-        public Dictionary<string, FadingPiece> fadingPieces =
-            new Dictionary<string, FadingPiece>();
-
-        public GameBoard()
-        {
-            ClearBoard();
-        }
-
-        public void ClearBoard()
-        {
-            for (int x = 0; x < GameBoardWidth; x++)
-                for (int y = 0; y < GameBoardHeight; y++)
-                    boardSquares[x, y] = new GamePiece("Empty");
-        }
-
-        public void RotatePiece(int x, int y, bool clockwise)
-        {
-            boardSquares[x, y].RotatePiece(clockwise);
-        }
-
-        public Rectangle GetSourceRect(int x, int y)
-        {
-            return boardSquares[x, y].GetSourceRect();
-        }
-
-        public string GetSquare(int x, int y)
-        {
-            return boardSquares[x, y].PieceType;
-        }
-
-        public void SetSquare(int x, int y, string pieceName)
-        {
-            boardSquares[x, y].SetPiece(pieceName);
-        }
-
-        public bool HasConnector(int x, int y, string direction)
-        {
-            return boardSquares[x, y].HasConnector(direction);
-        }
-
-        public void RandomPiece(int x, int y)
-        {
-            boardSquares[x, y].SetPiece(GamePiece.PieceTypes[rand.Next(0,
-               GamePiece.MaxPlayablePieceIndex + 1)]);
-        }
-
-        public void FillFromAbove(int x, int y)
-        {
-            int rowLookup = y - 1;
-
-            while (rowLookup >= 0)
-            {
-                if (GetSquare(x, rowLookup) != "Empty")
-                {
-                    SetSquare(x, y,
-                      GetSquare(x, rowLookup));
-                    SetSquare(x, rowLookup, "Empty");
-                    AddFallingPiece(x, y, GetSquare(x, y),
-                        GamePiece.PieceHeight * (y - rowLookup));
-                    rowLookup = -1;
-                }
-                rowLookup--;
-            }
-        }
-
-        public void GenerateNewPieces(bool dropSquares)
-        {
-
-            if (dropSquares)
-            {
-                for (int x = 0; x < GameBoard.GameBoardWidth; x++)
-                {
-                    for (int y = GameBoard.GameBoardHeight - 1; y >= 0; y--)
-                    {
-                        if (GetSquare(x, y) == "Empty")
-                        {
-                            FillFromAbove(x, y);
-                        }
-                    }
-                }
-            }
-
-            for (int y = 0; y < GameBoard.GameBoardHeight; y++)
-                for (int x = 0; x < GameBoard.GameBoardWidth; x++)
-                {
-                    if (GetSquare(x, y) == "Empty")
-                    {
-                        RandomPiece(x, y);
-                        AddFallingPiece(x, y, GetSquare(x, y),
-                            GamePiece.PieceHeight * GameBoardHeight);
-
-                    }
-                }
-        }
-
-        public void ResetWater()
-        {
-            for (int y = 0; y < GameBoardHeight; y++)
-                for (int x = 0; x < GameBoardWidth; x++)
-                    boardSquares[x, y].RemoveSuffix("W");
-        }
-
-        public void FillPiece(int X, int Y)
-        {
-            boardSquares[X, Y].AddSuffix("W");
-        }
-
-        public void PropagateWater(int x, int y, string fromDirection)
-        {
-            if ((y >= 0) && (y < GameBoardHeight) &&
-                (x >= 0) && (x < GameBoardWidth))
-            {
-                if (boardSquares[x, y].HasConnector(fromDirection) &&
-                    !boardSquares[x, y].Suffix.Contains("W"))
-                {
-                    FillPiece(x, y);
-                    WaterTracker.Add(new Vector2(x, y));
-                    foreach (string end in
-                             boardSquares[x, y].GetOtherEnds(fromDirection))
-                        switch (end)
-                        {
-                            case "Left": PropagateWater(x - 1, y, "Right");
-                                break;
-                            case "Right": PropagateWater(x + 1, y, "Left");
-                                break;
-                            case "Top": PropagateWater(x, y - 1, "Bottom");
-                                break;
-                            case "Bottom": PropagateWater(x, y + 1, "Top");
-                                break;
-                        }
-                }
-            }
-        }
-
-        public List<Vector2> GetWaterChain(int y)
-        {
-            WaterTracker.Clear();
-            PropagateWater(0, y, "Left");
-            return WaterTracker;
-        }
-
-        public void AddFallingPiece(int X, int Y,
-            string PieceName, int VerticalOffset)
-        {
-            fallingPieces[X.ToString() + "_" + Y.ToString()] = new
-                FallingPiece(PieceName, VerticalOffset);
-        }
-
-        public void AddRotatingPiece(int X, int Y,
-            string PieceName, bool Clockwise)
-        {
-            rotatingPieces[X.ToString() + "_" + Y.ToString()] = new
-                RotatingPiece(PieceName, Clockwise);
-        }
-
-        public void AddFadingPiece(int X, int Y, string PieceName)
-        {
-            fadingPieces[X.ToString() + "_" + Y.ToString()] = new
-                FadingPiece(PieceName, "W");
-        }
-
-        public bool ArePiecesAnimating()
-        {
-            if ((fallingPieces.Count == 0) &&
-                (rotatingPieces.Count == 0) &&
-                (fadingPieces.Count == 0))
-            {
-                return false;
-            }
-            else
-            {
-                return true;
-            }
-        }
-
-        private void UpdateFadingPieces()
-        {
-            Queue<string> RemoveKeys = new Queue<string>();
-
-            foreach (string thisKey in fadingPieces.Keys)
-            {
-                fadingPieces[thisKey].UpdatePiece();
-
-                if (fadingPieces[thisKey].alphaLevel == 0.0f)
-                    RemoveKeys.Enqueue(thisKey.ToString());
-            }
-
-            while (RemoveKeys.Count > 0)
-                fadingPieces.Remove(RemoveKeys.Dequeue());
-        }
-
-        private void UpdateFallingPieces()
-        {
-            Queue<string> RemoveKeys = new Queue<string>();
-
-            foreach (string thisKey in fallingPieces.Keys)
-            {
-                fallingPieces[thisKey].UpdatePiece();
-
-                if (fallingPieces[thisKey].VerticalOffset == 0)
-                    RemoveKeys.Enqueue(thisKey.ToString());
-            }
-
-            while (RemoveKeys.Count > 0)
-                fallingPieces.Remove(RemoveKeys.Dequeue());
-        }
-
-        private void UpdateRotatingPieces()
-        {
-            Queue<string> RemoveKeys = new Queue<string>();
-
-            foreach (string thisKey in rotatingPieces.Keys)
-            {
-                rotatingPieces[thisKey].UpdatePiece();
-
-                if (rotatingPieces[thisKey].rotationTicksRemaining == 0)
-                    RemoveKeys.Enqueue(thisKey.ToString());
-            }
-
-            while (RemoveKeys.Count > 0)
-                rotatingPieces.Remove(RemoveKeys.Dequeue());
-        }
-
-        public void UpdateAnimatedPieces()
-        {
-            if (fadingPieces.Count == 0)
-            {
-                UpdateFallingPieces();
-                UpdateRotatingPieces();
-            }
-            else
-            {
-                UpdateFadingPieces();
-            }
-        }
-    }
-}

+ 0 - 153
BookSourceCode/XNAGameDevelopmentbyExampleCode/FloodControl/GamePiece.cs

@@ -1,153 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using Microsoft.Xna.Framework.Graphics;
-using Microsoft.Xna.Framework;
-
-namespace Flood_Control
-{
-    class GamePiece
-    {
-        public static string[] PieceTypes = 
-        { 
-            "Left,Right", 
-            "Top,Bottom", 
-            "Left,Top", 
-            "Top,Right",
-            "Right,Bottom", 
-            "Bottom,Left",
-            "Empty"
-         };
-
-        public const int PieceHeight = 40;
-        public const int PieceWidth = 40;
-
-        public const int MaxPlayablePieceIndex = 5;
-        public const int EmptyPieceIndex = 6;
-
-        private const int textureOffsetX = 1;
-        private const int textureOffsetY = 1;
-        private const int texturePaddingX = 1;
-        private const int texturePaddingY = 1;
-
-        private string pieceType = "";
-        private string pieceSuffix = "";
-
-        public string PieceType
-        {
-            get { return pieceType; }
-        }
-
-        public string Suffix
-        {
-            get { return pieceSuffix; }
-        }
-
-        public GamePiece(string type, string suffix)
-        {
-            pieceType = type;
-            pieceSuffix = suffix;
-        }
-
-        public GamePiece(string type)
-        {
-            pieceType = type;
-            pieceSuffix = "";
-        }
-
-        public void SetPiece(string type, string suffix)
-        {
-            pieceType = type;
-            pieceSuffix = suffix;
-        }
-
-        public void SetPiece(string type)
-        {
-            SetPiece(type, "");
-        }
-
-        public void AddSuffix(string suffix)
-        {
-            if (!pieceSuffix.Contains(suffix))
-                pieceSuffix += suffix;
-        }
-
-        public void RemoveSuffix(string suffix)
-        {
-            pieceSuffix = pieceSuffix.Replace(suffix, "");
-        }
-
-        public void RotatePiece(bool Clockwise)
-        {
-            switch (pieceType)
-            {
-                case "Left,Right":
-                    pieceType = "Top,Bottom";
-                    break;
-                case "Top,Bottom":
-                    pieceType = "Left,Right";
-                    break;
-                case "Left,Top":
-                    if (Clockwise)
-                        pieceType = "Top,Right";
-                    else
-                        pieceType = "Bottom,Left";
-                    break;
-                case "Top,Right":
-                    if (Clockwise)
-                        pieceType = "Right,Bottom";
-                    else
-                        pieceType = "Left,Top";
-                    break;
-                case "Right,Bottom":
-                    if (Clockwise)
-                        pieceType = "Bottom,Left";
-                    else
-                        pieceType = "Top,Right";
-                    break;
-                case "Bottom,Left":
-                    if (Clockwise)
-                        pieceType = "Left,Top";
-                    else
-                        pieceType = "Right,Bottom";
-                    break;
-                case "Empty":
-                    break;
-            }
-        }
-
-        public string[] GetOtherEnds(string startingEnd)
-        {
-            List<string> opposites = new List<string>();
-
-            foreach (string end in pieceType.Split(','))
-            {
-                if (end != startingEnd)
-                    opposites.Add(end);
-            }
-            return opposites.ToArray();
-        }
-
-        public bool HasConnector(string direction)
-        {
-            return pieceType.Contains(direction);
-        }
-
-        public Rectangle GetSourceRect()
-        {
-            int x = textureOffsetX;
-            int y = textureOffsetY;
-
-            if (pieceSuffix.Contains("W"))
-                x += PieceWidth + texturePaddingX;
-
-            y += (Array.IndexOf(PieceTypes, pieceType) *
-                 (PieceHeight + texturePaddingY));
-
-
-            return new Rectangle(x, y, PieceWidth, PieceHeight);
-        }
-
-    }
-}

BIN
BookSourceCode/XNAGameDevelopmentbyExampleCode/FloodControl/GameThumbnail.png


+ 0 - 16
BookSourceCode/XNAGameDevelopmentbyExampleCode/FloodControl/Info.plist

@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
-	<key>CFBundleIdentifier</key>
-	<string>com.yourcompany.FloodControl</string>
-	<key>CFBundleName</key>
-	<string>FloodControl</string>
-	<key>CFBundleVersion</key>
-	<string>1</string>
-	<key>LSMinimumSystemVersion</key>
-	<string>10.6</string>
-	<key>NSPrincipalClass</key>
-	<string>NSApplication</string>
-</dict>
-</plist>

+ 0 - 60
BookSourceCode/XNAGameDevelopmentbyExampleCode/FloodControl/Program.cs

@@ -1,60 +0,0 @@
-using System;
-
-#if MONOMAC
-using MonoMac.Foundation;
-using MonoMac.AppKit;
-using MonoMac.ObjCRuntime;
-#endif
-
-namespace Flood_Control
-{
-#if WINDOWS || XBOX || LINUX
-	static class Program
-	{
-	/// <summary>
-	/// The main entry point for the application.
-	/// </summary>
-	static void Main(string[] args)
-	{
-		using (Game1 game = new Game1())
-		{
-		game.Run();
-		}
-	}
-	}
-#elif MONOMAC
-	static class Program
-	{
-		/// <summary>
-		/// The main entry point for the application.
-		/// </summary>
-		static void Main (string[] args)
-		{
-			NSApplication.Init ();
-			
-			using (var p = new NSAutoreleasePool ()) {
-				NSApplication.SharedApplication.Delegate = new AppDelegate();
-				NSApplication.Main(args);
-			}
-		}
-	}
-	
-	class AppDelegate : NSApplicationDelegate
-	{
-		Game1 game;
-		public override void FinishedLaunching (MonoMac.Foundation.NSObject notification)
-		{
-			game = new Game1();
-			game.Run();
-		}
-		
-		public override bool ApplicationShouldTerminateAfterLastWindowClosed (NSApplication sender)
-		{
-			return true;
-		}
-	}		
-#else
-#error Unknown platform
-#endif
-}
-

+ 0 - 10
BookSourceCode/XNAGameDevelopmentbyExampleCode/FloodControl/README.md

@@ -1,10 +0,0 @@
-Flood Control
-=============
-
-This project contains the Flood Control game as it is at the end of Chapter 3. 
-
-This was taken from the Book XNA 4.0 Game Development by Example: Beginner's Guide by Kurt Jaegers
-Published by PACKT Publishing which can be found here 
-http://www.packtpub.com/xna-4-0-game-development-by-example-beginners-guide/book
-
-For a complete discussion of the code please buy the book as it is worth the money.

+ 0 - 43
BookSourceCode/XNAGameDevelopmentbyExampleCode/FloodControl/RotatingPiece.cs

@@ -1,43 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using Microsoft.Xna.Framework;
-
-namespace Flood_Control
-{
-    class RotatingPiece : GamePiece
-    {
-        public bool clockwise;
-
-        public static float rotationRate = (MathHelper.PiOver2 / 10);
-        private float rotationAmount = 0;
-        public int rotationTicksRemaining = 10;
-
-        public float RotationAmount
-        {
-            get
-            {
-                if (clockwise)
-                    return rotationAmount;
-                else
-                    return (MathHelper.Pi * 2) - rotationAmount;
-            }
-        }
-
-        public RotatingPiece(string pieceType, bool clockwise)
-            : base(pieceType)
-        {
-            this.clockwise = clockwise;
-        }
-
-        public void UpdatePiece()
-        {
-            rotationAmount += rotationRate;
-            rotationTicksRemaining = (int)MathHelper.Max(
-                0,
-                rotationTicksRemaining - 1);
-        }
-
-    }
-}

+ 0 - 44
BookSourceCode/XNAGameDevelopmentbyExampleCode/FloodControl/ScoreZooms.cs

@@ -1,44 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using Microsoft.Xna.Framework.Graphics;
-using Microsoft.Xna.Framework;
-
-namespace Flood_Control
-{
-    class ScoreZoom
-    {
-        public string Text;
-        public Color DrawColor;
-        public int displayCounter;
-        public int MaxDisplayCount = 30;
-        private float scale = 0.4f;
-        private float lastScaleAmount = 0.0f;
-        private float scaleAmount = 0.4f;
-
-        public float Scale
-        {
-            get { return scaleAmount * displayCounter; }
-        }
-
-        public bool IsCompleted
-        {
-            get { return (displayCounter > MaxDisplayCount); }
-        }
-
-        public ScoreZoom(string displayText, Color fontColor)
-        {
-            Text = displayText;
-            DrawColor = fontColor;
-            displayCounter = 0;
-        }
-
-        public void Update()
-        {
-            scale += lastScaleAmount + scaleAmount;
-            lastScaleAmount += scaleAmount;
-            displayCounter++;
-        }
-    }
-}

+ 0 - 140
BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/AnimationStrip.cs

@@ -1,140 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using Microsoft.Xna.Framework;
-using Microsoft.Xna.Framework.Graphics;
-
-namespace Gemstone_Hunter
-{
-    public class AnimationStrip
-    {
-        #region Declarations
-        private Texture2D texture;
-        private int frameWidth;
-        private int frameHeight;
-
-        private float frameTimer = 0f;
-        private float frameDelay = 0.05f;
-
-        private int currentFrame;
-
-        private bool loopAnimation = true;
-        private bool finishedPlaying = false;
-
-        private string name;
-        private string nextAnimation;
-        #endregion
-
-        #region Properties
-        public int FrameWidth
-        {
-            get { return frameWidth; }
-            set { frameWidth = value; }
-        }
-
-        public int FrameHeight
-        {
-            get { return frameHeight; }
-            set { frameHeight = value; }
-        }
-
-        public Texture2D Texture
-        {
-            get { return texture; }
-            set { texture = value; }
-        }
-
-        public string Name
-        {
-            get { return name; }
-            set { name = value; }
-        }
-
-        public string NextAnimation
-        {
-            get { return nextAnimation; }
-            set { nextAnimation = value; }
-        }
-
-        public bool LoopAnimation
-        {
-            get { return loopAnimation; }
-            set { loopAnimation = value; }
-        }
-
-        public bool FinishedPlaying
-        {
-            get { return finishedPlaying; }
-        }
-
-        public int FrameCount
-        {
-            get { return texture.Width / frameWidth; }
-        }
-
-        public float FrameLength
-        {
-            get { return frameDelay; }
-            set { frameDelay = value; }
-        }
-
-        public Rectangle FrameRectangle
-        {
-            get
-            {
-                return new Rectangle(
-                    currentFrame * frameWidth,
-                    0,
-                    frameWidth,
-                    frameHeight);
-            }
-        }
-        #endregion
-
-        #region Constructor
-        public AnimationStrip(Texture2D texture, int frameWidth, string name)
-        {
-            this.texture = texture;
-            this.frameWidth = frameWidth;
-            this.frameHeight = texture.Height;
-            this.name = name;
-        }
-        #endregion
-
-        #region Public Methods
-        public void Play()
-        {
-            currentFrame = 0;
-            finishedPlaying = false;
-        }
-
-        public void Update(GameTime gameTime)
-        {
-            float elapsed = (float)gameTime.ElapsedGameTime.TotalSeconds;
-
-            frameTimer += elapsed;
-
-            if (frameTimer >= frameDelay)
-            {
-                currentFrame++;
-                if (currentFrame >= FrameCount)
-                {
-                    if (loopAnimation)
-                    {
-                        currentFrame = 0;
-                    }
-                    else
-                    {
-                        currentFrame = FrameCount - 1;
-                        finishedPlaying = true;
-                    }
-                }
-
-                frameTimer = 0f;
-            }
-        }
-        #endregion
-
-    }
-}

BIN
BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/Content/Fonts/Pericles10Bold.xnb


BIN
BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/Content/Fonts/Pericles8.xnb


BIN
BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/Content/Maps/MAP000.MAP


BIN
BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/Content/Maps/MAP001.MAP


BIN
BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/Content/Textures/Gem.xnb


BIN
BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/Content/Textures/PlatformTiles.xnb


BIN
BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/Content/Textures/Sprites/Gem.xnb


BIN
BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/Content/Textures/Sprites/MonsterA/Die.xnb


BIN
BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/Content/Textures/Sprites/MonsterA/Idle.xnb


BIN
BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/Content/Textures/Sprites/MonsterA/Run.xnb


BIN
BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/Content/Textures/Sprites/MonsterB/Die.xnb


BIN
BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/Content/Textures/Sprites/MonsterB/Idle.xnb


BIN
BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/Content/Textures/Sprites/MonsterB/Run.xnb


BIN
BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/Content/Textures/Sprites/MonsterC/Die.xnb


BIN
BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/Content/Textures/Sprites/MonsterC/Idle.xnb


BIN
BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/Content/Textures/Sprites/MonsterC/Run.xnb


BIN
BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/Content/Textures/Sprites/MonsterD/Die.xnb


BIN
BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/Content/Textures/Sprites/MonsterD/Idle.xnb


BIN
BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/Content/Textures/Sprites/MonsterD/Run.xnb


BIN
BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/Content/Textures/Sprites/Player/Celebrate.xnb


BIN
BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/Content/Textures/Sprites/Player/Die.xnb


BIN
BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/Content/Textures/Sprites/Player/Idle.xnb


BIN
BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/Content/Textures/Sprites/Player/Jump.xnb


BIN
BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/Content/Textures/Sprites/Player/Run.xnb


BIN
BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/Content/Textures/TitleScreen.xnb


+ 0 - 106
BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/Enemy.cs

@@ -1,106 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using Microsoft.Xna.Framework;
-using Microsoft.Xna.Framework.Content;
-using Microsoft.Xna.Framework.Graphics;
-using Tile_Engine;
-
-namespace Gemstone_Hunter
-{
-    public class Enemy : GameObject
-    {
-        private Vector2 fallSpeed = new Vector2(0, 20);
-        private float walkSpeed = 60.0f;
-        private bool facingLeft = true;
-        public bool Dead = false;
-
-        #region Constructor
-        public Enemy(ContentManager content, int cellX, int cellY)
-        {
-            animations.Add("idle",
-                new AnimationStrip(
-                    content.Load<Texture2D>(
-                        @"Textures\Sprites\MonsterC\Idle"),
-                    48,
-                    "idle"));
-            animations["idle"].LoopAnimation = true;
-
-            animations.Add("run",
-                new AnimationStrip(
-                    content.Load<Texture2D>(
-                        @"Textures\Sprites\MonsterC\Run"),
-                    48,
-                    "run"));
-            animations["run"].FrameLength = 0.1f;
-            animations["run"].LoopAnimation = true;
-
-            animations.Add("die",
-                new AnimationStrip(
-                    content.Load<Texture2D>(
-                        @"Textures\Sprites\MonsterC\Die"),
-                    48,
-                    "die"));
-            animations["die"].LoopAnimation = false;
-
-            frameWidth = 48;
-            frameHeight = 48;
-            CollisionRectangle = new Rectangle(9, 1, 30, 46);
-
-            worldLocation = new Vector2(
-                cellX * TileMap.TileWidth,
-                cellY * TileMap.TileHeight);
-
-            enabled = true;
-
-            codeBasedBlocks = true;
-            PlayAnimation("run");
-        }
-        #endregion
-
-        #region Public Methods
-        public override void Update(GameTime gameTime)
-        {
-            Vector2 oldLocation = worldLocation;
-
-            if (!Dead)
-            {
-                velocity = new Vector2(0, velocity.Y);
-
-                Vector2 direction = new Vector2(1, 0);
-                flipped = true;
-
-                if (facingLeft)
-                {
-                    direction = new Vector2(-1, 0);
-                    flipped = false;
-                }
-
-                direction *= walkSpeed;
-                velocity += direction;
-                velocity += fallSpeed;
-            }
-
-            base.Update(gameTime);
-
-            if (!Dead)
-            {
-                if (oldLocation == worldLocation)
-                {
-                    facingLeft = !facingLeft;
-                }
-            }
-            else
-            {
-                if (animations[currentAnimation].FinishedPlaying)
-                {
-                    enabled = false;
-                }
-            }
-
-        }
-        #endregion
-
-    }
-}

BIN
BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/Game.ico


+ 0 - 229
BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/Game1.cs

@@ -1,229 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using Microsoft.Xna.Framework;
-using Microsoft.Xna.Framework.Audio;
-using Microsoft.Xna.Framework.Content;
-using Microsoft.Xna.Framework.GamerServices;
-using Microsoft.Xna.Framework.Graphics;
-using Microsoft.Xna.Framework.Input;
-using Microsoft.Xna.Framework.Media;
-using Tile_Engine;
-
-namespace Gemstone_Hunter
-{
-    /// <summary>
-    /// This is the main type for your game
-    /// </summary>
-    public class Game1 : Microsoft.Xna.Framework.Game
-    {
-        GraphicsDeviceManager graphics;
-        SpriteBatch spriteBatch;
-        Player player;
-        SpriteFont pericles8;
-        Vector2 scorePosition = new Vector2(20, 580);
-        enum GameState { TitleScreen, Playing, PlayerDead, GameOver };
-        GameState gameState = GameState.TitleScreen;
-
-        Vector2 gameOverPosition = new Vector2(350, 300);
-        Vector2 livesPosition = new Vector2(600, 580);
-
-        Texture2D titleScreen;
-
-        float deathTimer = 0.0f;
-        float deathDelay = 5.0f;
-
-        public Game1()
-        {
-            graphics = new GraphicsDeviceManager(this);
-            Content.RootDirectory = "Content";
-        }
-
-        /// <summary>
-        /// Allows the game to perform any initialization it needs to before starting to run.
-        /// This is where it can query for any required services and load any non-graphic
-        /// related content.  Calling base.Initialize will enumerate through any components
-        /// and initialize them as well.
-        /// </summary>
-        protected override void Initialize()
-        {
-            // TODO: Add your initialization logic here
-
-            this.graphics.PreferredBackBufferWidth = 800;
-            this.graphics.PreferredBackBufferHeight = 600;
-            this.graphics.ApplyChanges();
-            base.Initialize();
-        }
-
-        /// <summary>
-        /// LoadContent will be called once per game and is the place to load
-        /// all of your content.
-        /// </summary>
-        protected override void LoadContent()
-        {
-            spriteBatch = new SpriteBatch(GraphicsDevice);
-
-            TileMap.Initialize(
-                Content.Load<Texture2D>(@"Textures\PlatformTiles"));
-            TileMap.spriteFont =
-                Content.Load<SpriteFont>(@"Fonts\Pericles8");
-
-            pericles8 = Content.Load<SpriteFont>(@"Fonts\Pericles8");
-
-            titleScreen = Content.Load<Texture2D>(@"Textures\TitleScreen");
-
-            Camera.WorldRectangle = new Rectangle(0, 0, 160 * 48, 12 * 48);
-            Camera.Position = Vector2.Zero;
-            Camera.ViewPortWidth = 800;
-            Camera.ViewPortHeight = 600;
-
-            player = new Player(Content);
-            LevelManager.Initialize(Content, player);
-        }
-
-        private void StartNewGame()
-        {
-            player.Revive();
-            player.LivesRemaining = 3;
-            player.WorldLocation = Vector2.Zero;
-            LevelManager.LoadLevel(0);
-        }
-
-        /// <summary>
-        /// UnloadContent will be called once per game and is the place to unload
-        /// all content.
-        /// </summary>
-        protected override void UnloadContent()
-        {
-            // TODO: Unload any non ContentManager content here
-        }
-
-        /// <summary>
-        /// Allows the game to run logic such as updating the world,
-        /// checking for collisions, gathering input, and playing audio.
-        /// </summary>
-        /// <param name="gameTime">Provides a snapshot of timing values.</param>
-        protected override void Update(GameTime gameTime)
-        {
-			KeyboardState keyState = Keyboard.GetState();
-			
-            // Allows the game to exit
-            if (keyState.IsKeyDown(Keys.Escape) || GamePad.GetState(PlayerIndex.One).Buttons.Back ==
-                ButtonState.Pressed)
-                this.Exit();
-
-            
-            GamePadState gamepadState = GamePad.GetState(PlayerIndex.One);
-            float elapsed = (float)gameTime.ElapsedGameTime.TotalSeconds;
-
-            if (gameState == GameState.TitleScreen)
-            {
-                if (keyState.IsKeyDown(Keys.Space) ||
-                    gamepadState.Buttons.A == ButtonState.Pressed)
-                {
-                    StartNewGame();
-                    gameState = GameState.Playing;
-                }
-            }
-
-            if (gameState == GameState.Playing)
-            {
-                player.Update(gameTime);
-                LevelManager.Update(gameTime);
-                if (player.Dead)
-                {
-                    if (player.LivesRemaining > 0)
-                    {
-                        gameState = GameState.PlayerDead;
-                        deathTimer = 0.0f;
-                    }
-                    else
-                    {
-                        gameState = GameState.GameOver;
-                        deathTimer = 0.0f;
-                    }
-                }
-            }
-
-            if (gameState == GameState.PlayerDead)
-            {
-                player.Update(gameTime);
-                LevelManager.Update(gameTime);
-                deathTimer += elapsed;
-                if (deathTimer > deathDelay)
-                {
-                    player.WorldLocation = Vector2.Zero;
-                    LevelManager.ReloadLevel();
-                    player.Revive();
-                    gameState = GameState.Playing;
-                }
-            }
-
-            if (gameState == GameState.GameOver)
-            {
-                deathTimer += elapsed;
-                if (deathTimer > deathDelay)
-                {
-                    gameState = GameState.TitleScreen;
-                }
-            }
-
-            base.Update(gameTime);
-        }
-
-        /// <summary>
-        /// This is called when the game should draw itself.
-        /// </summary>
-        /// <param name="gameTime">Provides a snapshot of timing values.</param>
-        protected override void Draw(GameTime gameTime)
-        {
-            GraphicsDevice.Clear(Color.Black);
-
-            spriteBatch.Begin(
-                SpriteSortMode.BackToFront,
-                BlendState.AlphaBlend);
-
-            if (gameState == GameState.TitleScreen)
-            {
-                spriteBatch.Draw(titleScreen, Vector2.Zero, Color.White);
-            }
-
-            if ((gameState == GameState.Playing) ||
-                (gameState == GameState.PlayerDead) ||
-                (gameState == GameState.GameOver))
-            {
-                TileMap.Draw(spriteBatch);
-                player.Draw(spriteBatch);
-                LevelManager.Draw(spriteBatch);
-                spriteBatch.DrawString(
-                    pericles8,
-                    "Score: " + player.Score.ToString(),
-                    scorePosition,
-                    Color.White);
-                spriteBatch.DrawString(
-                    pericles8,
-                    "Lives Remaining: " + player.LivesRemaining.ToString(),
-                    livesPosition,
-                    Color.White);
-            }
-
-            if (gameState == GameState.PlayerDead)
-            {
-            }
-
-            if (gameState == GameState.GameOver)
-            {
-                spriteBatch.DrawString(
-                    pericles8,
-                    "G A M E  O V E R !",
-                    gameOverPosition,
-                    Color.White);
-            }
-
-            spriteBatch.End();
-
-            base.Draw(gameTime);
-        }
-
-    }
-}

+ 0 - 267
BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/GameObject.cs

@@ -1,267 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using Microsoft.Xna.Framework;
-using Microsoft.Xna.Framework.Graphics;
-using Tile_Engine;
-
-namespace Gemstone_Hunter
-{
-    public class GameObject
-    {
-        #region Declarations
-        protected Vector2 worldLocation;
-        protected Vector2 velocity;
-        protected int frameWidth;
-        protected int frameHeight;
-
-        protected bool enabled;
-        protected bool flipped = false;
-        protected bool onGround;
-
-        protected Rectangle collisionRectangle;
-        protected int collideWidth;
-        protected int collideHeight;
-        protected bool codeBasedBlocks = true;
-
-        protected float drawDepth = 0.85f;
-        protected Dictionary<string, AnimationStrip> animations =
-            new Dictionary<string, AnimationStrip>();
-        protected string currentAnimation;
-        #endregion
-
-        #region Properties
-        public bool Enabled
-        {
-            get { return enabled; }
-            set { enabled = value; }
-        }
-
-        public Vector2 WorldLocation
-        {
-            get { return worldLocation; }
-            set { worldLocation = value; }
-        }
-
-        public Vector2 WorldCenter
-        {
-            get
-            {
-                return new Vector2(
-                  (int)worldLocation.X + (int)(frameWidth / 2),
-                  (int)worldLocation.Y + (int)(frameHeight / 2));
-            }
-        }
-
-        public Rectangle WorldRectangle
-        {
-            get
-            {
-                return new Rectangle(
-                    (int)worldLocation.X,
-                    (int)worldLocation.Y,
-                    frameWidth,
-                    frameHeight);
-            }
-        }
-
-        public Rectangle CollisionRectangle
-        {
-            get
-            {
-                return new Rectangle(
-                    (int)worldLocation.X + collisionRectangle.X,
-                    (int)WorldRectangle.Y + collisionRectangle.Y,
-                    collisionRectangle.Width,
-                    collisionRectangle.Height);
-            }
-            set { collisionRectangle = value; }
-        }
-        #endregion 
-
-        #region Helper Methods
-        private void updateAnimation(GameTime gameTime)
-        {
-            if (animations.ContainsKey(currentAnimation))
-            {
-                if (animations[currentAnimation].FinishedPlaying)
-                {
-                    PlayAnimation(animations[currentAnimation].NextAnimation);
-                }
-                else
-                {
-                    animations[currentAnimation].Update(gameTime);
-                }
-            }
-        }
-        #endregion
-
-        #region Map-Based Collision Detection Methods
-        private Vector2 horizontalCollisionTest(Vector2 moveAmount)
-        {
-            if (moveAmount.X == 0)
-                return moveAmount;
-
-            Rectangle afterMoveRect = CollisionRectangle;
-            afterMoveRect.Offset((int)moveAmount.X, 0);
-            Vector2 corner1, corner2;
-
-            if (moveAmount.X < 0)
-            {
-                corner1 = new Vector2(afterMoveRect.Left,
-                                      afterMoveRect.Top + 1);
-                corner2 = new Vector2(afterMoveRect.Left,
-                                      afterMoveRect.Bottom - 1);
-            }
-            else
-            {
-                corner1 = new Vector2(afterMoveRect.Right,
-                                      afterMoveRect.Top + 1);
-                corner2 = new Vector2(afterMoveRect.Right,
-                                      afterMoveRect.Bottom - 1);
-            }
-
-            Vector2 mapCell1 = TileMap.GetCellByPixel(corner1);
-            Vector2 mapCell2 = TileMap.GetCellByPixel(corner2);
-
-            if (!TileMap.CellIsPassable(mapCell1) ||
-                !TileMap.CellIsPassable(mapCell2))
-            {
-                moveAmount.X = 0;
-                velocity.X = 0;
-            }
-
-            if (codeBasedBlocks)
-            {
-                if (TileMap.CellCodeValue(mapCell1) == "BLOCK" ||
-                    TileMap.CellCodeValue(mapCell2) == "BLOCK")
-                {
-                    moveAmount.X = 0;
-                    velocity.X = 0;
-                }
-            }
-
-            return moveAmount;
-        }
-
-        private Vector2 verticalCollisionTest(Vector2 moveAmount)
-        {
-            if (moveAmount.Y == 0)
-                return moveAmount;
-
-            Rectangle afterMoveRect = CollisionRectangle;
-            afterMoveRect.Offset((int)moveAmount.X, (int)moveAmount.Y);
-            Vector2 corner1, corner2;
-
-            if (moveAmount.Y < 0)
-            {
-                corner1 = new Vector2(afterMoveRect.Left + 1,
-                                      afterMoveRect.Top);
-                corner2 = new Vector2(afterMoveRect.Right - 1,
-                                      afterMoveRect.Top);
-            }
-            else
-            {
-                corner1 = new Vector2(afterMoveRect.Left + 1,
-                                      afterMoveRect.Bottom);
-                corner2 = new Vector2(afterMoveRect.Right - 1,
-                                      afterMoveRect.Bottom);
-            }
-
-            Vector2 mapCell1 = TileMap.GetCellByPixel(corner1);
-            Vector2 mapCell2 = TileMap.GetCellByPixel(corner2);
-
-            if (!TileMap.CellIsPassable(mapCell1) ||
-                !TileMap.CellIsPassable(mapCell2))
-            {
-                if (moveAmount.Y > 0)
-                    onGround = true;
-                moveAmount.Y = 0;
-                velocity.Y = 0;
-            }
-
-            if (codeBasedBlocks)
-            {
-                if (TileMap.CellCodeValue(mapCell1) == "BLOCK" ||
-                    TileMap.CellCodeValue(mapCell2) == "BLOCK")
-                {
-                    if (moveAmount.Y > 0)
-                        onGround = true;
-                    moveAmount.Y = 0;
-                    velocity.Y = 0;
-                }
-            }
-
-            return moveAmount;
-        }
-
-        #endregion
-
-        #region Public Methods
-        public void PlayAnimation(string name)
-        {
-            if (!(name == null) && animations.ContainsKey(name))
-            {
-                currentAnimation = name;
-                animations[name].Play();
-            }
-        }
-
-        public virtual void Update(GameTime gameTime)
-        {
-            if (!enabled)
-                return;
-
-            float elapsed = (float)gameTime.ElapsedGameTime.TotalSeconds;
-
-            updateAnimation(gameTime);
-
-            if (velocity.Y != 0)
-            {
-                onGround = false;
-            }
-
-            Vector2 moveAmount = velocity * elapsed;
-
-            moveAmount = horizontalCollisionTest(moveAmount);
-            moveAmount = verticalCollisionTest(moveAmount);
-
-            Vector2 newPosition = worldLocation + moveAmount;
-
-            newPosition = new Vector2(
-                MathHelper.Clamp(newPosition.X, 0,
-                  Camera.WorldRectangle.Width - frameWidth),
-                MathHelper.Clamp(newPosition.Y, 2 * (-TileMap.TileHeight),
-                  Camera.WorldRectangle.Height - frameHeight));
-
-            worldLocation = newPosition;
-        }
-
-        public virtual void Draw(SpriteBatch spriteBatch)
-        {
-            if (!enabled)
-                return;
-
-            if (animations.ContainsKey(currentAnimation))
-            {
-
-                SpriteEffects effect = SpriteEffects.None;
-
-                if (flipped)
-                {
-                    effect = SpriteEffects.FlipHorizontally;
-                }
-
-                spriteBatch.Draw(
-                    animations[currentAnimation].Texture,
-                    Camera.WorldToScreen(WorldRectangle),
-                    animations[currentAnimation].FrameRectangle,
-                    Color.White, 0.0f, Vector2.Zero, effect, drawDepth);
-            }
-        }
-
-        #endregion
-
-    }
-}

BIN
BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/GameThumbnail.png


+ 0 - 40
BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/Gemstone.cs

@@ -1,40 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using Microsoft.Xna.Framework;
-using Microsoft.Xna.Framework.Content;
-using Microsoft.Xna.Framework.Graphics;
-using Tile_Engine;
-
-namespace Gemstone_Hunter
-{
-    public class Gemstone : GameObject
-    {
-        #region Constructor
-        public Gemstone(ContentManager Content, int cellX, int cellY)
-        {
-            worldLocation.X = TileMap.TileWidth * cellX;
-            worldLocation.Y = TileMap.TileHeight * cellY;
-
-            frameWidth = TileMap.TileWidth;
-            frameHeight = TileMap.TileHeight;
-
-            animations.Add("idle",
-                new AnimationStrip(
-                    Content.Load<Texture2D>(@"Textures\Gem"),
-                    48,
-                    "idle"));
-
-            animations["idle"].LoopAnimation = true;
-            animations["idle"].FrameLength = 0.15f;
-            PlayAnimation("idle");
-            drawDepth = 0.875f;
-
-            CollisionRectangle = new Rectangle(9, 24, 30, 24);
-            enabled = true;
-        }
-        #endregion
-
-    }
-}

+ 0 - 186
BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/GemstoneHunter.Linux.csproj

@@ -1,186 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <PropertyGroup>
-    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
-    <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
-    <ProductVersion>9.0.21022</ProductVersion>
-    <SchemaVersion>2.0</SchemaVersion>
-    <ProjectGuid>{86A219E2-C8F0-452B-B762-C69D5BB07C98}</ProjectGuid>
-    <OutputType>Exe</OutputType>
-    <RootNamespace>AsteroidBeltAssault</RootNamespace>
-    <AssemblyName>FloodControl</AssemblyName>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
-    <DebugSymbols>True</DebugSymbols>
-    <DebugType>full</DebugType>
-    <Optimize>False</Optimize>
-    <OutputPath>bin\Debug</OutputPath>
-    <DefineConstants>DEBUG,LINUX</DefineConstants>
-    <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
-    <PlatformTarget>x86</PlatformTarget>
-    <ConsolePause>False</ConsolePause>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
-    <DebugType>none</DebugType>
-    <Optimize>False</Optimize>
-    <OutputPath>bin\Release</OutputPath>
-    <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
-    <PlatformTarget>x86</PlatformTarget>
-    <ConsolePause>False</ConsolePause>
-  </PropertyGroup>
-  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
-  <ItemGroup>
-    <Reference Include="System" />
-    <Reference Include="System.Xml" />
-    <Reference Include="System.Core" />
-    <Reference Include="System.Xml.Linq" />
-    <Reference Include="System.Drawing" />
-  </ItemGroup>
-  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
-  <Import Project="$(MSBuildExtensionsPath)\Mono\MonoMac\v0.0\Mono.MonoMac.targets" />
-  <ItemGroup>
-    <ProjectReference Include="TileEngine\Tile Engine.Linux.csproj">
-      <Project>{521972FD-1A9B-4CFD-A435-EB2224985131}</Project>
-      <Name>Tile Engine.Linux</Name>
-    </ProjectReference>
-  </ItemGroup>
-  <ItemGroup>
-    <Compile Include="Program.cs" />
-    <Compile Include="AnimationStrip.cs">
-      <Link>AnimationStrip.cs</Link>
-    </Compile>
-    <Compile Include="Enemy.cs">
-      <Link>Enemy.cs</Link>
-    </Compile>
-    <Compile Include="Game1.cs">
-      <Link>Game1.cs</Link>
-    </Compile>
-    <Compile Include="GameObject.cs">
-      <Link>GameObject.cs</Link>
-    </Compile>
-    <Compile Include="Gemstone.cs">
-      <Link>Gemstone.cs</Link>
-    </Compile>
-    <Compile Include="LevelManager.cs">
-      <Link>LevelManager.cs</Link>
-    </Compile>
-    <Compile Include="Player.cs">
-      <Link>Player.cs</Link>
-    </Compile>
-  </ItemGroup>
-  <ItemGroup>
-    <None Include="Game.ico">
-      <Link>Game.ico</Link>
-    </None>
-    <None Include="GameThumbnail.png">
-      <Link>GameThumbnail.png</Link>
-    </None>
-    <None Include="README.md">
-      <Link>README.md</Link>
-    </None>
-  </ItemGroup>
-  <ItemGroup>
-    <Content Include="Content\Fonts\Pericles10Bold.xnb">
-      <Link>Content\Fonts\Pericles10Bold.xnb</Link>
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
-    </Content>
-    <Content Include="Content\Fonts\Pericles8.xnb">
-      <Link>Content\Fonts\Pericles8.xnb</Link>
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
-    </Content>
-    <Content Include="Content\Maps\MAP000.MAP">
-      <Link>Content\Maps\MAP000.MAP</Link>
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
-    </Content>
-    <Content Include="Content\Maps\MAP001.MAP">
-      <Link>Content\Maps\MAP001.MAP</Link>
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
-    </Content>
-    <Content Include="Content\Textures\Gem.xnb">
-      <Link>Content\Textures\Gem.xnb</Link>
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
-    </Content>
-    <Content Include="Content\Textures\PlatformTiles.xnb">
-      <Link>Content\Textures\PlatformTiles.xnb</Link>
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
-    </Content>
-    <Content Include="Content\Textures\TitleScreen.xnb">
-      <Link>Content\Textures\TitleScreen.xnb</Link>
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
-    </Content>
-    <Content Include="Content\Textures\Sprites\Gem.xnb">
-      <Link>Content\Textures\Sprites\Gem.xnb</Link>
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
-    </Content>
-    <Content Include="Content\Textures\Sprites\Player\Celebrate.xnb">
-      <Link>Content\Textures\Sprites\Player\Celebrate.xnb</Link>
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
-    </Content>
-    <Content Include="Content\Textures\Sprites\Player\Die.xnb">
-      <Link>Content\Textures\Sprites\Player\Die.xnb</Link>
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
-    </Content>
-    <Content Include="Content\Textures\Sprites\Player\Idle.xnb">
-      <Link>Content\Textures\Sprites\Player\Idle.xnb</Link>
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
-    </Content>
-    <Content Include="Content\Textures\Sprites\Player\Jump.xnb">
-      <Link>Content\Textures\Sprites\Player\Jump.xnb</Link>
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
-    </Content>
-    <Content Include="Content\Textures\Sprites\Player\Run.xnb">
-      <Link>Content\Textures\Sprites\Player\Run.xnb</Link>
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
-    </Content>
-    <Content Include="Content\Textures\Sprites\MonsterA\Die.xnb">
-      <Link>Content\Textures\Sprites\MonsterA\Die.xnb</Link>
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
-    </Content>
-    <Content Include="Content\Textures\Sprites\MonsterA\Idle.xnb">
-      <Link>Content\Textures\Sprites\MonsterA\Idle.xnb</Link>
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
-    </Content>
-    <Content Include="Content\Textures\Sprites\MonsterA\Run.xnb">
-      <Link>Content\Textures\Sprites\MonsterA\Run.xnb</Link>
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
-    </Content>
-    <Content Include="Content\Textures\Sprites\MonsterB\Die.xnb">
-      <Link>Content\Textures\Sprites\MonsterB\Die.xnb</Link>
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
-    </Content>
-    <Content Include="Content\Textures\Sprites\MonsterB\Idle.xnb">
-      <Link>Content\Textures\Sprites\MonsterB\Idle.xnb</Link>
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
-    </Content>
-    <Content Include="Content\Textures\Sprites\MonsterB\Run.xnb">
-      <Link>Content\Textures\Sprites\MonsterB\Run.xnb</Link>
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
-    </Content>
-    <Content Include="Content\Textures\Sprites\MonsterC\Die.xnb">
-      <Link>Content\Textures\Sprites\MonsterC\Die.xnb</Link>
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
-    </Content>
-    <Content Include="Content\Textures\Sprites\MonsterC\Idle.xnb">
-      <Link>Content\Textures\Sprites\MonsterC\Idle.xnb</Link>
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
-    </Content>
-    <Content Include="Content\Textures\Sprites\MonsterC\Run.xnb">
-      <Link>Content\Textures\Sprites\MonsterC\Run.xnb</Link>
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
-    </Content>
-    <Content Include="Content\Textures\Sprites\MonsterD\Die.xnb">
-      <Link>Content\Textures\Sprites\MonsterD\Die.xnb</Link>
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
-    </Content>
-    <Content Include="Content\Textures\Sprites\MonsterD\Idle.xnb">
-      <Link>Content\Textures\Sprites\MonsterD\Idle.xnb</Link>
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
-    </Content>
-    <Content Include="Content\Textures\Sprites\MonsterD\Run.xnb">
-      <Link>Content\Textures\Sprites\MonsterD\Run.xnb</Link>
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
-    </Content>
-  </ItemGroup>
-</Project>

+ 0 - 115
BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/GemstoneHunter.MacOS.csproj

@@ -1,115 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <PropertyGroup>
-    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
-    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
-    <ProductVersion>10.0.0</ProductVersion>
-    <SchemaVersion>2.0</SchemaVersion>
-    <ProjectGuid>{81313197-A8DF-4465-B503-2DD8248B80A9}</ProjectGuid>
-    <ProjectTypeGuids>{948B3504-5B70-4649-8FE4-BDE1FB46EC69};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
-    <OutputType>Exe</OutputType>
-    <RootNamespace>GemstoneHunter</RootNamespace>
-    <AssemblyName>GemstoneHunter</AssemblyName>
-    <SuppressXamMacUpsell>True</SuppressXamMacUpsell>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
-    <DebugSymbols>True</DebugSymbols>
-    <DebugType>full</DebugType>
-    <Optimize>False</Optimize>
-    <OutputPath>bin\Debug</OutputPath>
-    <DefineConstants>DEBUG;MONOMAC</DefineConstants>
-    <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
-    <ConsolePause>False</ConsolePause>
-    <EnableCodeSigning>False</EnableCodeSigning>
-    <CreatePackage>False</CreatePackage>
-    <EnablePackageSigning>False</EnablePackageSigning>
-    <IncludeMonoRuntime>False</IncludeMonoRuntime>
-    <UseSGen>False</UseSGen>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
-    <DebugType>none</DebugType>
-    <Optimize>False</Optimize>
-    <OutputPath>bin\Release</OutputPath>
-    <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
-    <ConsolePause>False</ConsolePause>
-    <EnableCodeSigning>False</EnableCodeSigning>
-    <CreatePackage>False</CreatePackage>
-    <EnablePackageSigning>False</EnablePackageSigning>
-    <IncludeMonoRuntime>False</IncludeMonoRuntime>
-    <DefineConstants>MONOMAC</DefineConstants>
-    <UseSGen>False</UseSGen>
-  </PropertyGroup>
-  <ItemGroup>
-    <Reference Include="System" />
-    <Reference Include="System.Xml" />
-    <Reference Include="System.Core" />
-    <Reference Include="System.Xml.Linq" />
-    <Reference Include="System.Drawing" />
-    <Reference Include="MonoMac" />
-  </ItemGroup>
-  <ItemGroup>
-    <None Include="Info.plist">
-    </None>
-    <None Include="Game.ico" />
-    <None Include="GameThumbnail.png" />
-    <None Include="README.md" />
-  </ItemGroup>
-  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
-  <Import Project="$(MSBuildExtensionsPath)\Mono\MonoMac\v0.0\Mono.MonoMac.targets" />
-  <ItemGroup>
-    <ProjectReference Include="TileEngine\Tile Engine.MacOS.csproj">
-      <Project>{521972FD-1A9B-4CFD-A435-EB2224985131}</Project>
-      <Name>Tile Engine.MacOS</Name>
-    </ProjectReference>
-    <ProjectReference Include="..\..\..\..\ThirdParty\Lidgren.Network\Lidgren.Network.MacOS.csproj">
-      <Project>{AE483C29-042E-4226-BA52-D247CE7676DA}</Project>
-      <Name>Lidgren.Network.MacOS</Name>
-    </ProjectReference>
-    <ProjectReference Include="..\..\..\..\MonoGame.Framework\MonoGame.Framework.MacOS.csproj">
-      <Project>{36C538E6-C32A-4A8D-A39C-566173D7118E}</Project>
-      <Name>MonoGame.Framework.MacOS</Name>
-    </ProjectReference>
-  </ItemGroup>
-  <ItemGroup>
-    <Folder Include="Content\" />
-  </ItemGroup>
-  <ItemGroup>
-    <Compile Include="AnimationStrip.cs" />
-    <Compile Include="Enemy.cs" />
-    <Compile Include="Game1.cs" />
-    <Compile Include="GameObject.cs" />
-    <Compile Include="Gemstone.cs" />
-    <Compile Include="LevelManager.cs" />
-    <Compile Include="Player.cs" />
-    <Compile Include="Program.cs" />
-  </ItemGroup>
-  <ItemGroup>
-    <Content Include="Content\Fonts\Pericles10Bold.xnb" />
-    <Content Include="Content\Fonts\Pericles8.xnb" />
-    <Content Include="Content\Maps\MAP000.MAP" />
-    <Content Include="Content\Maps\MAP001.MAP" />
-    <Content Include="Content\Textures\Gem.xnb" />
-    <Content Include="Content\Textures\PlatformTiles.xnb" />
-    <Content Include="Content\Textures\TitleScreen.xnb" />
-    <Content Include="Content\Textures\Sprites\Gem.xnb" />
-    <Content Include="Content\Textures\Sprites\Player\Celebrate.xnb" />
-    <Content Include="Content\Textures\Sprites\Player\Die.xnb" />
-    <Content Include="Content\Textures\Sprites\Player\Idle.xnb" />
-    <Content Include="Content\Textures\Sprites\Player\Jump.xnb" />
-    <Content Include="Content\Textures\Sprites\Player\Run.xnb" />
-    <Content Include="Content\Textures\Sprites\MonsterD\Die.xnb" />
-    <Content Include="Content\Textures\Sprites\MonsterD\Idle.xnb" />
-    <Content Include="Content\Textures\Sprites\MonsterD\Run.xnb" />
-    <Content Include="Content\Textures\Sprites\MonsterC\Die.xnb" />
-    <Content Include="Content\Textures\Sprites\MonsterC\Idle.xnb" />
-    <Content Include="Content\Textures\Sprites\MonsterC\Run.xnb" />
-    <Content Include="Content\Textures\Sprites\MonsterB\Die.xnb" />
-    <Content Include="Content\Textures\Sprites\MonsterB\Idle.xnb" />
-    <Content Include="Content\Textures\Sprites\MonsterB\Run.xnb" />
-    <Content Include="Content\Textures\Sprites\MonsterA\Die.xnb" />
-    <Content Include="Content\Textures\Sprites\MonsterA\Idle.xnb" />
-    <Content Include="Content\Textures\Sprites\MonsterA\Run.xnb" />
-  </ItemGroup>
-</Project>

+ 0 - 43
BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/GemstoneHunter.sln

@@ -1,43 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 11.00
-# Visual Studio 2010
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GemstoneHunter", "GemstoneHunter.csproj", "{81313197-A8DF-4465-B503-2DD8248B80A9}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lidgren.Network", "..\..\..\..\..\..\..\Users\Jimmy\Public\Share\MonoMacSource\kjpgit\MonoGame\ThirdParty\Lidgren.Network\Lidgren.Network.csproj", "{AE483C29-042E-4226-BA52-D247CE7676DA}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MonoGame.Framework.MacOS", "..\..\..\..\..\..\..\Users\Jimmy\Public\Share\MonoMacSource\kjpgit\MonoGame\MonoGame.Framework\MonoGame.Framework.MacOS.csproj", "{36C538E6-C32A-4A8D-A39C-566173D7118E}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tile Engine", "TileEngine\Tile Engine.csproj", "{521972FD-1A9B-4CFD-A435-EB2224985131}"
-EndProject
-Global
-	GlobalSection(SolutionConfigurationPlatforms) = preSolution
-		Debug|Any CPU = Debug|Any CPU
-		Release|Any CPU = Release|Any CPU
-		Distribution|Any CPU = Distribution|Any CPU
-	EndGlobalSection
-	GlobalSection(ProjectConfigurationPlatforms) = postSolution
-		{36C538E6-C32A-4A8D-A39C-566173D7118E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{36C538E6-C32A-4A8D-A39C-566173D7118E}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{36C538E6-C32A-4A8D-A39C-566173D7118E}.Distribution|Any CPU.ActiveCfg = Distribution|Any CPU
-		{36C538E6-C32A-4A8D-A39C-566173D7118E}.Distribution|Any CPU.Build.0 = Distribution|Any CPU
-		{36C538E6-C32A-4A8D-A39C-566173D7118E}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{36C538E6-C32A-4A8D-A39C-566173D7118E}.Release|Any CPU.Build.0 = Release|Any CPU
-		{521972FD-1A9B-4CFD-A435-EB2224985131}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{521972FD-1A9B-4CFD-A435-EB2224985131}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{521972FD-1A9B-4CFD-A435-EB2224985131}.Distribution|Any CPU.ActiveCfg = Debug|Any CPU
-		{521972FD-1A9B-4CFD-A435-EB2224985131}.Distribution|Any CPU.Build.0 = Debug|Any CPU
-		{521972FD-1A9B-4CFD-A435-EB2224985131}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{521972FD-1A9B-4CFD-A435-EB2224985131}.Release|Any CPU.Build.0 = Release|Any CPU
-		{81313197-A8DF-4465-B503-2DD8248B80A9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{81313197-A8DF-4465-B503-2DD8248B80A9}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{81313197-A8DF-4465-B503-2DD8248B80A9}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{81313197-A8DF-4465-B503-2DD8248B80A9}.Release|Any CPU.Build.0 = Release|Any CPU
-		{AE483C29-042E-4226-BA52-D247CE7676DA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{AE483C29-042E-4226-BA52-D247CE7676DA}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{AE483C29-042E-4226-BA52-D247CE7676DA}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{AE483C29-042E-4226-BA52-D247CE7676DA}.Release|Any CPU.Build.0 = Release|Any CPU
-	EndGlobalSection
-	GlobalSection(MonoDevelopProperties) = preSolution
-		StartupItem = GemstoneHunter.csproj
-	EndGlobalSection
-EndGlobal

+ 0 - 16
BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/Info.plist

@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
-	<key>CFBundleIdentifier</key>
-	<string>com.yourcompany.GemstoneHunter</string>
-	<key>CFBundleName</key>
-	<string>GemstoneHunter</string>
-	<key>CFBundleVersion</key>
-	<string>1</string>
-	<key>LSMinimumSystemVersion</key>
-	<string>10.6</string>
-	<key>NSPrincipalClass</key>
-	<string>NSApplication</string>
-</dict>
-</plist>

+ 0 - 171
BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/LevelManager.cs

@@ -1,171 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using Microsoft.Xna.Framework.Storage;
-using Microsoft.Xna.Framework.Content;
-using Microsoft.Xna.Framework;
-using Microsoft.Xna.Framework.Graphics;
-using Tile_Engine;
-
-namespace Gemstone_Hunter
-{
-    public static class LevelManager
-    {
-        #region Declarations
-        private static ContentManager Content;
-        private static Player player;
-        private static int currentLevel;
-        private static Vector2 respawnLocation;
-
-        private static List<Gemstone> gemstones = new List<Gemstone>();
-        private static List<Enemy> enemies = new List<Enemy>();
-        #endregion
-
-        #region Properties
-        public static int CurrentLevel
-        {
-            get { return currentLevel; }
-        }
-
-        public static Vector2 RespawnLocation
-        {
-            get { return respawnLocation; }
-            set { respawnLocation = value; }
-        }
-        #endregion
-
-        #region Initialization
-        public static void Initialize(
-            ContentManager content,
-            Player gamePlayer)
-        {
-            Content = content;
-            player = gamePlayer;
-        }
-        #endregion
-
-        #region Helper Methods
-        private static void checkCurrentCellCode()
-        {
-            string code = TileMap.CellCodeValue(
-                TileMap.GetCellByPixel(player.WorldCenter));
-
-            if (code == "DEAD")
-            {
-                player.Kill();
-            }
-        }
-        #endregion
-
-        #region Public Methods
-        public static void LoadLevel(int levelNumber)
-        {
-            TileMap.LoadMap((System.IO.FileStream)TitleContainer.OpenStream(
-                "Content/Maps/MAP" +
-                levelNumber.ToString().PadLeft(3, '0') + ".MAP"));
-
-            gemstones.Clear();
-            enemies.Clear();
-
-            for (int x = 0; x < TileMap.MapWidth; x++)
-            {
-                for (int y = 0; y < TileMap.MapHeight; y++)
-                {
-                    if (TileMap.CellCodeValue(x, y) == "START")
-                    {
-                        player.WorldLocation = new Vector2(
-                            x * TileMap.TileWidth,
-                            y * TileMap.TileHeight);
-                    }
-
-                    if (TileMap.CellCodeValue(x, y) == "GEM")
-                    {
-                        gemstones.Add(new Gemstone(Content, x, y));
-                    }
-
-                    if (TileMap.CellCodeValue(x, y) == "ENEMY")
-                    {
-                        enemies.Add(new Enemy(Content, x, y));
-                    }
-
-                }
-            }
-
-            currentLevel = levelNumber;
-            respawnLocation = player.WorldLocation;
-        }
-
-        public static void ReloadLevel()
-        {
-            Vector2 saveRespawn = respawnLocation;
-            LoadLevel(currentLevel);
-
-            respawnLocation = saveRespawn;
-            player.WorldLocation = respawnLocation;
-        }
-
-        public static void Update(GameTime gameTime)
-        {
-            if (!player.Dead)
-            {
-                checkCurrentCellCode(); 
-
-                for (int x = gemstones.Count - 1; x >= 0; x--)
-                {
-                    gemstones[x].Update(gameTime);
-                    if (player.CollisionRectangle.Intersects(
-                        gemstones[x].CollisionRectangle))
-                    {
-                        gemstones.RemoveAt(x);
-                        player.Score += 10;
-                    }
-                }
-
-                for (int x = enemies.Count - 1; x >= 0; x--)
-                {
-                    enemies[x].Update(gameTime);
-                    if (!enemies[x].Dead)
-                    {
-                        if (player.CollisionRectangle.Intersects(
-                            enemies[x].CollisionRectangle))
-                        {
-                            if (player.WorldCenter.Y < enemies[x].WorldLocation.Y)
-                            {
-                                player.Jump();
-                                player.Score += 5;
-                                enemies[x].PlayAnimation("die");
-                                enemies[x].Dead = true; ;
-                            }
-                            else
-                            {
-                                player.Kill();
-                            }
-                        }
-                    }
-                    else
-                    {
-                        if (!enemies[x].Enabled)
-                        {
-                            enemies.RemoveAt(x);
-                        }
-                    }
-                }
-
-            }
-        }
-
-        public static void Draw(SpriteBatch spriteBatch)
-        {
-            foreach (Gemstone gem in gemstones)
-                gem.Draw(spriteBatch);
-
-            foreach (Enemy enemy in enemies)
-                enemy.Draw(spriteBatch);
-
-        }
-
-        #endregion
-
-    }
-}

+ 0 - 206
BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/Player.cs

@@ -1,206 +0,0 @@
-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;
-using Microsoft.Xna.Framework.Input;
-using Tile_Engine;
-
-namespace Gemstone_Hunter
-{
-    public class Player : GameObject
-    {
-        private Vector2 fallSpeed = new Vector2(0, 20);
-        private float moveScale = 180.0f;
-        private bool dead = false;
-        private int score = 0;
-        private int livesRemaining = 3;
-
-        public bool Dead
-        {
-            get { return dead; }
-        }
-
-        public int Score
-        {
-            get { return score; }
-            set { score = value; }
-        }
-
-        public int LivesRemaining
-        {
-            get { return livesRemaining; }
-            set { livesRemaining = value; }
-        }
-
-
-        #region Constructor
-        public Player(ContentManager content)
-        {
-            animations.Add("idle",
-                new AnimationStrip(
-                    content.Load<Texture2D>(@"Textures\Sprites\Player\Idle"),
-                    48,
-                    "idle"));
-            animations["idle"].LoopAnimation = true;
-
-            animations.Add("run",
-                new AnimationStrip(
-                    content.Load<Texture2D>(@"Textures\Sprites\Player\Run"),
-                    48,
-                    "run"));
-            animations["run"].LoopAnimation = true;
-
-            animations.Add("jump",
-                new AnimationStrip(
-                    content.Load<Texture2D>(@"Textures\Sprites\Player\Jump"),
-                    48,
-                    "jump"));
-            animations["jump"].LoopAnimation = false;
-            animations["jump"].FrameLength = 0.08f;
-            animations["jump"].NextAnimation = "idle";
-
-            animations.Add("die",
-                new AnimationStrip(
-                    content.Load<Texture2D>(@"Textures\Sprites\Player\Die"),
-                    48,
-                    "die"));
-            animations["die"].LoopAnimation = false;
-
-            frameWidth = 48;
-            frameHeight = 48;
-            CollisionRectangle = new Rectangle(9, 1, 30, 46);
-
-            drawDepth = 0.825f;
-
-            enabled = true;
-            codeBasedBlocks = false;
-            PlayAnimation("idle");
-        }
-        #endregion
-
-        #region Public Methods
-        public override void Update(GameTime gameTime)
-        {
-            if (!Dead)
-            {
-                string newAnimation = "idle";
-
-                velocity = new Vector2(0, velocity.Y);
-                GamePadState gamePad = GamePad.GetState(PlayerIndex.One);
-                KeyboardState keyState = Keyboard.GetState();
-
-                if (keyState.IsKeyDown(Keys.Left) ||
-                    (gamePad.ThumbSticks.Left.X < -0.3f))
-                {
-                    flipped = false;
-                    newAnimation = "run";
-                    velocity = new Vector2(-moveScale, velocity.Y);
-                }
-
-                if (keyState.IsKeyDown(Keys.Right) ||
-                    (gamePad.ThumbSticks.Left.X > 0.3f))
-                {
-                    flipped = true;
-                    newAnimation = "run";
-                    velocity = new Vector2(moveScale, velocity.Y);
-                }
-
-                if (keyState.IsKeyDown(Keys.Space) ||
-                    (gamePad.Buttons.A == ButtonState.Pressed))
-                {
-                    if (onGround)
-                    {
-                        Jump();
-                        newAnimation = "jump";
-                    }
-                }
-
-                if (keyState.IsKeyDown(Keys.Up) ||
-                    gamePad.ThumbSticks.Left.Y > 0.3f)
-                {
-                    checkLevelTransition();
-                }
-
-
-                if (currentAnimation == "jump")
-                    newAnimation = "jump";
-
-                if (newAnimation != currentAnimation)
-                {
-                    PlayAnimation(newAnimation);
-                }
-            }
-
-            velocity += fallSpeed;
-
-            repositionCamera();
-            base.Update(gameTime);
-        }
-
-        public void Jump()
-        {
-            velocity.Y = -500;
-        }
-
-        public void Kill()
-        {
-            PlayAnimation("die");
-            LivesRemaining--;
-            velocity.X = 0;
-            dead = true;
-        }
-
-        public void Revive()
-        {
-            PlayAnimation("idle");
-            dead = false;
-        }
-
-        #endregion
-
-        #region Helper Methods
-        private void repositionCamera()
-        {
-            int screenLocX = (int)Camera.WorldToScreen(worldLocation).X;
-
-            if (screenLocX > 500)
-            {
-                Camera.Move(new Vector2(screenLocX - 500, 0));
-            }
-
-            if (screenLocX < 200)
-            {
-                Camera.Move(new Vector2(screenLocX - 200, 0));
-            }
-        }
-
-        private void checkLevelTransition()
-        {
-            Vector2 centerCell = TileMap.GetCellByPixel(WorldCenter);
-            if (TileMap.CellCodeValue(centerCell).StartsWith("T_"))
-            {
-                string[] code = TileMap.CellCodeValue(centerCell).Split('_');
-
-                if (code.Length != 4)
-                    return;
-
-                LevelManager.LoadLevel(int.Parse(code[1]));
-
-                WorldLocation = new Vector2(
-                    int.Parse(code[2]) * TileMap.TileWidth,
-                    int.Parse(code[3]) * TileMap.TileHeight);
-
-                LevelManager.RespawnLocation = WorldLocation;
-
-                velocity = Vector2.Zero;
-            }
-        }
-
-        #endregion
-
-
-    }
-}

+ 0 - 60
BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/Program.cs

@@ -1,60 +0,0 @@
-using System;
-
-#if MONOMAC
-using MonoMac.Foundation;
-using MonoMac.AppKit;
-using MonoMac.ObjCRuntime;
-#endif
-
-namespace Gemstone_Hunter
-{
-#if WINDOWS || XBOX || LINUX
-    static class Program
-    {
-        /// <summary>
-        /// The main entry point for the application.
-        /// </summary>
-        static void Main(string[] args)
-        {
-            using (Game1 game = new Game1())
-            {
-                game.Run();
-            }
-        }
-    }
-#elif MONOMAC
-	static class Program
-	{
-		/// <summary>
-		/// The main entry point for the application.
-		/// </summary>
-		static void Main (string[] args)
-		{
-			NSApplication.Init ();
-			
-			using (var p = new NSAutoreleasePool ()) {
-				NSApplication.SharedApplication.Delegate = new AppDelegate();
-				NSApplication.Main(args);
-			}
-		}
-	}
-	
-	class AppDelegate : NSApplicationDelegate
-	{
-		Game1 game;
-		public override void FinishedLaunching (MonoMac.Foundation.NSObject notification)
-		{
-			game = new Game1();
-			game.Run();
-		}
-		
-		public override bool ApplicationShouldTerminateAfterLastWindowClosed (NSApplication sender)
-		{
-			return true;
-		}
-	}
-#else
-#error Unknown platform
-#endif
-}
-

+ 0 - 11
BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/README.md

@@ -1,11 +0,0 @@
-Gemstone Hunter
-===============
-
-This project contains the Gemstone Hunter game as it is at the end of Chapter 9. 
-
-This was taken from the Book XNA 4.0 Game Development by Example: Beginner's Guide by Kurt Jaegers
-Published by PACKT Publishing which can be found here 
-http://www.packtpub.com/xna-4-0-game-development-by-example-beginners-guide/book
-
-For a complete discussion of the code please buy the book as it is worth the money
-

+ 0 - 50
BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/TileEngine/AssemblyInfo.cs

@@ -1,50 +0,0 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
-
-// Information about this assembly is defined by the following attributes. 
-// Change them to the values specific to your project.
-
-[assembly: AssemblyTitle("TileEngine")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("")]
-[assembly: AssemblyCopyright("// 
-// Copyright (c) 2011 Kenneth J. Pouncey
-//
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-// 
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-// 
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-// 
-")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
-// The form "{Major}.{Minor}.*" will automatically update the build and revision,
-// and "{Major}.{Minor}.{Build}.*" will update just the revision.
-
-[assembly: AssemblyVersion("1.0.*")]
-
-// The following attributes are used to specify the signing key for the assembly, 
-// if desired. See the Mono documentation for more information about signing.
-
-//[assembly: AssemblyDelaySign(false)]
-//[assembly: AssemblyKeyFile("")]
-

+ 0 - 103
BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/TileEngine/Camera.cs

@@ -1,103 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using Microsoft.Xna.Framework;
-
-namespace Tile_Engine
-{
-    public static class Camera
-    {
-        #region Declarations
-        private static Vector2 position = Vector2.Zero;
-        private static Vector2 viewPortSize = Vector2.Zero;
-        private static Rectangle worldRectangle = new Rectangle(0, 0, 0, 0);
-        #endregion
-
-        #region Properties
-        public static Vector2 Position
-        {
-            get { return position; }
-            set
-            {
-                position = new Vector2(
-                    MathHelper.Clamp(value.X,
-                        worldRectangle.X, worldRectangle.Width -
-                        ViewPortWidth),
-                    MathHelper.Clamp(value.Y,
-                        worldRectangle.Y, worldRectangle.Height -
-                        ViewPortHeight));
-            }
-        }
-
-        public static Rectangle WorldRectangle
-        {
-            get { return worldRectangle; }
-            set { worldRectangle = value; }
-        }
-
-        public static int ViewPortWidth
-        {
-            get { return (int)viewPortSize.X; }
-            set { viewPortSize.X = value; }
-        }
-
-        public static int ViewPortHeight
-        {
-            get { return (int)viewPortSize.Y; }
-            set { viewPortSize.Y = value; }
-        }
-
-        public static Rectangle ViewPort
-        {
-            get
-            {
-                return new Rectangle(
-                    (int)Position.X, (int)Position.Y,
-                    ViewPortWidth, ViewPortHeight);
-            }
-        }
-        #endregion
-
-        #region Public Methods
-        public static void Move(Vector2 offset)
-        {
-            Position += offset;
-        }
-
-        public static bool ObjectIsVisible(Rectangle bounds)
-        {
-            return (ViewPort.Intersects(bounds));
-        }
-
-        public static Vector2 WorldToScreen(Vector2 worldLocation)
-        {
-            return worldLocation - position;
-        }
-
-        public static Rectangle WorldToScreen(Rectangle worldRectangle)
-        {
-            return new Rectangle(
-                worldRectangle.Left - (int)position.X,
-                worldRectangle.Top - (int)position.Y,
-                worldRectangle.Width,
-                worldRectangle.Height);
-        }
-
-        public static Vector2 ScreenToWorld(Vector2 screenLocation)
-        {
-            return screenLocation + position;
-        }
-
-        public static Rectangle ScreenToWorld(Rectangle screenRectangle)
-        {
-            return new Rectangle(
-                screenRectangle.Left + (int)position.X,
-                screenRectangle.Top + (int)position.Y,
-                screenRectangle.Width,
-                screenRectangle.Height);
-        }
-        #endregion
-
-    }
-}

+ 0 - 43
BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/TileEngine/MapSquare.cs

@@ -1,43 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using Microsoft.Xna.Framework;
-using Microsoft.Xna.Framework.Graphics;
-
-namespace Tile_Engine
-{
-    [Serializable]
-    public class MapSquare
-    {
-        #region Declarations
-        public int[] LayerTiles = new int[3];
-        public string CodeValue = "";
-        public bool Passable = true;
-        #endregion
-
-        #region Constructor
-        public MapSquare(
-            int background,
-            int interactive,
-            int foreground,
-            string code,
-            bool passable)
-        {
-            LayerTiles[0] = background;
-            LayerTiles[1] = interactive;
-            LayerTiles[2] = foreground;
-            CodeValue = code;
-            Passable = passable;
-        }
-        #endregion
-
-        #region Public Methods
-        public void TogglePassable()
-        {
-            Passable = !Passable;
-        }
-        #endregion
-
-    }
-}

+ 0 - 12
BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/TileEngine/MyClass.cs

@@ -1,12 +0,0 @@
-using System;
-
-namespace TileEngine
-{
-	public class MyClass
-	{
-		public MyClass ()
-		{
-		}
-	}
-}
-

+ 0 - 51
BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/TileEngine/Tile Engine.Linux.csproj

@@ -1,51 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <PropertyGroup>
-    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
-    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
-    <ProductVersion>10.0.0</ProductVersion>
-    <SchemaVersion>2.0</SchemaVersion>
-    <ProjectGuid>{521972FD-1A9B-4CFD-A435-EB2224985131}</ProjectGuid>
-    <OutputType>Library</OutputType>
-    <RootNamespace>Tile_Engine</RootNamespace>
-    <AssemblyName>Tile Engine</AssemblyName>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
-    <DebugSymbols>True</DebugSymbols>
-    <DebugType>full</DebugType>
-    <Optimize>False</Optimize>
-    <OutputPath>bin\Debug</OutputPath>
-    <DefineConstants>DEBUG</DefineConstants>
-    <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
-    <ConsolePause>False</ConsolePause>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
-    <DebugType>none</DebugType>
-    <Optimize>False</Optimize>
-    <OutputPath>bin\Release</OutputPath>
-    <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
-    <ConsolePause>False</ConsolePause>
-  </PropertyGroup>
-  <ItemGroup>
-    <Reference Include="System" />
-    <Reference Include="System.Xml" />
-    <Reference Include="System.Xml.Linq" />
-  </ItemGroup>
-  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
-  <ItemGroup>
-    <Compile Include="Camera.cs">
-      <Link>Camera.cs</Link>
-    </Compile>
-    <Compile Include="MapSquare.cs">
-      <Link>MapSquare.cs</Link>
-    </Compile>
-    <Compile Include="MyClass.cs">
-      <Link>MyClass.cs</Link>
-    </Compile>
-    <Compile Include="TileMap.cs">
-      <Link>TileMap.cs</Link>
-    </Compile>
-  </ItemGroup>
-</Project>

+ 0 - 55
BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/TileEngine/Tile Engine.MacOS.csproj

@@ -1,55 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <PropertyGroup>
-    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
-    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
-    <ProductVersion>10.0.0</ProductVersion>
-    <SchemaVersion>2.0</SchemaVersion>
-    <ProjectGuid>{521972FD-1A9B-4CFD-A435-EB2224985131}</ProjectGuid>
-    <OutputType>Library</OutputType>
-    <RootNamespace>Tile_Engine</RootNamespace>
-    <AssemblyName>Tile Engine</AssemblyName>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
-    <DebugSymbols>True</DebugSymbols>
-    <DebugType>full</DebugType>
-    <Optimize>False</Optimize>
-    <OutputPath>bin\Debug</OutputPath>
-    <DefineConstants>DEBUG</DefineConstants>
-    <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
-    <ConsolePause>False</ConsolePause>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
-    <DebugType>none</DebugType>
-    <Optimize>False</Optimize>
-    <OutputPath>bin\Release</OutputPath>
-    <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
-    <ConsolePause>False</ConsolePause>
-  </PropertyGroup>
-  <ItemGroup>
-    <Reference Include="System" />
-    <Reference Include="System.Xml" />
-    <Reference Include="System.Xml.Linq" />
-  </ItemGroup>
-  <ItemGroup>
-    <Compile Include="Camera.cs" />
-    <Compile Include="MapSquare.cs" />
-    <Compile Include="TileMap.cs" />
-  </ItemGroup>
-  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
-  <ItemGroup>
-    <None Include="AssemblyInfo.cs" />
-  </ItemGroup>
-  <ItemGroup>
-    <ProjectReference Include="..\..\..\..\..\MonoGame.Framework\MonoGame.Framework.MacOS.csproj">
-      <Project>{36C538E6-C32A-4A8D-A39C-566173D7118E}</Project>
-      <Name>MonoGame.Framework.MacOS</Name>
-    </ProjectReference>
-    <ProjectReference Include="..\..\..\..\..\ThirdParty\Lidgren.Network\Lidgren.Network.MacOS.csproj">
-      <Project>{AE483C29-042E-4226-BA52-D247CE7676DA}</Project>
-      <Name>Lidgren.Network.MacOS</Name>
-    </ProjectReference>
-  </ItemGroup>
-</Project>

+ 0 - 335
BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/TileEngine/TileMap.cs

@@ -1,335 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using Microsoft.Xna.Framework;
-using Microsoft.Xna.Framework.Audio;
-using Microsoft.Xna.Framework.Content;
-using Microsoft.Xna.Framework.GamerServices;
-using Microsoft.Xna.Framework.Graphics;
-using Microsoft.Xna.Framework.Input;
-using Microsoft.Xna.Framework.Media;
-using Microsoft.Xna.Framework.Storage;
-using System.IO;
-using System.Xml.Serialization;
-using System.Runtime.Serialization.Formatters.Binary;
-
-namespace Tile_Engine
-{
-    public static class TileMap
-    {
-        #region Declarations
-        public const int TileWidth = 48;
-        public const int TileHeight = 48;
-        public const int MapWidth = 160;
-        public const int MapHeight = 12;
-        public const int MapLayers = 3;
-        private const int skyTile = 2;
-
-        static private MapSquare[,] mapCells =
-            new MapSquare[MapWidth, MapHeight];
-
-        public static bool EditorMode = false;
-
-        public static SpriteFont spriteFont;
-        static private Texture2D tileSheet;
-        #endregion
-
-        #region Initialization
-        static public void Initialize(Texture2D tileTexture)
-        {
-            tileSheet = tileTexture;
-
-            for (int x = 0; x < MapWidth; x++)
-            {
-                for (int y = 0; y < MapHeight; y++)
-                {
-                    for (int z = 0; z < MapLayers; z++)
-                    {
-                        mapCells[x, y] = new MapSquare(skyTile, 0, 0, "", true);
-                    }
-                }
-            }
-        }
-        #endregion
-
-        #region Tile and Tile Sheet Handling
-        public static int TilesPerRow
-        {
-            get { return tileSheet.Width / TileWidth; }
-        }
-
-        public static Rectangle TileSourceRectangle(int tileIndex)
-        {
-            return new Rectangle(
-                (tileIndex % TilesPerRow) * TileWidth,
-                (tileIndex / TilesPerRow) * TileHeight,
-                TileWidth,
-                TileHeight);
-        }
-        #endregion
-
-        #region Information about Map Cells
-        static public int GetCellByPixelX(int pixelX)
-        {
-            return pixelX / TileWidth;
-        }
-
-        static public int GetCellByPixelY(int pixelY)
-        {
-            return pixelY / TileHeight;
-        }
-
-        static public Vector2 GetCellByPixel(Vector2 pixelLocation)
-        {
-            return new Vector2(
-                GetCellByPixelX((int)pixelLocation.X),
-                GetCellByPixelY((int)pixelLocation.Y));
-        }
-
-        static public Vector2 GetCellCenter(int cellX, int cellY)
-        {
-            return new Vector2(
-                (cellX * TileWidth) + (TileWidth / 2),
-                (cellY * TileHeight) + (TileHeight / 2));
-        }
-
-        static public Vector2 GetCellCenter(Vector2 cell)
-        {
-            return GetCellCenter(
-                (int)cell.X,
-                (int)cell.Y);
-        }
-
-        static public Rectangle CellWorldRectangle(int cellX, int cellY)
-        {
-            return new Rectangle(
-                cellX * TileWidth,
-                cellY * TileHeight,
-                TileWidth,
-                TileHeight);
-        }
-
-        static public Rectangle CellWorldRectangle(Vector2 cell)
-        {
-            return CellWorldRectangle(
-                (int)cell.X,
-                (int)cell.Y);
-        }
-
-        static public Rectangle CellScreenRectangle(int cellX, int cellY)
-        {
-            return Camera.WorldToScreen(CellWorldRectangle(cellX, cellY));
-        }
-
-        static public Rectangle CellSreenRectangle(Vector2 cell)
-        {
-            return CellScreenRectangle((int)cell.X, (int)cell.Y);
-        }
-
-        static public bool CellIsPassable(int cellX, int cellY)
-        {
-            MapSquare square = GetMapSquareAtCell(cellX, cellY);
-
-            if (square == null)
-                return false;
-            else
-                return square.Passable;
-        }
-
-        static public bool CellIsPassable(Vector2 cell)
-        {
-            return CellIsPassable((int)cell.X, (int)cell.Y);
-        }
-
-        static public bool CellIsPassableByPixel(Vector2 pixelLocation)
-        {
-            return CellIsPassable(
-                GetCellByPixelX((int)pixelLocation.X),
-                GetCellByPixelY((int)pixelLocation.Y));
-        }
-
-        static public string CellCodeValue(int cellX, int cellY)
-        {
-            MapSquare square = GetMapSquareAtCell(cellX, cellY);
-
-            if (square == null)
-                return "";
-            else
-                return square.CodeValue;
-        }
-
-        static public string CellCodeValue(Vector2 cell)
-        {
-            return CellCodeValue((int)cell.X, (int)cell.Y);
-        }
-        #endregion
-
-        #region Information about MapSquare objects
-        static public MapSquare GetMapSquareAtCell(int tileX, int tileY)
-        {
-            if ((tileX >= 0) && (tileX < MapWidth) &&
-                (tileY >= 0) && (tileY < MapHeight))
-            {
-                return mapCells[tileX, tileY];
-            }
-            else
-            {
-                return null;
-            }
-        }
-
-        static public void SetMapSquareAtCell(
-            int tileX,
-            int tileY,
-            MapSquare tile)
-        {
-            if ((tileX >= 0) && (tileX < MapWidth) &&
-                (tileY >= 0) && (tileY < MapHeight))
-            {
-                mapCells[tileX, tileY] = tile;
-            }
-        }
-
-        static public void SetTileAtCell(
-            int tileX,
-            int tileY,
-            int layer,
-            int tileIndex)
-        {
-            if ((tileX >= 0) && (tileX < MapWidth) &&
-                (tileY >= 0) && (tileY < MapHeight))
-            {
-                mapCells[tileX, tileY].LayerTiles[layer] = tileIndex;
-            }
-        }
-
-        static public MapSquare GetMapSquareAtPixel(int pixelX, int pixelY)
-        {
-            return GetMapSquareAtCell(
-                GetCellByPixelX(pixelX),
-                GetCellByPixelY(pixelY));
-        }
-
-        static public MapSquare GetMapSquareAtPixel(Vector2 pixelLocation)
-        {
-            return GetMapSquareAtPixel(
-                (int)pixelLocation.X,
-                (int)pixelLocation.Y);
-        }
-
-        #endregion
-
-        #region Loading and Saving Maps
-        public static void SaveMap(FileStream fileStream)
-        {
-            BinaryFormatter formatter = new BinaryFormatter();
-            formatter.Serialize(fileStream, mapCells);
-            fileStream.Close();
-        }
-
-        public static void LoadMap(FileStream fileStream)
-        {
-            try
-            {
-                BinaryFormatter formatter = new BinaryFormatter();
-                mapCells = (MapSquare[,])formatter.Deserialize(fileStream);
-                fileStream.Close();
-            }
-            catch
-            {
-                ClearMap();
-            }
-        }
-
-        public static void ClearMap()
-        {
-            for (int x = 0; x < MapWidth; x++)
-                for (int y = 0; y < MapHeight; y++)
-                    for (int z = 0; z < MapLayers; z++)
-                    {
-                        mapCells[x, y] = new MapSquare(2, 0, 0, "", true);
-                    }
-        }
-        #endregion
-
-        #region Drawing
-        static public void Draw(SpriteBatch spriteBatch)
-        {
-            int startX = GetCellByPixelX((int)Camera.Position.X);
-            int endX = GetCellByPixelX((int)Camera.Position.X +
-                  Camera.ViewPortWidth);
-
-            int startY = GetCellByPixelY((int)Camera.Position.Y);
-            int endY = GetCellByPixelY((int)Camera.Position.Y +
-                      Camera.ViewPortHeight);
-
-            for (int x = startX; x <= endX; x++)
-                for (int y = startY; y <= endY; y++)
-                {
-                    for (int z = 0; z < MapLayers; z++)
-                    {
-                        if ((x >= 0) && (y >= 0) &&
-                            (x < MapWidth) && (y < MapHeight))
-                        {
-                            spriteBatch.Draw(
-                              tileSheet,
-                              CellScreenRectangle(x, y),
-                              TileSourceRectangle(mapCells[x, y].LayerTiles[z]),
-                              Color.White,
-                              0.0f,
-                              Vector2.Zero,
-                              SpriteEffects.None,
-                              1f - ((float)z * 0.1f));
-                        }
-                    }
-
-                    if (EditorMode)
-                    {
-                        DrawEditModeItems(spriteBatch, x, y);
-                    }
-
-                }
-        }
-
-        public static void DrawEditModeItems(
-            SpriteBatch spriteBatch,
-            int x,
-            int y)
-        {
-            if ((x < 0) || (x >= MapWidth) ||
-                (y < 0) || (y >= MapHeight))
-                return;
-
-            if (!CellIsPassable(x, y))
-            {
-                spriteBatch.Draw(
-                                tileSheet,
-                                CellScreenRectangle(x, y),
-                                TileSourceRectangle(1),
-                                new Color(255, 0, 0, 80),
-                                0.0f,
-                                Vector2.Zero,
-                                SpriteEffects.None,
-                                0.0f);
-            }
-
-            if (mapCells[x, y].CodeValue != "")
-            {
-                Rectangle screenRect = CellScreenRectangle(x, y);
-
-                spriteBatch.DrawString(
-                    spriteFont,
-                    mapCells[x, y].CodeValue,
-                    new Vector2(screenRect.X, screenRect.Y),
-                    Color.White,
-                    0.0f,
-                    Vector2.Zero,
-                    1.0f,
-                    SpriteEffects.None,
-                    0.0f);
-            }
-        }
-        #endregion
-
-    }
-}

+ 0 - 89
BookSourceCode/XNAGameDevelopmentbyExampleCode/RobotRampage/Camera.cs

@@ -1,89 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using Microsoft.Xna.Framework;
-
-namespace Robot_Rampage
-{
-    public static class Camera
-    {
-        #region Declarations
-        private static Vector2 position = Vector2.Zero;
-        private static Vector2 viewPortSize = Vector2.Zero;
-        private static Rectangle worldRectangle = new Rectangle(0, 0, 0, 0);
-        #endregion
-
-        #region Properties
-        public static Vector2 Position
-        {
-            get { return position; }
-            set
-            {
-                position = new Vector2(
-                    MathHelper.Clamp(value.X,
-                        worldRectangle.X,
-                        worldRectangle.Width - ViewPortWidth),
-                    MathHelper.Clamp(value.Y,
-                        worldRectangle.Y,
-                        worldRectangle.Height - ViewPortHeight));
-            }
-        }
-
-        public static Rectangle WorldRectangle
-        {
-            get { return worldRectangle; }
-            set { worldRectangle = value; }
-        }
-
-        public static int ViewPortWidth
-        {
-            get { return (int)viewPortSize.X; }
-            set { viewPortSize.X = value; }
-        }
-
-        public static int ViewPortHeight
-        {
-            get { return (int)viewPortSize.Y; }
-            set { viewPortSize.Y = value; }
-        }
-
-        public static Rectangle ViewPort
-        {
-            get
-            {
-                return new Rectangle(
-                    (int)Position.X, (int)Position.Y,
-                    ViewPortWidth, ViewPortHeight);
-            }
-        }
-        #endregion
-
-        #region Public Methods
-        public static void Move(Vector2 offset)
-        {
-            Position += offset;
-        }
-
-        public static bool ObjectIsVisible(Rectangle bounds)
-        {
-            return (ViewPort.Intersects(bounds));
-        }
-
-        public static Vector2 Transform(Vector2 point)
-        {
-            return point - position;
-        }
-
-        public static Rectangle Transform(Rectangle rectangle)
-        {
-            return new Rectangle(
-                rectangle.Left - (int)position.X,
-                rectangle.Top - (int)position.Y,
-                rectangle.Width,
-                rectangle.Height);
-        }
-        #endregion
-
-    }
-}

+ 0 - 92
BookSourceCode/XNAGameDevelopmentbyExampleCode/RobotRampage/ComputerTerminal.cs

@@ -1,92 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using Microsoft.Xna.Framework;
-using Microsoft.Xna.Framework.Graphics;
-
-namespace Robot_Rampage
-{
-    class ComputerTerminal
-    {
-        #region Declarations
-        private Sprite activeSprite;
-        private Sprite inactiveSprite;
-        public Vector2 MapLocation;
-        public bool Active = true;
-        public float LastSpawnCounter = 0;
-        public float minSpawnTime = 6.0f;
-        #endregion
-
-        #region Constructor
-        public ComputerTerminal(
-            Sprite activeSprite,
-            Sprite inactiveSprite,
-            Vector2 mapLocation)
-        {
-            MapLocation = mapLocation;
-            this.activeSprite = activeSprite;
-            this.inactiveSprite = inactiveSprite;
-        }
-        #endregion
-
-        #region Public Methods
-        public bool IsCircleColliding(Vector2 otherCenter, float radius)
-        {
-            if (!Active)
-            {
-                return false;
-            }
-
-            return activeSprite.IsCircleColliding(otherCenter, radius);
-        }
-
-        public void Deactivate()
-        {
-            Active = false;
-        }
-
-        public void Update(GameTime gameTime)
-        {
-            if (Active)
-            {
-                float elapsed = (float)gameTime.ElapsedGameTime.TotalSeconds;
-
-                LastSpawnCounter += elapsed;
-                if (LastSpawnCounter > minSpawnTime)
-                {
-                    if (Vector2.Distance(activeSprite.WorldCenter,
-                        Player.BaseSprite.WorldCenter) > 128)
-                    {
-                        if (EnemyManager.Enemies.Count <
-                            EnemyManager.MaxActiveEnemies)
-                        {
-                            EnemyManager.AddEnemy(MapLocation);
-                            LastSpawnCounter = 0;
-                        }
-                    }
-                }
-
-                activeSprite.Update(gameTime);
-            }
-            else
-            {
-                inactiveSprite.Update(gameTime);
-            }
-        }
-
-        public void Draw(SpriteBatch spriteBatch)
-        {
-            if (Active)
-            {
-                activeSprite.Draw(spriteBatch);
-            }
-            else
-            {
-                inactiveSprite.Draw(spriteBatch);
-            }
-        }
-        #endregion
-
-    }
-}

BIN
BookSourceCode/XNAGameDevelopmentbyExampleCode/RobotRampage/Content/Fonts/Pericles14.xnb


BIN
BookSourceCode/XNAGameDevelopmentbyExampleCode/RobotRampage/Content/Textures/SpriteSheet.xnb


BIN
BookSourceCode/XNAGameDevelopmentbyExampleCode/RobotRampage/Content/Textures/TitleScreen.xnb


Some files were not shown because too many files changed in this diff