Last active
August 29, 2015 14:17
-
-
Save hamoungh/ea2e0ae71a3f391a475b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using Microsoft.Xna.Framework; | |
using Microsoft.Xna.Framework.Content; | |
using Microsoft.Xna.Framework.Graphics; | |
using Microsoft.Xna.Framework.Input; | |
using Microsoft.Xna.Framework.Storage; | |
using Microsoft.Xna.Framework.GamerServices; | |
using SpriteClasses; | |
namespace OOHuman | |
{ | |
class Human:SpriteAnimationManager | |
{ | |
public Human(ContentManager Content) | |
: base(Content.Load<Texture2D>("walkCycle1"), | |
new Vector2(100, 450), new Vector2(10, 0), true, 0, 2, SpriteEffects.None) | |
{ | |
Animation animation = new Animation(); | |
//player animations | |
//stop | |
animation.AddCell(Content.Load<Texture2D>("walkCycle1")); //0 | |
AddAnimation("idle", animation); | |
animation = new Animation(); | |
//walk right | |
animation.AddCell(Content.Load<Texture2D>("walkCycle2")); //0 | |
animation.AddCell(Content.Load<Texture2D>("walkCycle3")); //1 | |
animation.AddCell(Content.Load<Texture2D>("walkCycle4")); //2 | |
animation.AddCell(Content.Load<Texture2D>("walkCycle5")); //3 | |
AddAnimation("walk", animation); | |
animation = new Animation(); | |
//kick | |
animation.AddCell(Content.Load<Texture2D>("kick1")); //0 | |
animation.AddCell(Content.Load<Texture2D>("kick2")); //1 | |
animation.AddCell(Content.Load<Texture2D>("kick3")); //2 | |
AddAnimation("kick", animation); | |
//what should he be doing when program starts? | |
Idle(); | |
} | |
public override void Right() | |
{ | |
base.Right(); | |
CurrentAnimation = "walk"; | |
animationDictionary["walk"].LoopAll(0.5f); | |
} | |
public override void Left() { | |
base.Left(); | |
SetMoveLeft(); | |
CurrentAnimation = "walk"; | |
animationDictionary["walk"].LoopAll(0.5f); | |
} | |
public override void Idle() { | |
base.Idle(); | |
CurrentAnimation = "idle"; | |
} | |
public override void Kick() { | |
CurrentAnimation = "kick"; | |
animationDictionary["kick"].PlayAll(1f); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment