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

(CS:DE) Old Sprite Format


12it123
 Share

Recommended Posts

Hey guys, I'm usually one to do things by myself and I know the very basics of programming but this really has me stumped. Anyways, I'm trying to change the way the sprite format back to how it was when  Eclipse Origins was released and I almost have it! But apparently it's only recognizing the top 32x32 square of the character which means the character's head has to be on the item and not his feet. It's not only items though, The block attribute also only works for the top half of the spirit instead of the bottom where it should.

Here's an example of where the player needs to be to pick up the items (There's a wooden sword behind the player's head):
![](http://i60.photobucket.com/albums/h8/12it123/Problem.png)

And here's my DrawPlayer (I believe that's the only thing regarding this that I've edited):
```
Public Sub DrawPlayer(ByVal index As Long)
    Dim Anim As Byte
    Dim i As Long
    Dim x As Long
    Dim y As Long
    Dim sprite As Long, spriteleft As Long
    Dim rec As GeomRec
    Dim attackspeed As Long

    ' pre-load sprite for calculations
    sprite = GetPlayerSprite(index)
    'SetTexture Tex_Char(Sprite)

    If sprite < 1 Or sprite > Count_Char Then Exit Sub

    ' speed from weapon
    If GetPlayerEquipment(index, Weapon) > 0 Then
        attackspeed = Item(GetPlayerEquipment(index, Weapon)).speed
    Else
        attackspeed = 1000
    End If

    If Not isConstAnimated(GetPlayerSprite(index)) Then
        ' Reset frame
        Anim = 1
        ' Check for attacking animation
        If Player(index).AttackTimer + (attackspeed / 2) > GetTickCount Then
            If Player(index).Attacking = 1 Then
                Anim = 2
            End If
        Else
            ' If not attacking, walk normally
            Select Case GetPlayerDir(index)
                Case DIR_UP
                    If (Player(index).yOffset > 8) Then Anim = Player(index).Step
                Case DIR_DOWN
                    If (Player(index).yOffset < -8) Then Anim = Player(index).Step
                Case DIR_LEFT
                    If (Player(index).xOffset > 8) Then Anim = Player(index).Step
                Case DIR_RIGHT
                    If (Player(index).xOffset < -8) Then Anim = Player(index).Step
            End Select
        End If
    Else
        If Player(index).AnimTimer + 100 <= GetTickCount Then
            Player(index).Anim = Player(index).Anim + 1
            If Player(index).Anim >= 3 Then Player(index).Anim = 0
            Player(index).AnimTimer = GetTickCount
        End If
        Anim = Player(index).Anim
    End If

    ' Check to see if we want to stop making him attack
    With Player(index)
        If .AttackTimer + attackspeed < GetTickCount Then
            .Attacking = 0
            .AttackTimer = 0
        End If
    End With

    ' Set the left
    Select Case GetPlayerDir(index)
        Case DIR_UP
            spriteleft = 0
        Case DIR_RIGHT
            spriteleft = 1
        Case DIR_DOWN
            spriteleft = 2
        Case DIR_LEFT
            spriteleft = 3
    End Select

    With rec
        .top = 0
        .height = (D3DT_TEXTURE(Tex_Char(sprite)).height)
        .left = (spriteleft * 3 + Anim) * (D3DT_TEXTURE(Tex_Char(sprite)).Width / 12)
        .Width = (D3DT_TEXTURE(Tex_Char(sprite)).Width / 12)
    End With

    ' Calculate the X
    x = GetPlayerX(index) * PIC_X + Player(index).xOffset - ((D3DT_TEXTURE(Tex_Char(sprite)).Width / 12 - 32) / 2)

    ' Is the player's height more than 32..?
    If (D3DT_TEXTURE(Tex_Char(sprite)).height) > 32 Then
        ' Create a 32 pixel offset for larger sprites
        y = GetPlayerY(index) * PIC_Y + Player(index).yOffset - ((D3DT_TEXTURE(Tex_Char(sprite)).height / -32))
    Else
        ' Proceed as normal
        y = GetPlayerY(index) * PIC_Y + Player(index).yOffset
    End If

    RenderTexture Tex_Char(sprite), ConvertMapX(x), ConvertMapY(y), rec.left, rec.top, rec.Width, rec.height, rec.Width, rec.height
End Sub
```
Link to comment
Share on other sites

Thanks for the help and the fast response ZeroX8 but I tried what you suggested and it resulted in this and I still have my issue. I hope you can help me out, thanks tons again.
![](http://i60.photobucket.com/albums/h8/12it123/Problem2.png)
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...