From: brady Date: Sat, 10 Apr 2010 23:59:19 +0000 (+0000) Subject: began on the basic character, player, and monster classes. Also created a second... X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fcarfire;a=commitdiff_plain;h=6c6a37b3b7f5d74475e2211616fe2a2ab7c6e508 began on the basic character, player, and monster classes. Also created a second project in CarFire called CharacterTestBed so I can work on testing characters with movement and stuff. git-svn-id: https://bd85.net/svn/cs3505_group@58 92bb83a3-7c8f-8a45-bc97-515c4e399668 --- diff --git a/CarFire/CarFire/CarFire.sln b/CarFire/CarFire/CarFire.sln index 9a8c63f..6ed4e2b 100644 --- a/CarFire/CarFire/CarFire.sln +++ b/CarFire/CarFire/CarFire.sln @@ -3,7 +3,13 @@ Microsoft Visual Studio Solution File, Format Version 10.00 # Visual Studio 2008 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CarFire", "CarFire\CarFire.csproj", "{FDDA5BCD-3616-400D-A40B-CFD57C54D0F2}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CharacterTestBed", "CharacterTestBed\CharacterTestBed.csproj", "{757B5B2E-27C5-43E3-BF29-5025E9DDDBF1}" +EndProject Global + GlobalSection(SubversionScc) = preSolution + Svn-Managed = True + Manager = AnkhSVN - Subversion Support for Visual Studio + EndGlobalSection GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|x86 = Debug|x86 Release|x86 = Release|x86 @@ -15,6 +21,12 @@ Global {FDDA5BCD-3616-400D-A40B-CFD57C54D0F2}.Release|x86.Build.0 = Release|x86 {C115BBCA-D6FD-42AF-B2A1-3E895808BC14}.Debug|x86.ActiveCfg = Debug|x86 {C115BBCA-D6FD-42AF-B2A1-3E895808BC14}.Release|x86.ActiveCfg = Release|x86 + {757B5B2E-27C5-43E3-BF29-5025E9DDDBF1}.Debug|x86.ActiveCfg = Debug|x86 + {757B5B2E-27C5-43E3-BF29-5025E9DDDBF1}.Debug|x86.Build.0 = Debug|x86 + {757B5B2E-27C5-43E3-BF29-5025E9DDDBF1}.Release|x86.ActiveCfg = Release|x86 + {757B5B2E-27C5-43E3-BF29-5025E9DDDBF1}.Release|x86.Build.0 = Release|x86 + {4F0BE90F-1E46-4959-80A5-E92B578F6A48}.Debug|x86.ActiveCfg = Debug|x86 + {4F0BE90F-1E46-4959-80A5-E92B578F6A48}.Release|x86.ActiveCfg = Release|x86 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/CarFire/CarFire/Character.cs b/CarFire/CarFire/Character.cs new file mode 100644 index 0000000..3b9833e --- /dev/null +++ b/CarFire/CarFire/Character.cs @@ -0,0 +1,15 @@ +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 Microsoft.Xna.Framework.Input; + +public class Character +{ + public Character() + { + } +} diff --git a/CarFire/CarFire/CharacterTestBed/Character.cs b/CarFire/CarFire/CharacterTestBed/Character.cs new file mode 100644 index 0000000..3ebb093 --- /dev/null +++ b/CarFire/CarFire/CharacterTestBed/Character.cs @@ -0,0 +1,138 @@ +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 Microsoft.Xna.Framework.Input; + +namespace CarFire +{ + /// + /// Base class for all Characters, + /// includes: basic position information, + /// character Texture + /// health + /// damage + /// + public class Character + { + //Member Variables + Map theMap; + int movementSpeed; + int gridX; + int gridY; + Texture2D charModel; + int health; + int damage; + int range; + bool isMoving; + int pixelX; + int pixelY; + + /// + /// Call this method to give the game a chance to load its content. + /// + /// The map that this character will interact with + /// The model for this character + /// How fast the character moves + /// The starting health of the character + /// The base damage of the character + /// The range of the character attack + public Character( Map _currentMap, + Texture2D _charModel, + int _baseMovementSpeed, + int _baseHealth, + int _baseDamage, + int _baseRange) + { + theMap = _currentMap; + movementSpeed = _baseMovementSpeed; + gridX = 100; //should be included in the map as a designated spawn point to begin map + gridY = 100; // + charModel = _charModel; + health = _baseHealth; + range = _baseRange; + isMoving = false; + pixelX = gridX * 1; // 1 needs to be changed to the size of the map grid, also someway need to be determined to change to screen cordinates from would the world cordinates + pixelY = gridY * 1; // + } + + public void Draw(SpriteBatch spriteBatch) + { + spriteBatch.Draw(charModel, new Vector2(pixelX, pixelY), null, Color.White, 0, new Vector2(0f,0f), 1f, SpriteEffects.None, 0); + } + + /// + /// Adjust Health of player + /// + public int Health + { + get { return health; } + set { health = value; } + } + + public bool IsMoving + { + get { return isMoving; } + } + } + + /// + /// A manager class to handle network interactions between peers and + /// lobby/game switching. + /// + public class Player : Character + { + //Member Variables + + public Player( Map _currentMap, + Texture2D _charModel, + int _baseMovementSpeed, + int _baseHealth, + int _baseDamage, + int _baseRange) + : base(_currentMap,_charModel,_baseMovementSpeed, _baseHealth, _baseDamage, _baseRange) + { + } + + public void Update() + { + + } + } + + /// + /// A manager class to handle network interactions between peers and + /// lobby/game switching. + /// + public class Monster : Character + { + //Member Variables + public Monster( Map _currentMap, + Texture2D _charModel, + int _baseMovementSpeed, + int _baseHealth, + int _baseDamage, + int _baseRange) + : base(_currentMap,_charModel,_baseMovementSpeed, _baseHealth, _baseDamage, _baseRange) + { + + } + + public void Update() + { + + } + } + + //this is for testing purposes only! + public class Map + { + public Map() + { + + } + } +} \ No newline at end of file diff --git a/CarFire/CarFire/CharacterTestBed/CharacterTestBed.csproj b/CarFire/CarFire/CharacterTestBed/CharacterTestBed.csproj new file mode 100644 index 0000000..f8dd900 --- /dev/null +++ b/CarFire/CarFire/CharacterTestBed/CharacterTestBed.csproj @@ -0,0 +1,137 @@ + + + {757B5B2E-27C5-43E3-BF29-5025E9DDDBF1} + {6D335F3A-9D43-41b4-9D22-F6F17C4BE596};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + Debug + x86 + WinExe + Properties + CharacterTestBed + CharacterTestBed + v3.5 + v3.0 + Windows + b52464cd-8b86-4443-b045-7663f76abf6a + Game.ico + GameThumbnail.png + publish\ + true + Disk + false + Foreground + 7 + Days + false + false + true + 0 + 1.0.0.%2a + false + false + true + + + true + full + false + bin\x86\Debug + DEBUG;TRACE;WINDOWS + prompt + 4 + true + false + x86 + false + + + pdbonly + true + bin\x86\Release + TRACE;WINDOWS + prompt + 4 + true + false + x86 + true + + + + False + True + + + False + True + + + False + + + False + + + False + + + 3.5 + False + + + 3.5 + False + + + + + + + + + + + + + + + 4f0be90f-1e46-4959-80a5-e92b578f6a48 + False + + + + + False + .NET Framework 2.0 %28x86%29 + false + + + False + .NET Framework 3.0 %28x86%29 + false + + + False + .NET Framework 3.5 + true + + + False + Windows Installer 3.1 + true + + + False + Microsoft XNA Framework Redistributable 3.0 + true + + + + + + \ No newline at end of file diff --git a/CarFire/CarFire/CharacterTestBed/Content/Content.contentproj b/CarFire/CarFire/CharacterTestBed/Content/Content.contentproj new file mode 100644 index 0000000..8af346f --- /dev/null +++ b/CarFire/CarFire/CharacterTestBed/Content/Content.contentproj @@ -0,0 +1,52 @@ + + + 4f0be90f-1e46-4959-80a5-e92b578f6a48 + {96E2B04D-8817-42c6-938A-82C39BA4D311};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + Debug + x86 + Library + Properties + v3.5 + v3.0 + x86 + bin\$(Platform)\$(Configuration) + + + Windows + + + Windows + + + + False + + + False + + + False + + + False + + + False + + + + + pinball + TextureImporter + TextureProcessor + + + + + \ No newline at end of file diff --git a/CarFire/CarFire/CharacterTestBed/Content/pinball.png b/CarFire/CarFire/CharacterTestBed/Content/pinball.png new file mode 100644 index 0000000..497253d Binary files /dev/null and b/CarFire/CarFire/CharacterTestBed/Content/pinball.png differ diff --git a/CarFire/CarFire/CharacterTestBed/Game.ico b/CarFire/CarFire/CharacterTestBed/Game.ico new file mode 100644 index 0000000..8cff41e Binary files /dev/null and b/CarFire/CarFire/CharacterTestBed/Game.ico differ diff --git a/CarFire/CarFire/CharacterTestBed/Game1.cs b/CarFire/CarFire/CharacterTestBed/Game1.cs new file mode 100644 index 0000000..3983684 --- /dev/null +++ b/CarFire/CarFire/CharacterTestBed/Game1.cs @@ -0,0 +1,98 @@ +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.Net; +using Microsoft.Xna.Framework.Storage; +using CarFire; + +namespace CharacterTestBed +{ + /// + /// This is the main type for your game + /// + public class Game1 : Microsoft.Xna.Framework.Game + { + GraphicsDeviceManager graphics; + SpriteBatch spriteBatch; + Player p; + public Game1() + { + graphics = new GraphicsDeviceManager(this); + Content.RootDirectory = "Content"; + } + + /// + /// 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. + /// + protected override void Initialize() + { + // TODO: Add your initialization logic here + + base.Initialize(); + } + + /// + /// LoadContent will be called once per game and is the place to load + /// all of your content. + /// + protected override void LoadContent() + { + // Create a new SpriteBatch, which can be used to draw textures. + spriteBatch = new SpriteBatch(GraphicsDevice); + + p = new Player(new Map(), Content.Load("pinball"), 4, 100, 20, 10); + // TODO: use this.Content to load your game content here + } + + /// + /// UnloadContent will be called once per game and is the place to unload + /// all content. + /// + protected override void UnloadContent() + { + // TODO: Unload any non ContentManager content here + } + + /// + /// Allows the game to run logic such as updating the world, + /// checking for collisions, gathering input, and playing audio. + /// + /// Provides a snapshot of timing values. + 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 + + base.Update(gameTime); + } + + /// + /// This is called when the game should draw itself. + /// + /// Provides a snapshot of timing values. + protected override void Draw(GameTime gameTime) + { + GraphicsDevice.Clear(Color.CornflowerBlue); + spriteBatch.Begin(SpriteBlendMode.AlphaBlend); + + p.Draw(spriteBatch); + + // TODO: Add your drawing code here + spriteBatch.End(); + base.Draw(gameTime); + } + } +} diff --git a/CarFire/CarFire/CharacterTestBed/GameThumbnail.png b/CarFire/CarFire/CharacterTestBed/GameThumbnail.png new file mode 100644 index 0000000..462311a Binary files /dev/null and b/CarFire/CarFire/CharacterTestBed/GameThumbnail.png differ diff --git a/CarFire/CarFire/CharacterTestBed/Program.cs b/CarFire/CarFire/CharacterTestBed/Program.cs new file mode 100644 index 0000000..460aae0 --- /dev/null +++ b/CarFire/CarFire/CharacterTestBed/Program.cs @@ -0,0 +1,19 @@ +using System; + +namespace CharacterTestBed +{ + static class Program + { + /// + /// The main entry point for the application. + /// + static void Main(string[] args) + { + using (Game1 game = new Game1()) + { + game.Run(); + } + } + } +} + diff --git a/CarFire/CarFire/CharacterTestBed/Properties/AssemblyInfo.cs b/CarFire/CarFire/CharacterTestBed/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..af2e9cf --- /dev/null +++ b/CarFire/CarFire/CharacterTestBed/Properties/AssemblyInfo.cs @@ -0,0 +1,33 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("CharacterTestBed")] +[assembly: AssemblyProduct("CharacterTestBed")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyCompany("Microsoft")] + +[assembly: AssemblyCopyright("Copyright © Microsoft 2010")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("fe5d617d-39d4-4c3a-bdb6-66ea297be779")] + + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +[assembly: AssemblyVersion("1.0.0.0")]