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

CS:DE Spellanimation for every direction


horsehead
 Share

Recommended Posts

I have a problem with my animationcode of CS:DE. I want to make a animation for each direction. But the problem is that i can split the image but i dont can animate all pieces of the image.

I mean: I can animate only part 1 but not part 2-4      1====
                                                                                    2====
                                                                                    3====
                                                                                    4====

Thats my code of Sub DrawAnimation

> Public Sub DrawAnimation(ByVal index As Long, ByVal Layer As Long)
> Dim sprite As Integer, sRECT As GeomRec, i As Long, Width As Long, height As Long, looptime As Long, FrameCount As Long, AnimationTop As Long
> Dim x As Long, y As Long, lockindex As Long
>
>     If AnimInstance(index).Animation = 0 Then
>         ClearAnimInstance index
>         Exit Sub
>     End If
>    
>     sprite = Animation(AnimInstance(index).Animation).sprite(Layer)
>    
>     If sprite < 1 Or sprite > Count_Anim Then Exit Sub
>    
>     ' pre-load texture for calculations
>     'SetTexture Tex_Anim(Sprite)
>    
>     FrameCount = Animation(AnimInstance(index).Animation).Frames(Layer)
>    
>     ' total width divided by frame count
>     Width = D3DT_TEXTURE(Tex_Anim(sprite)).Width / FrameCount
>     height = D3DT_TEXTURE(Tex_Anim(sprite)).height
>    
>     ' Set the left
>     Select Case GetPlayerDir(index)
>         Case DIR_UP
>             AnimationTop = 3
>         Case DIR_RIGHT
>             AnimationTop = 2
>         Case DIR_DOWN
>             AnimationTop = 0
>         Case DIR_LEFT
>             AnimationTop = 1
>     End Select
>    
>    
>     With sRECT
>         .top = AnimationTop * (height * ((AnimInstance(index).FrameIndex(Layer) - 1) \ AnimColumns)) / 4
>         .height = height / 4
>         .left = (Width * (((AnimInstance(index).FrameIndex(Layer) - 1) Mod AnimColumns)))
>         .Width = Width
>     End With
>    
>    
>
>    
>     ' change x or y if locked
>     If AnimInstance(index).LockType > TARGET_TYPE_NONE Then ' if <> none
>         ' is a player
>         If AnimInstance(index).LockType = TARGET_TYPE_PLAYER Then
>             ' quick save the index
>             lockindex = AnimInstance(index).lockindex
>             ' check if is ingame
>             If IsPlaying(lockindex) Then
>                 ' check if on same map
>                 If GetPlayerMap(lockindex) = GetPlayerMap(MyIndex) Then
>                     ' is on map, is playing, set x & y
>                     x = (GetPlayerX(lockindex) * PIC_X) + 16 - (Width / 2) + Player(lockindex).xOffset
>                     y = (GetPlayerY(lockindex) * PIC_Y) + 16 - (height / 2) + Player(lockindex).yOffset
>                 End If
>             End If
>         ElseIf AnimInstance(index).LockType = TARGET_TYPE_NPC Then
>             ' quick save the index
>             lockindex = AnimInstance(index).lockindex
>             ' check if NPC exists
>             If MapNpc(lockindex).num > 0 Then
>                 ' check if alive
>                 If MapNpc(lockindex).Vital(Vitals.HP) > 0 Then
>                     ' exists, is alive, set x & y
>                     x = (MapNpc(lockindex).x * PIC_X) + 16 - (Width / 2) + MapNpc(lockindex).xOffset
>                     y = (MapNpc(lockindex).y * PIC_Y) + 16 - (height / 2) + MapNpc(lockindex).yOffset
>                 Else
>                     ' npc not alive anymore, kill the animation
>                     ClearAnimInstance index
>                     Exit Sub
>                 End If
>             Else
>                 ' npc not alive anymore, kill the animation
>                 ClearAnimInstance index
>                 Exit Sub
>             End If
>         End If
>     Else
>         ' no lock, default x + y
>         x = (AnimInstance(index).x * 32) + 16 - (Width / 2)
>         y = (AnimInstance(index).y * 32) + 16 - (height / 2)
>     End If
>    
>     x = ConvertMapX(x)
>     y = ConvertMapY(y)
>    
>     'EngineRenderRectangle Tex_Anim(sprite), x, y, sRECT.left, sRECT.top, sRECT.width, sRECT.height, sRECT.width, sRECT.height, sRECT.width, sRECT.height
>     RenderTexture Tex_Anim(sprite), x, y, sRECT.left, sRECT.top, sRECT.Width, sRECT.height, sRECT.Width, sRECT.height
> End Sub

I hope anyone can help me.

Here is a picture of that what I mean: ![](http://www.freemmorpgmaker.com/files/imagehost/pics/65bb46f0c5901b0af3afe200623ba3da.png)

Each arrow is for my sprites direction.
Link to comment
Share on other sites

I try to have a spell animation for each direction of my character. If my sprite have the direction down then the spell should look like other then the spellanimation if my sprite have the direction left.

My english is crab sorry. I hope you guys understand me now xP.
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...