Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Constantly Animated Sprites
#1
This will make it so certain player and npc sprites are constantly animated.

My game has the attack frame as a standing still frame, and the frames on either side as stepping frames.
Adjust according to your source

Here's the function where you set what sprites are constantly animated.

Edit it according to your sprite sheet.

You could also save them to a file.

Code:
Public Function IsConstAnim(ByVal sprite As Long) As Boolean
Select Case sprite
  Case 1
    IsConstAnim = True
    Exit Function
IsConstAnim = False
End Function

In my source, I set a quick if statement to sort out the actual blting, but you can do other wise.

Code:
If IsConstAnim(GetPlayerSprite(Index)) = False Then

Is what I had before the animation is set for the normal walking, then after that is decided I added this:

Code:
Else
      With Player(Index)
        If GetTickCount > .animtimer + 100 Then
          Select Case .anim
            Case 0
              .animtype = 1
              .anim = 1
            Case 1
              If .animtype = 0 Then
                .anim = 0
              ElseIf .animtype = 1 Then
                .anim = 2
              End If
            Case 2
              .animtype = 0
              .anim = 1
          End Select
          .animtimer = GetTickCount
        End If
        anim = .anim
      End With
    End If

Add the required data to the playerrec as a long and byte respectively.

For NPCS just change:

Code:
With Player(Index)

to:

Code:
With MapNpc(MapNpcNum)

and the IsConstAnim call to:

Code:
If IsConstAnim(Npc(MapNpc(MapNpcNum).Num).sprite) = False Then

Enjoy.
Quote:Robin:
Why aren't maps and shit loaded up in a dynamic array?
Jacob:
the 4 people that know how are lazy
Robin:
Who are those 4 people?
Jacob:
um
you, me, and 2 others?
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)