animation is not working properly :?

I am creating a game, in which my character has some attack animations and have to change to these animation when particular button is pressed. but it seems that for some reason the animation is being played till the first frame. and that’s it how can i fix this issue and also, I need to know how to link two things, in this case variable and tiled sprite, so that if variable is 100 then the width of the sprite is 100 to and if variable is 0 the other is zero too, in oder to represent the power of the character by “graphics bar” what so ever!!!

Could you please put out screenshots of the events you’re using or even better, make short “demo” of the problem and put out project files (.gdg and all graphics)? We’re really helpful bunch around here, but AFAIK none of us is a psychic and we can’t do with so little info!

this is just a demo test. I have not started building game yet. I am still doing animation…
this is what i have may b i am not good at game developing but i am about to built a game

here is another if in case … 1600%2C900

The problem is that the first event (Dragonman is on floor) is True even if you are pressing “j” (attacking), so GD reads the first event ==> Change the animation = 0 or 1, read the fifth event ==> Change the animation = 2, in the next frame change the animation to 0/1 and then to 2, again and again. When an animation is switched (from 0 or 1 to 2 here) it’s reset, so it keeps in the first frame :slight_smile:

To avoid this, add some system to track the current state, for example a variable “Attacking”:

[code]Conditions: Dragonman is on floor and Variable(Attacking) = 0:
Actions: Set the animation = 0 or 1 as you are doing

Conditions: j key is pressed
Actions: Set the animation = 2 , Do = 1 the variable Attacking

Conditions: Animation of Dragonman has finished , Animation of Dragonman = 2
Actions: Do = 0 the variable Attacking[/code]

This way, the events to change the animation to 0/1 will run only when you are not attacking (variable Attacking = 0), and the variable Attacking will be 0 when you finish the attack (Animation 2 has finished). With this kind of track systems, you can easily control more events in the future, for example do a special move if “k” is pressed and Attacking = 0 :smiley:

and about the power bar how to create that. i mean some graphics representing the life of the character instead of text and numbers, like in tekken and king of fighters. also refer me some tutorials so i can understand events i have read most of the tutorial on this site.

I had a power bar working like that. I made a sprite for the health bar. Then I stretched it the length of variable health. Each time someone got hit I decreased the variable.

thank you guys very much!!! :laughing: :smiley: <3