Jump to content
  • 0

Animation Frames


corrupted

Question

first sorry for the bad english. I'm using LPC Graphics, I added the 13 side frames and it works perfectly, even the paperdoll works. the problem is that the attack, shoot, cast animations only move 4 frames. the animation when walking works perfectly and the idle too.

Sprite Draw:

  Reveal hidden contents

 

Other modifications:

  Reveal hidden contents


b207b5c8fe30e0d267cd79a71bc207c7.gif

Link to comment
Share on other sites

10 answers to this question

Recommended Posts

  • 0

In the UpdateSpriteAnimation method, you have to check in the attack and cast code block where there is a value assignation to "SpriteFrame" and replace the "4f" by the number of frames of the animation.

SpriteFrame = (int)Math.Floor((timeIn / (CalculateAttackTime() / 4f)));
SpriteFrame = (int)Math.Floor((timeIn / (duration / 4f)));

I haven't tested, but I think it should work.

Link to comment
Share on other sites

  • 0
  On 8/7/2020 at 3:23 PM, Shenmue said:

In the UpdateSpriteAnimation method, you have to check in the attack and cast code block where there is a value assignation to "SpriteFrame" and replace the "4f" by the number of frames of the animation.

SpriteFrame = (int)Math.Floor((timeIn / (CalculateAttackTime() / 4f)));
SpriteFrame = (int)Math.Floor((timeIn / (duration / 4f)));

I haven't tested, but I think it should work.

Expand  

 

I edited and it worked, now I have a problem between the shot and "swords", the animation of the shot has 13 frames and the sword animation has 6 frames. The animation of the sword works perfectly, but the shot shows only the 6 frames. this is my code, i don't know what could be going wrong.

Code:

  Reveal hidden contents

 

Link to comment
Share on other sites

  • 0
  On 8/7/2020 at 5:41 PM, corrupted said:

 

I edited and it worked, now I have a problem between the shot and "swords", the animation of the shot has 13 frames and the sword animation has 6 frames. The animation of the sword works perfectly, but the shot shows only the 6 frames. this is my code, i don't know what could be going wrong.

Expand  

 

It's because of this code:

if (SpriteFrame >= 6)
{
   SpriteFrame = 0;
}

You should remplace the 6 by 13.

Link to comment
Share on other sites

  • 0
  On 8/7/2020 at 5:44 PM, Shenmue said:

 

It's because of this code:

if (SpriteFrame >= 6)
{
   SpriteFrame = 0;
}

You should remplace the 6 by 13.

Expand  

in my code there is

If (AnimatedTextures [SpriteAnimations.Shoot]! = null && item.ProjectileId! = Guid.Empty)

which is the code for if the player is using a projectile. right? in this case it makes sense to use

if (SpriteFrame> = 13) { SpriteFrame = 0; } because my shot frame has 13 frames.

Link to comment
Share on other sites

  • 0
  On 8/7/2020 at 5:49 PM, corrupted said:

in my code there is if (AnimatedTextures [SpriteAnimations.Shoot]! = null && item.ProjectileId! = Guid.Empty) which is the code for if the player is using a projectile. right? in this case it makes sense to use if (SpriteFrame> = 13) { SpriteFrame = 0; } because my shot frame has 13 frames.

Expand  

 

Inside the block of "if (AnimatedTextures[SpriteAnimations.Weapon] != null)" you use "if (SpriteFrame >= 6)". But you should use >= 13 instead.

Link to comment
Share on other sites

  • 0
  On 8/7/2020 at 5:52 PM, Shenmue said:

 

Inside the block of "if (AnimatedTextures[SpriteAnimations.Weapon] != null)" you use "if (SpriteFrame >= 6)". But you should use >= 13 instead.

Expand  

 

and how do I make my weapon frame have 6 animations and the shoot have 13 animations? I'm not good with C #

Link to comment
Share on other sites

  • 0
  On 8/7/2020 at 6:05 PM, corrupted said:

 

and how do I make my weapon frame have 6 animations and the shoot have 13 animations? I'm not good with C #

Expand  

 

Oh I see my bad. So you want the weapon animation to have 6 frames and the shot one 13.

Then you have to add this "&& item.ProjectileId == Guid.Empty" to the weapon condition "if (AnimatedTextures[SpriteAnimations.Weapon] != null)"

 

The final result should be the code below.

if (AnimatedTextures[SpriteAnimations.Weapon] != null && item.ProjectileId == Guid.Empty)

 

Link to comment
Share on other sites

  • 0
  On 8/7/2020 at 6:14 PM, Shenmue said:

 

Oh I see my bad. So you want the weapon animation to have 6 frames and the shot one 13.

Then you have to add this "&& item.ProjectileId == Guid.Empty" to the weapon condition "if (AnimatedTextures[SpriteAnimations.Weapon] != null)"

 

The final result should be the code below.

if (AnimatedTextures[SpriteAnimations.Weapon] != null && item.ProjectileId == Guid.Empty)

 

Expand  

after trying a lot I managed the code looks like this:

I simply added
SpriteFrame = (int) Math.Floor ((timeIn / (CalculateAttackTime () / 13f)));
above: SpriteAnimation = SpriteAnimations.Shoot;

  Reveal hidden contents

 

Link to comment
Share on other sites

  • 0
  On 8/7/2020 at 6:58 PM, corrupted said:

after trying a lot I managed the code looks like this:
 

  Reveal hidden contents

 

Expand  

 

Glad to see it now works, but I wonder, have you tried my solution?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Γ—
Γ—
  • Create New...