Skip to content

Instantly share code, notes, and snippets.

@hamoungh
Last active August 29, 2015 14:17
Show Gist options
  • Save hamoungh/ea2e0ae71a3f391a475b to your computer and use it in GitHub Desktop.
Save hamoungh/ea2e0ae71a3f391a475b to your computer and use it in GitHub Desktop.
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