Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Continuous Animation
#1
I was thinking it'd be neat to have a "Continuous Animation" option on NPCs. For example, you want to make a bird npc. Check a "Check Box" on the npc editor, and the birds animation continues to run even when he isn't switch tiles. That way we don't have birds flying around that only flap thier wings when they're moving.

I'm gonna attempt this, but I'm horrible at blting. Infact, I've pretty much NEVER touched any of the code that deals with NPCs walking.

Any one have any ideas, tips, or pointers?
Reply
#2
It's not hard to be done. You need to change the BltNpc sub a bit, like adding a timer for the npc animation speed and a few other things and w/ it just change the Anim var as much as you need.
Reply
#3
True make sure not to do it for all of the npcs though as you will have say a skelton walking in place...
Reply
#4
You mean like an npc which can jog in place or something ya that sounds pretty cool if you need the animation i can make them run continuously
Reply
#5
couldnt you just take the keyboard moving thing(like press left and it runs the left animation) and delete the key pressing part?
Reply
#6
Soccertise Wrote:You mean like an npc which can jog in place or something ya that sounds pretty cool if you need the animation i can make them run continuously

the animations is already there.

he just means having the moving animation constantly instead of only when moving... so like he said the bird would have its wings flapping even when not moving

good for aerial npcs
Reply
#7
i think this MIGHT work... i just kinda went through and coded it really quick... it requires two new variables for the NPC rec... one really isn't necissary you can just make it a public timer if you want, but then they'll all be flapping at the same time or whatever... replace the

Code:
' Check for animation
    Anim = 0
    If MapNpc(MapNpcNum).Attacking = 0 Then
        Select Case MapNpc(MapNpcNum).Dir
            Case DIR_UP
                If (MapNpc(MapNpcNum).YOffset < PIC_Y / 2) Then Anim = 1
            Case DIR_DOWN
                If (MapNpc(MapNpcNum).YOffset < PIC_Y / 2 * -1) Then Anim = 1
            Case DIR_LEFT
                If (MapNpc(MapNpcNum).XOffset < PIC_Y / 2) Then Anim = 1
            Case DIR_RIGHT
                If (MapNpc(MapNpcNum).XOffset < PIC_Y / 2 * -1) Then Anim = 1
        End Select
    Else
        If MapNpc(MapNpcNum).AttackTimer + 500 > GetTickCount Then
            Anim = 2
        End If
    End If

and try using this... it's untested... but it should definately be a step in the right direction for you... i think.... haha....

Code:
' Check for animation
    Anim = 0
    If MapNpc(MapNpcNum).Attacking = 0 Then
        If Npc(MapNpc(MapNpcNum).num).Constant = 1 Then
            ' Move them constantly.. every 150 milliseconds or so...
            If GetTickCount > Npc(MapNpc(MapNpcNum).num).movetimer + 150 Then
                If Anim = 1 Then
                    Select Case MapNpc(MapNpcNum).Dir
                        Case DIR_UP
                            If (MapNpc(MapNpcNum).YOffset < PIC_Y / 2) Then Anim = 2
                        Case DIR_DOWN
                            If (MapNpc(MapNpcNum).YOffset < PIC_Y / 2 * -1) Then Anim = 2
                        Case DIR_LEFT
                            If (MapNpc(MapNpcNum).XOffset < PIC_Y / 2) Then Anim = 2
                        Case DIR_RIGHT
                            If (MapNpc(MapNpcNum).XOffset < PIC_Y / 2 * -1) Then Anim = 2
                    End Select
                Else
                    Select Case MapNpc(MapNpcNum).Dir
                        Case DIR_UP
                            If (MapNpc(MapNpcNum).YOffset < PIC_Y / 2) Then Anim = 1
                        Case DIR_DOWN
                            If (MapNpc(MapNpcNum).YOffset < PIC_Y / 2 * -1) Then Anim = 1
                        Case DIR_LEFT
                            If (MapNpc(MapNpcNum).XOffset < PIC_Y / 2) Then Anim = 1
                        Case DIR_RIGHT
                            If (MapNpc(MapNpcNum).XOffset < PIC_Y / 2 * -1) Then Anim = 1
                    End Select
                End If
                Npc(MapNpc(MapNpcNum).num).movetimer = GetTickCount
            End If
        Else
            Select Case MapNpc(MapNpcNum).Dir
                Case DIR_UP
                    If (MapNpc(MapNpcNum).YOffset < PIC_Y / 2) Then Anim = 1
                Case DIR_DOWN
                    If (MapNpc(MapNpcNum).YOffset < PIC_Y / 2 * -1) Then Anim = 1
                Case DIR_LEFT
                    If (MapNpc(MapNpcNum).XOffset < PIC_Y / 2) Then Anim = 1
                Case DIR_RIGHT
                    If (MapNpc(MapNpcNum).XOffset < PIC_Y / 2 * -1) Then Anim = 1
            End Select
        End If
    Else
        If MapNpc(MapNpcNum).AttackTimer + 500 > GetTickCount Then
            Anim = 2
        End If
    End If


That would be if you added the "constant" to the npc rec, it would also require you to add "MoveTimer" to the Npc Rec... but that obviously wouldn't need to be saved... let me know how that goes...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)