diff --git a/src/Blaze-Brigade/Blaze_Brigade/Blaze_Brigade.csproj b/src/Blaze-Brigade/Blaze_Brigade/Blaze_Brigade.csproj index ed22b834e5dfe1bf1b01f5b9036242f8b9a754df..20bcc31e37780233c86077d400fbd74746a3a23d 100644 --- a/src/Blaze-Brigade/Blaze_Brigade/Blaze_Brigade.csproj +++ b/src/Blaze-Brigade/Blaze_Brigade/Blaze_Brigade.csproj @@ -111,6 +111,7 @@ <Content Include="GameThumbnail.png"> <XnaPlatformSpecific>true</XnaPlatformSpecific> </Content> + <None Include="Resources\warrior.png" /> <None Include="Resources\Warrior_Info.png" /> <None Include="Resources\warrior_stats.png" /> <None Include="Resources\Game_Map.jpg" /> diff --git a/src/Blaze-Brigade/Blaze_Brigade/Blaze_Brigade.csproj.Debug.cachefile b/src/Blaze-Brigade/Blaze_Brigade/Blaze_Brigade.csproj.Debug.cachefile index cc7104514df92f429666cec9e60413fd2213bc64..367f0bbd2fa47a90e6b09330e24bf66289f89dc7 100644 --- a/src/Blaze-Brigade/Blaze_Brigade/Blaze_Brigade.csproj.Debug.cachefile +++ b/src/Blaze-Brigade/Blaze_Brigade/Blaze_Brigade.csproj.Debug.cachefile @@ -8,7 +8,8 @@ Content\items.xnb Content\move.xnb Content\wait.xnb Content\warrior_art.xnb -Content\PixelFont.xnb Content\warrior_stats.xnb Content\Warrior_Info.xnb +Content\PixelFont.xnb Content\PixelFontLarge.xnb +Content\warrior.xnb diff --git a/src/Blaze-Brigade/Blaze_Brigade/Game.cs b/src/Blaze-Brigade/Blaze_Brigade/Game.cs index 44ffb21aab3ad1daed825e1a7fa56acdb47dd123..93bb3b58cf461c2337d5c3b387450a511ccb40fa 100644 --- a/src/Blaze-Brigade/Blaze_Brigade/Game.cs +++ b/src/Blaze-Brigade/Blaze_Brigade/Game.cs @@ -194,9 +194,14 @@ namespace Controller // draws units for player 1 for (int i = 0; i < player1.getNumOfUnits(); i++) { +<<<<<<< HEAD Unit unit = player1.getUnits().ElementAt(i); // gets unit at i spriteBatch.Draw(unit.getSpriteImage(), unit.getPixelCoordinates(), null, Color.White, 0, Vector2.Zero, 1f, SpriteEffects.None, 0.8f); // redraws char sprite +======= + Unit unit = player1.getUnits().ElementAt(i); //gets unit at i + spriteBatch.Draw(unit.getSpriteImage(), unit.getPixelCoordinates(), unit.getCurrentFrame(), Color.White, 0, Vector2.Zero, 1f, SpriteEffects.None, 0.8f); // redraws char sprite +>>>>>>> origin/Animation } #endregion @@ -300,7 +305,7 @@ namespace Controller if (unitType == UnitType.Warrior) { - return new Warrior(Content.Load<Texture2D>("charSprite"), attackButton, moveButton, + return new Warrior(Content.Load<Texture2D>("warrior"), attackButton, moveButton, itemButton, waitButton, Content.Load<Texture2D>("warrior_Info"), unitPosition); } return null; diff --git a/src/Blaze-Brigade/Blaze_Brigade/MainMenu.Designer.cs b/src/Blaze-Brigade/Blaze_Brigade/MainMenu.Designer.cs index c27132a7d090329b3ca51484bf95fc43e18b7900..216c97df6bd6b07a224bdfa0f14d71ca0f7af917 100644 --- a/src/Blaze-Brigade/Blaze_Brigade/MainMenu.Designer.cs +++ b/src/Blaze-Brigade/Blaze_Brigade/MainMenu.Designer.cs @@ -31,7 +31,6 @@ this.Start = new System.Windows.Forms.Button(); this.Instructions = new System.Windows.Forms.Button(); this.Exit = new System.Windows.Forms.Button(); - this.titleLabel = new System.Windows.Forms.Label(); this.SuspendLayout(); // // Start @@ -41,6 +40,7 @@ this.Start.FlatAppearance.BorderSize = 0; this.Start.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.Start.Font = new System.Drawing.Font("Lucida Console", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.Start.ForeColor = System.Drawing.Color.White; this.Start.Location = new System.Drawing.Point(264, 253); this.Start.Name = "Start"; this.Start.Size = new System.Drawing.Size(168, 44); @@ -57,7 +57,7 @@ this.Instructions.FlatAppearance.BorderSize = 0; this.Instructions.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.Instructions.Font = new System.Drawing.Font("Lucida Console", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Instructions.ForeColor = System.Drawing.Color.Transparent; + this.Instructions.ForeColor = System.Drawing.Color.White; this.Instructions.Location = new System.Drawing.Point(264, 304); this.Instructions.Name = "Instructions"; this.Instructions.Size = new System.Drawing.Size(168, 44); @@ -74,7 +74,7 @@ this.Exit.FlatAppearance.BorderSize = 0; this.Exit.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.Exit.Font = new System.Drawing.Font("Lucida Console", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Exit.ForeColor = System.Drawing.SystemColors.ControlText; + this.Exit.ForeColor = System.Drawing.Color.White; this.Exit.Location = new System.Drawing.Point(264, 353); this.Exit.Name = "Exit"; this.Exit.Size = new System.Drawing.Size(168, 44); @@ -84,13 +84,6 @@ this.Exit.MouseLeave += new System.EventHandler(this.Exit_leaveHover); this.Exit.MouseHover += new System.EventHandler(this.Exit_Hover); // - // titleLabel - // - this.titleLabel.Location = new System.Drawing.Point(0, 0); - this.titleLabel.Name = "titleLabel"; - this.titleLabel.Size = new System.Drawing.Size(100, 23); - this.titleLabel.TabIndex = 0; - // // MainMenu // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -99,7 +92,6 @@ this.BackgroundImage = global::Blaze_Brigade.Resource1.MenuImage; this.ClientSize = new System.Drawing.Size(668, 478); this.ControlBox = false; - this.Controls.Add(this.titleLabel); this.Controls.Add(this.Exit); this.Controls.Add(this.Instructions); this.Controls.Add(this.Start); @@ -115,7 +107,6 @@ private System.Windows.Forms.Button Start; private System.Windows.Forms.Button Instructions; private System.Windows.Forms.Button Exit; - private System.Windows.Forms.Label titleLabel; private System.Windows.Forms.Label infoLabel; } } \ No newline at end of file diff --git a/src/Blaze-Brigade/Blaze_Brigade/MouseHandler.cs b/src/Blaze-Brigade/Blaze_Brigade/MouseHandler.cs index 5d1634c5db14ef1225b9497d6b9c763dc0f5d874..aef41815090a91b1670699b968871b64edc78252 100644 --- a/src/Blaze-Brigade/Blaze_Brigade/MouseHandler.cs +++ b/src/Blaze-Brigade/Blaze_Brigade/MouseHandler.cs @@ -152,12 +152,14 @@ namespace Controller { if (unit.getPixelCoordinates().X < nodePixelX) { + unit.animate(2); unit.setPixelCoordinates(new Vector2(unit.getPixelCoordinates().X + 4, unit.getPixelCoordinates().Y)); Game.Instance.Tick(); Thread.Sleep(40); } else { + unit.animate(1); unit.setPixelCoordinates(new Vector2(unit.getPixelCoordinates().X - 4, unit.getPixelCoordinates().Y)); Game.Instance.Tick(); Thread.Sleep(40); @@ -168,12 +170,14 @@ namespace Controller { if (unit.getPixelCoordinates().Y < nodePixelY) { + unit.animate(0); unit.setPixelCoordinates(new Vector2(unit.getPixelCoordinates().X, unit.getPixelCoordinates().Y + 4)); Game.Instance.Tick(); Thread.Sleep(40); } else { + unit.animate(4); unit.setPixelCoordinates(new Vector2(unit.getPixelCoordinates().X, unit.getPixelCoordinates().Y - 4)); Game.Instance.Tick(); Thread.Sleep(40); diff --git a/src/Blaze-Brigade/Blaze_Brigade/Resource1.Designer.cs b/src/Blaze-Brigade/Blaze_Brigade/Resource1.Designer.cs index abf754dfa2a46f985e9db92c6e6029ea19fca50e..2b9e08df7b1b24bed54301ac2a960273911b5cb4 100644 --- a/src/Blaze-Brigade/Blaze_Brigade/Resource1.Designer.cs +++ b/src/Blaze-Brigade/Blaze_Brigade/Resource1.Designer.cs @@ -80,16 +80,6 @@ namespace Blaze_Brigade { } } - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap charSprite { - get { - object obj = ResourceManager.GetObject("charSprite", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - /// <summary> /// Looks up a localized resource of type System.Drawing.Bitmap. /// </summary> @@ -150,6 +140,16 @@ namespace Blaze_Brigade { } } + /// <summary> + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// </summary> + internal static System.Drawing.Bitmap warrior { + get { + object obj = ResourceManager.GetObject("warrior", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// <summary> /// Looks up a localized resource of type System.Drawing.Bitmap. /// </summary> diff --git a/src/Blaze-Brigade/Blaze_Brigade/Resource1.resx b/src/Blaze-Brigade/Blaze_Brigade/Resource1.resx index 7d1a891bf997e5e3310bd394f88a17ce4f085ef6..3d452c0bb1539249ba8b669be0596ba7cdd56322 100644 --- a/src/Blaze-Brigade/Blaze_Brigade/Resource1.resx +++ b/src/Blaze-Brigade/Blaze_Brigade/Resource1.resx @@ -118,9 +118,6 @@ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> </resheader> <assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> - <data name="charSprite" type="System.Resources.ResXFileRef, System.Windows.Forms"> - <value>Resources\charSprite.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> - </data> <data name="MenuImage" type="System.Resources.ResXFileRef, System.Windows.Forms"> <value>Resources\MenuImage.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> </data> @@ -154,4 +151,7 @@ <data name="Warrior_Info" type="System.Resources.ResXFileRef, System.Windows.Forms"> <value>Resources\Warrior_Info.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> </data> + <data name="warrior" type="System.Resources.ResXFileRef, System.Windows.Forms"> + <value>Resources\warrior.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> + </data> </root> \ No newline at end of file diff --git a/src/Blaze-Brigade/Blaze_Brigade/Resources/warrior.png b/src/Blaze-Brigade/Blaze_Brigade/Resources/warrior.png new file mode 100644 index 0000000000000000000000000000000000000000..24b6a045026506d8942ba2407b26b3879fe1a5c9 Binary files /dev/null and b/src/Blaze-Brigade/Blaze_Brigade/Resources/warrior.png differ diff --git a/src/Blaze-Brigade/Blaze_Brigade/Unit.cs b/src/Blaze-Brigade/Blaze_Brigade/Unit.cs index 1921bb2f8356dfa38bf58468721a3482c4fe770a..d7e4b4b6a25c3e354a1d17308ad6b5727e53dbe5 100644 --- a/src/Blaze-Brigade/Blaze_Brigade/Unit.cs +++ b/src/Blaze-Brigade/Blaze_Brigade/Unit.cs @@ -37,6 +37,8 @@ namespace Model void setEquippedWeapon(Weapon w); // sets the unit's currently equipped weapon MenuButton[] getMenuButtons(); // returns the dropdown menu buttons of the unit void setMenuButtonCoordinates(Vector2 pixelCoordinates); // sets the coordinates of menu buttons + Rectangle getCurrentFrame(); // returns the current sprite frame in animation sequence + void animate(int direction); } enum UnitType { Warrior, Archer, Mage }; //defines the possible classes of a unit diff --git a/src/Blaze-Brigade/Blaze_Brigade/Warrior.cs b/src/Blaze-Brigade/Blaze_Brigade/Warrior.cs index f5a42193717bb0dce63e18264b3699d870a44a0e..b3ee4c583228069631b0a68ae84ef35241d740bc 100644 --- a/src/Blaze-Brigade/Blaze_Brigade/Warrior.cs +++ b/src/Blaze-Brigade/Blaze_Brigade/Warrior.cs @@ -6,6 +6,7 @@ using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework; using View; +using System.Diagnostics; namespace Model { @@ -31,6 +32,8 @@ namespace Model private Texture2D charInfo; private Boolean clickedOn = false; private Boolean menuOpen = false; + private int currentFrame; //the current frame the sprite is on + private int direction; //direction the character is currently facing - 0=down, 1=left, 2=right, up=up public Warrior(Texture2D spriteImage, MenuButton attackButton, MenuButton moveButton, MenuButton itemButton, MenuButton waitButton, Texture2D charInfo, Vector2 coordinates) @@ -46,7 +49,7 @@ namespace Model int positionX = (int)Math.Round(coordinates.X / 32); int positionY = (int)Math.Round(coordinates.Y / 32); position = new Tuple<int, int>(positionX, positionY); - + currentFrame = 1; setMenuButtonCoordinates(pixelCoordinates); } @@ -229,9 +232,85 @@ namespace Model } } - public void Update(GameTime gameTime) + public Rectangle getCurrentFrame() //return current frame the sprite is on { + Rectangle screenBounds = new Rectangle(currentFrame * 32, 0, 32, 32); + return screenBounds; + } + // animates the sprite by switching to the correct frame sequences + public void animate(int direction) + { + if (direction == 0) // for going down + { + if (currentFrame > 2) // if unit isnt already going down, set the sprite to default facing downwards + { + currentFrame = 1; + } + else + { + if (currentFrame == 2) // if unit has reached end of going down walk cycle, go back to beginning + { + currentFrame = 0; + } + else + { + currentFrame++; // increment through walk cycle + } + } + }else if(direction == 1) // for going left + { + if ((currentFrame < 3) || (currentFrame > 5)) // if unit isnt already going left, set the sprite to default facing left + { + currentFrame = 4; + } + else + { + if (currentFrame == 5) // if unit has reached end of going down walk cycle, go back to beginning + { + currentFrame = 3; + } + else + { + currentFrame++; //increment walk cycle + } + } + }else if (direction == 2) // for going right + { + if ((currentFrame < 6) || (currentFrame > 8)) // if unit isnt already going right, set the sprite to default facing right + { + currentFrame = 7;//increment walk cycle + } + else + { + if (currentFrame == 8)// if unit has reached end of going down walk cycle, go back to beginning + { + currentFrame = 6; + } + else + { + currentFrame++; + } + } + } + else if (direction == 3) // for going up + { + if (currentFrame < 9) // if unit isnt already going up, set the sprite to default facing upwards + { + currentFrame = 10;//increment walk cycle + } + else + { + if (currentFrame == 11)// if unit has reached end of going down walk cycle, go back to beginning + { + currentFrame = 9;//increment walk cycle + } + else + { + currentFrame++; + } + } + } } } } diff --git a/src/Blaze-Brigade/Blaze_BrigadeContent/Blaze_BrigadeContent.contentproj b/src/Blaze-Brigade/Blaze_BrigadeContent/Blaze_BrigadeContent.contentproj index d6566877d7038941c01fa3f135a01cdbc5e5d86e..28dd9b0d1da180042323c602cb1b613855c2c76b 100644 --- a/src/Blaze-Brigade/Blaze_BrigadeContent/Blaze_BrigadeContent.contentproj +++ b/src/Blaze-Brigade/Blaze_BrigadeContent/Blaze_BrigadeContent.contentproj @@ -29,13 +29,6 @@ <Reference Include="Microsoft.Xna.Framework.Content.Pipeline.AudioImporters, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=MSIL" /> <Reference Include="Microsoft.Xna.Framework.Content.Pipeline.VideoImporters, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=MSIL" /> </ItemGroup> - <ItemGroup> - <Compile Include="charSprite.png"> - <Name>charSprite</Name> - <Importer>TextureImporter</Importer> - <Processor>TextureProcessor</Processor> - </Compile> - </ItemGroup> <ItemGroup> <Compile Include="Game_Map.jpg"> <Name>Game_Map</Name> @@ -128,6 +121,13 @@ <Processor>FontDescriptionProcessor</Processor> </Compile> </ItemGroup> + <ItemGroup> + <Compile Include="warrior.png"> + <Name>warrior</Name> + <Importer>TextureImporter</Importer> + <Processor>TextureProcessor</Processor> + </Compile> + </ItemGroup> <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> <!-- To modify your build process, add your task inside one of the targets below and uncomment it. Other similar extension points exist, see Microsoft.Common.targets. diff --git a/src/Blaze-Brigade/Blaze_BrigadeContent/charSprite.png b/src/Blaze-Brigade/Blaze_BrigadeContent/charSprite.png deleted file mode 100644 index 534320499cb3c4c764ca71815d316d9a91a94b45..0000000000000000000000000000000000000000 Binary files a/src/Blaze-Brigade/Blaze_BrigadeContent/charSprite.png and /dev/null differ diff --git a/src/Blaze-Brigade/Blaze_BrigadeContent/warrior.png b/src/Blaze-Brigade/Blaze_BrigadeContent/warrior.png new file mode 100644 index 0000000000000000000000000000000000000000..24b6a045026506d8942ba2407b26b3879fe1a5c9 Binary files /dev/null and b/src/Blaze-Brigade/Blaze_BrigadeContent/warrior.png differ