Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Attack Animation [SOLVED]


Lavos
 Share

Recommended Posts

Alright for the past 5 days I've been trying to figure this out and ended up with my face on the desk.
I've tried countless methods and still couldn't get it right so I need help.

What I'm trying to do is to get a number value to count so that the anim can move to the next number, I'm not sure if its clever but, Here is what it looks like now.

```
' Check for attacking animation
    If Player(Index).AttackTimer + (attackspeed / 2) > GetTickCount Then
        If Player(Index).Attacking = 1 Then
        For n = 4 To 7
            Anim = n
        DoEvents
        Next n

```
Basically when cntl key is press the anim displays only 7.
Link to comment
Share on other sites

  • 2 weeks later...
    You could try this, its made for 2 frames but it playes them to fast so it don't look that great.

  If Player(Index).Attacking = 1 Then
        n = Rand(4, 5)
        Anim = n - 1
        End If

    It playes me frame 3 and 4 but a way to fast :P

    Btw frames counting from 0 to 4 that mean 5 frames per line, 4 walking 1 attacking. And it will play the last walking frame + attack frame.
    And you also have to change this so it will read corectly your sprite:

> .Left = Anim * (DDSD_Character(Sprite).lWidth / 5)
>         .Right = .Left + (DDSD_Character(Sprite).lWidth / 5)
>     End With
>
>     ' Calculate the X
>     x = GetPlayerX(Index) * PIC_X + Player(Index).XOffset - ((DDSD_Character(Sprite).lWidth / 5 - 32) / 2)

    Anyway there should be a better way to this, well absolutely there its a better way becouse this one sucks :P
    Hope Robin give us a hint :P
Link to comment
Share on other sites

@Lavos:

> Basically when cntl key is press the anim displays only 7.

That's because it's looping so fast you only see animation 7\. Look at the attacking animation procedures and how GetTickCount is used to interchange between animations if you hold Ctrl down.
Link to comment
Share on other sites

@Lightning:

> That's because it's looping so fast you only see animation 7\. Look at the attacking animation procedures and how GetTickCount is used to interchange between animations if you hold Ctrl down.

Your comment was truly helpfull.

Here its the code with witch i got it working with 3 frames attack animation.
Just add your frames 5 and 6 and make another elseif for frame 7 and it will work.

```
    If Player(Index).AttackTimer + (attackspeed / 4) > GetTickCount Then
        If Player(Index).Attacking = 1 Then
            Anim = 4
        End If
    ElseIf Player(Index).AttackTimer + (attackspeed / 3) + 100 > GetTickCount And Player(Index).Attacking = 1 Then Anim = 3
    ElseIf Player(Index).AttackTimer + (attackspeed / 2) + 200 > GetTickCount And Player(Index).Attacking = 1 Then Anim = 1
    Else
```
Link to comment
Share on other sites

@Lavos:

> Awsome! Thank you so much for the help! i managed to get it to work now with a 4 attack frames. =) I'm going to run more tests on it and see what else i could do with it.

Np i'm glad i could help you and i could helped me too. Play with it becouse you can set the frames time slower of faster, or one of them faster the others. Kinda awsome :P
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
 Share

×
×
  • Create New...