Animation volLeftAnimation, volRightAnimation, CurrentAnimation; //animation object used for animating #endregion Fields #region Constructors //public int g1 = 1,d1=0; /// <summary> /// Créé un singe /// </summary> /// <param name="texture">texture du singe</param> /// <param name="origin">placement du singe</param> public Monkey(Texture2D texture, int frameCount, Vector2 origin) { this.texture = texture; //create a new animation object volLeftAnimation = new Animation(672, 131, frameCount, 0, 400); volRightAnimation = new Animation(679, 131, frameCount, 10, 562); //tweak the FramesPerSecond and movementSpeed values until you're satisfied with how things move volLeftAnimation.FramesPerSecond = 4 * 1; volRightAnimation.FramesPerSecond = 4 * 1; CurrentAnimation = volLeftAnimation; movementSpeed = 156; //reset position position = Vector2.Zero; this.origin = origin; }
/// <summary> /// Créé un clown /// </summary> /// <param name="texture">texture du clown</param> /// <param name="origin">placement du clown</param> public Clown(Texture2D texture, int frameCount, Vector2 origin) { this.texture = texture; //create a new animation object JumpAnimation = new Animation(1068, 167, frameCount, 25, 426); RetombeAnimation = new Animation(1068, 167, frameCount, 25, 654); Sourceface = new Rectangle(25, 426, 120, 167); //tweak the FramesPerSecond and movementSpeed values until you're satisfied with how things move JumpAnimation.FramesPerSecond = 5 * 3; RetombeAnimation.FramesPerSecond = 5 * 3; CurrentAnimation = JumpAnimation; movementSpeed = 200; //reset position position = Vector2.Zero; this.origin = origin; }
/// <summary> /// Créé le héro /// </summary> /// <param name="texture">texture du héro</param> /// <param name="origin">placement du héro</param> public Hero(Texture2D texture, int frameCount, Vector2 origin) { this.texture = texture; //create a new animation object RightwalkingAnimation = new Animation(texture.Width, 101, frameCount, 0, 934); LeftwalkingAnimation = new Animation(texture.Width, 101, frameCount, 0, 679); UpwalkingAnimation = new Animation(texture.Width, 105, frameCount, 0, 799); DownwalkingAnimation = new Animation(texture.Width, 101, frameCount, 0, 554); DosAttack = new Animation(120, 110, 1, 432, 327 ); DosPositionAttack = new Rectangle(432, 327, 120, 110); FaceAttack = new Animation(120, 110,1,544, 325 ); FacePositionAttack = new Rectangle(544, 325, 120, 110); ProfilLeftAttack = new Animation( 120, 110,1,669, 327); ProfilLeftPositionAttack = new Rectangle(669, 327, 120, 110); ProfilRightAttack= new Animation( 120,110,1, 781, 331); ProfilRightPositionAttack = new Rectangle(781, 331, 120, 110); Sourceface = new Rectangle(0, 39, 120, 101); SourceDos = new Rectangle(0, 304, 120, 101); SourceProfil = new Rectangle(0, 164, 120, 105); Currentposition = Sourceface; //position initiale hero b = 1; // vers le bas h = 0; // vers le haut d = 0; // vers la droite g = 0; // vers la gauche //tweak the FramesPerSecond and movementSpeed values until you're satisfied with how things move RightwalkingAnimation.FramesPerSecond = 10 * 2; LeftwalkingAnimation.FramesPerSecond = 10 * 2; UpwalkingAnimation.FramesPerSecond = 10 * 2; DownwalkingAnimation.FramesPerSecond = 10 * 2; DosAttack.FramesPerSecond = 1; FaceAttack.FramesPerSecond = 1; ProfilLeftAttack.FramesPerSecond = 1; ProfilRightAttack.FramesPerSecond = 1; CurrentAnimation = DownwalkingAnimation; movementSpeed = 256; //reset position position = Vector2.Zero; this.origin = origin; }