Mirage Source
[MS4How would i be able to change the sprite format to this? - Printable Version

+- Mirage Source (https://mirage-engine.uk/forums)
+-- Forum: Mirage Source (Nostalgia) (https://mirage-engine.uk/forums/forumdisplay.php?fid=61)
+--- Forum: Archive (2006-2011) (https://mirage-engine.uk/forums/forumdisplay.php?fid=18)
+---- Forum: Source Code Development (https://mirage-engine.uk/forums/forumdisplay.php?fid=51)
+----- Forum: Mirage Source 4 (Visual Basic 6) (https://mirage-engine.uk/forums/forumdisplay.php?fid=44)
+------ Forum: Bugs Reports (https://mirage-engine.uk/forums/forumdisplay.php?fid=9)
+------ Thread: [MS4How would i be able to change the sprite format to this? (/showthread.php?tid=3119)



[MS4How would i be able to change the sprite format to this? - bluedude13 - 06-09-2009

How can i change the default sprite template in vb6? from ms4 format to rpgmaker format but in the same way as they are now in separate files

Like File 1
Sprite1.bmp (or something)
[Image: 70b166217121886065c747cbe97b6ad2.png]

File 2
Sprite2.bmp (Instead of 1 Sprites.bmp)
[Image: 9e2a652de3912e30d5f9dfcf393b9ba6.png]


Re: [MS4How would i be able to change the sprite format to this? - Robin - 06-09-2009

[Image: rawrup.png]

[Image: sprite1.png]

Code:
Public Sub DrawSprite(ByVal X As Long, ByVal Y As Long, ByVal Dir As Byte)
Dim srcRECT As DxVBLibA.RECT

    With CDX8
        .SetTexture TextureID.sprite1
        Select Case Dir
            Case 1 'Up
                srcRECT.Top = 96 '0
            Case 2 'Down
                srcRECT.Top = 0 '96
            Case 3 'Left
                srcRECT.Top = 32
            Case 4 'Right
                srcRECT.Top = 64
        End Select
        
        srcRECT.Left = 33
        srcRECT.Right = srcRECT.Left + 32
        srcRECT.bottom = srcRECT.Top + 32
            
        .TextureControl X * 4, Y * 4, srcRECT.Right - srcRECT.Left, srcRECT.bottom - srcRECT.Top, srcRECT.Left, srcRECT.Top, , False
        .Draw
    End With
End Sub



Re: [MS4How would i be able to change the sprite format to this? - bluedude13 - 06-09-2009

Where would i put this i tried to find it but there is none...


Re: [MS4How would i be able to change the sprite format to this? - Robin - 06-09-2009

bluedude13 Wrote:Where would i put this i tried to find it but there is none...

It's just an example, you'll need to edit BltPlayer to do it yourself.


Re: [MS4How would i be able to change the sprite format to this? - GIAKEN - 06-09-2009

Yeah it's really simple.


Re: [MS4How would i be able to change the sprite format to this? - bluedude13 - 06-09-2009

Ahh man i tried but i get lots of errors can some one help?


Code:
Public Sub BltPlayer(ByVal Index As Long)
Dim Anim As Long
Dim I As Long
Dim SpellNum As Long
Dim X As Long
Dim Y As Long
Dim Sprite As Long
Dim rec As DXVBLib.RECT

    Sprite = GetPlayerSprite(Index)

    ' Check for animation
    Anim = 0
    If Player(Index).Attacking = 0 Then
        Select Case GetPlayerDir(Index)
            Case DIR_UP
                If (Player(Index).YOffset < SIZE_Y / 96) Then Anim = 1
            Case DIR_DOWN
                If (Player(Index).YOffset < SIZE_Y / 0 * -1) Then Anim = 1
            Case DIR_LEFT
                If (Player(Index).XOffset < SIZE_Y / 32) Then Anim = 1
            Case DIR_RIGHT
                If (Player(Index).XOffset < SIZE_Y / 64 * -1) Then Anim = 1
        End Select
    Else
        If Player(Index).AttackTimer + 500 > GetTickCount Then
            Anim = 2
        End If
    End If
    
    ' Check to see if we want to stop making him attack
    With Player(Index)
        If .AttackTimer + 1000 < GetTickCount Then
            .Attacking = 0
            .AttackTimer = 0
        End If
    End With
    
    With rec
        .Top = 0
        .Bottom = SIZE_Y
        .Left = (GetPlayerDir(Index) * 3 + Anim) * SIZE_X
        .Right = .Left + SIZE_X
    End With
    
    X = GetPlayerX(Index) * SIZE_X + Player(Index).XOffset
    Y = GetPlayerY(Index) * SIZE_Y + Player(Index).YOffset - 4 ' to raise the sprite by 4 pixels
    
    ' Check if its out of bounds because of the offset
    If Y < 0 Then
        Y = 0
        With rec
            .Top = .Top + (Y * -1)
        End With
    End If



Re: [MS4How would i be able to change the sprite format to this? - GIAKEN - 06-09-2009

Code:
With rec
        .Top = GetPlayerDir(Index) * SIZE_Y
        .Bottom = .Top + SIZE_Y
        .Left = Anim * SIZE_X
        .Right = .Left + SIZE_X
    End With

That should be it.


Re: [MS4How would i be able to change the sprite format to this? - bluedude13 - 06-09-2009

But now it says ERROR Missing file


Re: [MS4How would i be able to change the sprite format to this? - GIAKEN - 06-09-2009

Umm ok that has nothing to do with BltPlayer. How are you loading your sprites?


Re: [MS4How would i be able to change the sprite format to this? - bluedude13 - 06-09-2009

Well i just changed my sprite to Sprite 16 ( the rpg maker sprite format) and then i changed it to 2.bmp or 17.bmp and everytime it says its missing...


Re: [MS4How would i be able to change the sprite format to this? - Robin - 06-09-2009

Did you actually place .BMP files in there, or did you put .PNG files in there?


Re: [MS4How would i be able to change the sprite format to this? - bluedude13 - 06-09-2009

it was a Bmp why should it be png?


Re: [MS4How would i be able to change the sprite format to this? - GIAKEN - 06-09-2009

The sprites you showed us are PNGs.


Re: [MS4How would i be able to change the sprite format to this? - bluedude13 - 06-09-2009

Hmm wait..


Re: [MS4How would i be able to change the sprite format to this? - GIAKEN - 06-09-2009

Open them in paint and save as 24-bit BMPs. And make sure the first sprite file is sprite0 or sprite1 I forgot what it starts at.


Re: [MS4How would i be able to change the sprite format to this? - bluedude13 - 06-09-2009

It works now but everything back wards like i tried switching the code around but it didn't work

THis is how its like

|How its supposed to be| |How it is now Sad|
left------------------------------------>Right
right---------------------------------->Up
up------------------------------------->Down
Down---------------------------------->Left


Re: [MS4How would i be able to change the sprite format to this? - GIAKEN - 06-09-2009

Code:
Select Case GetPlayerDir(MyIndex)
        Case DIR_DOWN
            .Top = DIR_LEFT * SIZE_Y
        Case DIR_LEFT
            .Top = DIR_DOWN * SIZE_Y
        Case DIR_RIGHT
            .Top = DIR_UP * SIZE_Y
        Case Dir_UP
            .Top = DIR_RIGHT * SIZE_Y
    End Select
    
    With rec
        .Bottom = .Top + SIZE_Y
        .Left = Anim * SIZE_X
        .Right = .Left + SIZE_X
    End With



Re: [MS4How would i be able to change the sprite format to this? - bluedude13 - 06-09-2009

Aww i cant do it Sad i keep getting so many errors and i cannot find the GetplayerDir your talking about all you do is paste the code!
Sorry.


Re: [MS4How would i be able to change the sprite format to this? - GIAKEN - 06-09-2009

Oops just change MyIndex to Index there...