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

[ER, CS:DE maybe] Attack animations


tslusny
 Share

Recommended Posts

When you finish this tutorial, you will get something like this: ![](http://www.freemmorpgmaker.com/files/imagehost/pics/672bac58115812f237bd9326dcafbe52.gif)

First search for:

```

Public Tex_Char() As Long

```

Then add under it this:

```

Public Tex_Charanim() As Long

```

Then search for:

```

Public Count_Char As Long

```

And add under it:

```

Public Count_Charanim As Long

```

Then search for:

```

' Character Textures

Count_Char = 1

Do While FileExist(App.path & Path_Char & Count_Char & ".png")

ReDim Preserve Tex_Char(0 To Count_Char)

Tex_Char(Count_Char) = Directx8.SetTexturePath(App.path & Path_Char & Count_Char & ".png")

Count_Char = Count_Char + 1

Loop

Count_Char = Count_Char - 1

```

And add this under it:

```

' Character animation Textures

Count_Charanim = 1

Do While FileExist(App.path & Path_Char & Count_Charanim & "_anim.png")

ReDim Preserve Tex_Charanim(0 To Count_Charanim)

Tex_Charanim(Count_Charanim) = Directx8.SetTexturePath(App.path & Path_Char & Count_Charanim & "_anim.png")

Count_Charanim = Count_Charanim + 1

Loop

Count_Charanim = Count_Charanim - 1

```

Then search for this:

```

With rec

.Top = spritetop * (gTexture(Tex_Char(Sprite)).height / 4)

.height = (gTexture(Tex_Char(Sprite)).height / 4)

.Left = Anim * (gTexture(Tex_Char(Sprite)).Width / 4)

.Width = (gTexture(Tex_Char(Sprite)).Width / 4)

End With

' Calculate the X

X = GetPlayerX(Index) * PIC_X + Player(Index).xOffset - ((gTexture(Tex_Char(Sprite)).Width / 4 - 32) / 2)

' Is the player's height more than 32..?

If (gTexture(Tex_Char(Sprite)).height) > 32 Then

' Create a 32 pixel offset for larger sprites

Y = GetPlayerY(Index) * PIC_Y + Player(Index).yOffset - ((gTexture(Tex_Char(Sprite)).height / 4) - 32) - 4

Else

' Proceed as normal

Y = GetPlayerY(Index) * PIC_Y + Player(Index).yOffset - 4

End If

Directx8.RenderTexture Tex_Char(Sprite), ConvertMapX(X + 12), ConvertMapY(Y + 5), rec.Left, rec.Top, rec.Width - 8, rec.height, rec.Width, rec.height, D3DColorARGB(100, 0, 0, 0), 45

Directx8.RenderTexture Tex_Char(Sprite), ConvertMapX(X), ConvertMapY(Y), rec.Left, rec.Top, rec.Width, rec.height, rec.Width, rec.height

' check for paperdolling

For I = 1 To UBound(PaperdollOrder)

If GetPlayerEquipment(Index, PaperdollOrder(I)) > 0 Then

If Item(GetPlayerEquipment(Index, PaperdollOrder(I))).Paperdoll > 0 Then

Call DrawPaperdoll(X, Y, Item(GetPlayerEquipment(Index, PaperdollOrder(I))).Paperdoll, Anim, spritetop)

End If

End If

Next

```

And replace it with this:

```

If Player(Index).Attacking = YES Then

If Sprite < 1 Or Sprite > Count_Charanim Then Exit Sub

With rec

.Top = spritetop * (gTexture(Tex_Charanim(Sprite)).height / 4)

.height = (gTexture(Tex_Charanim(Sprite)).height / 4)

.Left = Anim * (gTexture(Tex_Charanim(Sprite)).Width / 3)

.Width = (gTexture(Tex_Charanim(Sprite)).Width / 3)

End With

' Calculate the X

X = GetPlayerX(Index) * PIC_X + Player(Index).xOffset - ((gTexture(Tex_Charanim(Sprite)).Width / 3 - 32) / 2)

Y = GetPlayerY(Index) * PIC_Y + Player(Index).yOffset - ((gTexture(Tex_Charanim(Sprite)).height / 4) / 2)

Directx8.RenderTexture Tex_Charanim(Sprite), ConvertMapX(X), ConvertMapY(Y), rec.Left, rec.Top, rec.Width, rec.height, rec.Width, rec.height

Else

With rec

.Top = spritetop * (gTexture(Tex_Char(Sprite)).height / 4)

.height = (gTexture(Tex_Char(Sprite)).height / 4)

.Left = Anim * (gTexture(Tex_Char(Sprite)).Width / 4)

.Width = (gTexture(Tex_Char(Sprite)).Width / 4)

End With

' Calculate the X

X = GetPlayerX(Index) * PIC_X + Player(Index).xOffset - ((gTexture(Tex_Char(Sprite)).Width / 4 - 32) / 2)

' Is the player's height more than 32..?

If (gTexture(Tex_Char(Sprite)).height) > 32 Then

' Create a 32 pixel offset for larger sprites

Y = GetPlayerY(Index) * PIC_Y + Player(Index).yOffset - ((gTexture(Tex_Char(Sprite)).height / 4) - 32) - 4

Else

' Proceed as normal

Y = GetPlayerY(Index) * PIC_Y + Player(Index).yOffset - 4

End If

Directx8.RenderTexture Tex_Char(Sprite), ConvertMapX(X + 12), ConvertMapY(Y + 5), rec.Left, rec.Top, rec.Width - 8, rec.height, rec.Width, rec.height, D3DColorARGB(100, 0, 0, 0), 45

Directx8.RenderTexture Tex_Char(Sprite), ConvertMapX(X), ConvertMapY(Y), rec.Left, rec.Top, rec.Width, rec.height, rec.Width, rec.height

' check for paperdolling

For I = 1 To UBound(PaperdollOrder)

If GetPlayerEquipment(Index, PaperdollOrder(I)) > 0 Then

If Item(GetPlayerEquipment(Index, PaperdollOrder(I))).Paperdoll > 0 Then

Call DrawPaperdoll(X, Y, Item(GetPlayerEquipment(Index, PaperdollOrder(I))).Paperdoll, Anim, spritetop)

End If

End If

Next

End If

```

And now add files from attachment to your **data files/graphics/characters** folder. And voila, you are done.

**Credits**: Lumiere, for example graphics
Link to comment
Share on other sites

  • 2 weeks later...

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...