From 65c7b1983e25cd16f2e00b83f23542854e8345af Mon Sep 17 00:00:00 2001 From: brady Date: Thu, 15 Apr 2010 02:30:38 +0000 Subject: [PATCH] Moved some basic stuff around to remove the CharacterTestBed, everything should compile now. git-svn-id: https://bd85.net/svn/cs3505_group@78 92bb83a3-7c8f-8a45-bc97-515c4e399668 --- CarFire/CarFire/CarFire.sln | 18 +++---- CarFire/CarFire/CarFire/CarFire.csproj | 2 + .../Character.cs | 54 ++++--------------- .../Projectile.cs | 8 +-- .../CharacterTestBed/CharacterTestBed.csproj | 2 - 5 files changed, 24 insertions(+), 60 deletions(-) rename CarFire/CarFire/{CharacterTestBed => CarFire}/Character.cs (86%) rename CarFire/CarFire/{CharacterTestBed => CarFire}/Projectile.cs (92%) diff --git a/CarFire/CarFire/CarFire.sln b/CarFire/CarFire/CarFire.sln index 2583a8e..6cd944d 100644 --- a/CarFire/CarFire/CarFire.sln +++ b/CarFire/CarFire/CarFire.sln @@ -37,18 +37,6 @@ Global {757B5B2E-27C5-43E3-BF29-5025E9DDDBF1}.Release|x86.Build.0 = Release|x86 {757B5B2E-27C5-43E3-BF29-5025E9DDDBF1}.Release|Xbox 360.ActiveCfg = Release|x86 {757B5B2E-27C5-43E3-BF29-5025E9DDDBF1}.Release|Zune.ActiveCfg = Release|x86 - {C115BBCA-D6FD-42AF-B2A1-3E895808BC14}.Debug|x86.ActiveCfg = Debug|x86 - {C115BBCA-D6FD-42AF-B2A1-3E895808BC14}.Debug|Xbox 360.ActiveCfg = Debug|x86 - {C115BBCA-D6FD-42AF-B2A1-3E895808BC14}.Debug|Zune.ActiveCfg = Debug|x86 - {C115BBCA-D6FD-42AF-B2A1-3E895808BC14}.Release|x86.ActiveCfg = Release|x86 - {C115BBCA-D6FD-42AF-B2A1-3E895808BC14}.Release|Xbox 360.ActiveCfg = Release|x86 - {C115BBCA-D6FD-42AF-B2A1-3E895808BC14}.Release|Zune.ActiveCfg = Release|x86 - {4F0BE90F-1E46-4959-80A5-E92B578F6A48}.Debug|x86.ActiveCfg = Debug|x86 - {4F0BE90F-1E46-4959-80A5-E92B578F6A48}.Debug|Xbox 360.ActiveCfg = Debug|x86 - {4F0BE90F-1E46-4959-80A5-E92B578F6A48}.Debug|Zune.ActiveCfg = Debug|x86 - {4F0BE90F-1E46-4959-80A5-E92B578F6A48}.Release|x86.ActiveCfg = Release|x86 - {4F0BE90F-1E46-4959-80A5-E92B578F6A48}.Release|Xbox 360.ActiveCfg = Release|x86 - {4F0BE90F-1E46-4959-80A5-E92B578F6A48}.Release|Zune.ActiveCfg = Release|x86 {EA5996C5-17A9-4827-AAB8-884B476B62EE}.Debug|x86.ActiveCfg = Debug|x86 {EA5996C5-17A9-4827-AAB8-884B476B62EE}.Debug|x86.Build.0 = Debug|x86 {EA5996C5-17A9-4827-AAB8-884B476B62EE}.Debug|Xbox 360.ActiveCfg = Debug|Xbox 360 @@ -61,6 +49,12 @@ Global {EA5996C5-17A9-4827-AAB8-884B476B62EE}.Release|Xbox 360.Build.0 = Release|Xbox 360 {EA5996C5-17A9-4827-AAB8-884B476B62EE}.Release|Zune.ActiveCfg = Release|Zune {EA5996C5-17A9-4827-AAB8-884B476B62EE}.Release|Zune.Build.0 = Release|Zune + {C115BBCA-D6FD-42AF-B2A1-3E895808BC14}.Debug|x86.ActiveCfg = Debug|x86 + {C115BBCA-D6FD-42AF-B2A1-3E895808BC14}.Debug|Xbox 360.ActiveCfg = Debug|x86 + {C115BBCA-D6FD-42AF-B2A1-3E895808BC14}.Debug|Zune.ActiveCfg = Debug|x86 + {C115BBCA-D6FD-42AF-B2A1-3E895808BC14}.Release|x86.ActiveCfg = Release|x86 + {C115BBCA-D6FD-42AF-B2A1-3E895808BC14}.Release|Xbox 360.ActiveCfg = Release|x86 + {C115BBCA-D6FD-42AF-B2A1-3E895808BC14}.Release|Zune.ActiveCfg = Release|x86 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/CarFire/CarFire/CarFire/CarFire.csproj b/CarFire/CarFire/CarFire/CarFire.csproj index 30d2d0d..dc31e03 100644 --- a/CarFire/CarFire/CarFire/CarFire.csproj +++ b/CarFire/CarFire/CarFire/CarFire.csproj @@ -84,6 +84,7 @@ + @@ -92,6 +93,7 @@ + diff --git a/CarFire/CarFire/CharacterTestBed/Character.cs b/CarFire/CarFire/CarFire/Character.cs similarity index 86% rename from CarFire/CarFire/CharacterTestBed/Character.cs rename to CarFire/CarFire/CarFire/Character.cs index 863797f..e2c8aed 100644 --- a/CarFire/CarFire/CharacterTestBed/Character.cs +++ b/CarFire/CarFire/CarFire/Character.cs @@ -104,7 +104,7 @@ namespace CarFire } - + /* /// /// Updates the players position in the current window, the player is kept centered /// in the window when possible. When the edge of the map is reached by one or more @@ -115,6 +115,7 @@ namespace CarFire /// Used to know how tall the current window is public void updatePlayerScreenPosition(int ScreenWidth, int ScreenHeight) { + // if left edge of map has been reached by screen if (GridX * TheMap.GridToPixelRatio < ScreenWidth / 2) { @@ -147,7 +148,7 @@ namespace CarFire PixelY = ScreenHeight / 2; } } - + */ /// /// Moves the current player being controlled based on a given set of key presses. /// The player can only move one Grid space per movePlayer call. Thus this method @@ -159,46 +160,46 @@ namespace CarFire { // move upleft keysPressed.Contains(Keys.Left); - if (keysPressed.Contains(Keys.Up) && keysPressed.Contains(Keys.Left) && TheMap.isOpenSquare(GridX - 1, GridY - 1)) + if (keysPressed.Contains(Keys.Up) && keysPressed.Contains(Keys.Left) && TheMap.IsCellOpen(GridX - 1, GridY - 1)) { GridX -= 1; GridY -= 1; } // move upright - else if (keysPressed.Contains(Keys.Up) && keysPressed.Contains(Keys.Right) && TheMap.isOpenSquare(GridX + 1, GridY - 1)) + else if (keysPressed.Contains(Keys.Up) && keysPressed.Contains(Keys.Right) && TheMap.IsCellOpen(GridX + 1, GridY - 1)) { GridX += 1; GridY -= 1; } // move downleft - else if (keysPressed.Contains(Keys.Down) && keysPressed.Contains(Keys.Left) && TheMap.isOpenSquare(GridX - 1, GridY + 1)) + else if (keysPressed.Contains(Keys.Down) && keysPressed.Contains(Keys.Left) && TheMap.IsCellOpen(GridX - 1, GridY + 1)) { GridX -= 1; GridY += 1; } // move downright - else if (keysPressed.Contains(Keys.Down) && keysPressed.Contains(Keys.Right) && TheMap.isOpenSquare(GridX + 1, GridY + 1)) + else if (keysPressed.Contains(Keys.Down) && keysPressed.Contains(Keys.Right) && TheMap.IsCellOpen(GridX + 1, GridY + 1)) { GridX += 1; GridY += 1; } // move up - else if (keysPressed.Contains(Keys.Up) && TheMap.isOpenSquare(GridX, GridY - 1)) + else if (keysPressed.Contains(Keys.Up) && TheMap.IsCellOpen(GridX, GridY - 1)) { GridY -= 1; } // move down - else if (keysPressed.Contains(Keys.Down) && TheMap.isOpenSquare(GridX, GridY + 1)) + else if (keysPressed.Contains(Keys.Down) && TheMap.IsCellOpen(GridX, GridY + 1)) { GridY += 1; } // move left - else if (keysPressed.Contains(Keys.Left) && TheMap.isOpenSquare(GridX - 1, GridY)) + else if (keysPressed.Contains(Keys.Left) && TheMap.IsCellOpen(GridX - 1, GridY)) { GridX -= 1; } // move right - else if (keysPressed.Contains(Keys.Right) && TheMap.isOpenSquare(GridX + 1, GridY)) + else if (keysPressed.Contains(Keys.Right) && TheMap.IsCellOpen(GridX + 1, GridY)) { GridX += 1; } @@ -227,37 +228,4 @@ namespace CarFire } } - /* - //this is for testing purposes only! - public class Map - { - int gridToPixelRatio; - - public Map() - { - gridToPixelRatio = 10; - } - - public int MaxGridX - { - get { return 100; } - } - public int MaxGridY - { - get { return 100; } - } - - public int GridToPixelRatio - { - get { return gridToPixelRatio; } - } - - public bool isOpenSquare(int GridX, int GridY) - { - return true; - } - - - } - */ } \ No newline at end of file diff --git a/CarFire/CarFire/CharacterTestBed/Projectile.cs b/CarFire/CarFire/CarFire/Projectile.cs similarity index 92% rename from CarFire/CarFire/CharacterTestBed/Projectile.cs rename to CarFire/CarFire/CarFire/Projectile.cs index dfbc87b..e9fd47b 100644 --- a/CarFire/CarFire/CharacterTestBed/Projectile.cs +++ b/CarFire/CarFire/CarFire/Projectile.cs @@ -55,14 +55,15 @@ namespace CarFire public void Update() { //See if something moved onto this projectile. - if(theMap.isOpenSquare(gridX, gridY)) + if(theMap.IsCellOpen(gridX, gridY)) { - theMap.damageSquare(gridX, gridY, damage); + //theMap.damageSquare(gridX, gridY, damage); } //If the projectile will be moving to a new grid position we need to check to see if it is occupied. + /* if ((int)((pixelX + velocity.X) / theMap.gridToPixelRatio) != gridX || (int)((pixelY + velocity.Y) / Map.gridToPixelRatio) != gridY) { - bool open = theMap.isOpenSquare((pixelX + velocity.X) / theMap.gridToPixelRatio, (pixelY + velocity.Y) / Map.gridToPixelRatio); + bool open = theMap.IsCellOpen((pixelX + velocity.X) / theMap.gridToPixelRatio, (pixelY + velocity.Y) / Map.gridToPixelRatio); //If open just move this projectile there //***Map doesn't need to know that this projectile is there because players/monsters are allowed // to move into the path of projectiles. @@ -80,6 +81,7 @@ namespace CarFire //theMap.damageSquare(gridX, gridY, damage); } } + */ //If it is not moving grid positions just increment pixelX and pixelY else { diff --git a/CarFire/CarFire/CharacterTestBed/CharacterTestBed.csproj b/CarFire/CarFire/CharacterTestBed/CharacterTestBed.csproj index 9e3111c..2541ff6 100644 --- a/CarFire/CarFire/CharacterTestBed/CharacterTestBed.csproj +++ b/CarFire/CarFire/CharacterTestBed/CharacterTestBed.csproj @@ -84,8 +84,6 @@ - - -- 2.45.2