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
#2
Last time I checked, I thought that you needed to dim a variable before you used it.
I do believe that you did not dim animtimer and animtype.
Also, you need to add a end select to the function.

EDIT:
I tried this tutorial out, and I had to completely revamp it to get the 1st sprite to anim, and none of the others worked, so there is obviously something wrong with this tutorial.
Sorry, Robin.
Reply
#3
This isn't a copy and paste tutorial, and I didn't give you everything so people couldn't just leach.

It takes basic programming knowledge to make it work.
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
#4
I should have thought of that... Well, you might want to post that somewhere, so people don't get confuzled.
Reply
#5
It's now in the third post down.
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
#6
Nicely done.
Reply
#7
I got it working easy.

I just added constanim as byte to the npc rec and saved the value of a checkbox to it and then checked that in the bltnpc/top subs.

Works perfectly! ^_^
Reply
#8
MIght be cool to make the players eyes close and open.
Reply
#9
Idle animations ftw.
Reply
#10
Rezeyu Wrote:Idle animations ftw.
Almost impossible if you have paperdoll.
Reply
#11
I had idle animations on my paperdoll.

=/
Reply
#12
But you'll have to pixel the animation if its not just for the eyes.
Reply
#13
I only use it for flying creatures.
Reply
#14
Perfekt Wrote:I only use it for flying creatures.

Same. I remember bringing it up ages ago with DarkAngel.
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
#15
EDIT: Nevermind! I got it working finally, just had to save to a text box instead! ^_^;

This is so awesome!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)