| Mirage Source http://www.miragesource.net/forums/ |
|
| Continuous Animation http://www.miragesource.net/forums/viewtopic.php?f=201&t=509 |
Page 1 of 1 |
| Author: | Rian [ Wed Sep 13, 2006 4:25 pm ] |
| Post subject: | Continuous Animation |
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? |
|
| Author: | Dragoons Master [ Wed Sep 13, 2006 4:37 pm ] |
| Post subject: | |
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. |
|
| Author: | halla [ Wed Sep 13, 2006 8:57 pm ] |
| Post subject: | |
True make sure not to do it for all of the npcs though as you will have say a skelton walking in place... |
|
| Author: | Soccertise [ Wed Sep 13, 2006 10:51 pm ] |
| Post subject: | |
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 |
|
| Author: | Clu [ Wed Sep 13, 2006 11:06 pm ] |
| Post subject: | |
couldnt you just take the keyboard moving thing(like press left and it runs the left animation) and delete the key pressing part? |
|
| Author: | halla [ Thu Sep 14, 2006 1:00 am ] |
| Post subject: | |
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 |
|
| Author: | Obsidian [ Thu Sep 14, 2006 1:35 am ] |
| Post subject: | |
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... |
|
| Page 1 of 1 | All times are UTC |
| Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |
|