horsehead Posted August 19, 2011 Author Share Posted August 19, 2011 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 SubI 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 More sharing options...
Robin Posted August 20, 2011 Share Posted August 20, 2011 What in God's name are you trying to do? Link to comment Share on other sites More sharing options...
horsehead Posted August 20, 2011 Author Share Posted August 20, 2011 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 More sharing options...
Robin Posted August 20, 2011 Share Posted August 20, 2011 Stop overcomplicating it. Just set 3 new properties and allow the designer to set a different animation per direction. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now