Mirage Source
http://miragesource.net/forums/

32x64 problem + graphic question
http://miragesource.net/forums/viewtopic.php?f=201&t=3641
Page 1 of 3

Author:  Gierek [ Sat Apr 26, 2008 3:47 pm ]
Post subject:  32x64 problem + graphic question

Hi
I'm Polish and my English isn't very good, sorry :oops:

1. I changed sprites size from 32x32 to 32x64 and it isn't ok. It shows sprites in a good size, but upper part of the sprite doesn't fit to the lower.
This problem exist only in few position, not everytime.
Look:
Image
Sprite of Gieroes is ok, upper and lower parts fit to each other, but Styku96's sprite's parts doesnt fit.

Any sugestions to solve it?

2. Are there any functions, commands to change image? For Example to blur it or make some other effect on it.


Thanks for any reply, and again sorry for my English;]

Author:  Gierek [ Sun Apr 27, 2008 7:49 pm ]
Post subject:  Re: 32x64 problem + graphic question

Any ideas?

Author:  Kousaten [ Mon Apr 28, 2008 2:37 pm ]
Post subject:  Re: 32x64 problem + graphic question

1.

Imageshack is blocked on my campus network so I can't see the image, but it could be a problem with positioning in sprites.bmp (or .png/.gif/.whatever-you-use). There could be an error in coding if it's just like... your top half is facing left and bottom is facing forward, or something. I can't say for sure since I can't see it nor your code.

2.

I haven't a clue. :(

Author:  Robin [ Mon Apr 28, 2008 2:59 pm ]
Post subject:  Re: 32x64 problem + graphic question

Make sure the animation code in BltPlayer matches that of BltPlayerTop.

Author:  Gierek [ Mon Apr 28, 2008 3:37 pm ]
Post subject:  Re: 32x64 problem + graphic question

I didn't change any code in blting, only changed 32x32 to 32x64.
How can I show you this image?;p

It's Like That:

+++++
+++++

It's a sprite.
Everything + should by under +, but sometimes it's like that:
+++++
+++++

Position of upper part is another than lower.

Any ideas?:D

Author:  Rian [ Mon Apr 28, 2008 3:42 pm ]
Post subject:  Re: 32x64 problem + graphic question

Here, try this tutorial:
http://web.miragesource.com/forums/viewtopic.php?f=75&t=45&hilit=32x64

Author:  Lea [ Mon Apr 28, 2008 4:33 pm ]
Post subject:  Re: 32x64 problem + graphic question

I don't see anything wrong.

Author:  Gierek [ Mon Apr 28, 2008 4:41 pm ]
Post subject:  Re: 32x64 problem + graphic question

Ups, I didn't say sth :D
I use Elysium Diamond and I think, ekhm, Im sure that bltplayertop is there;]

Author:  Gierek [ Mon Apr 28, 2008 6:15 pm ]
Post subject:  Re: 32x64 problem + graphic question

FIX:

It's Like That:

+++++
+++++

It's a sprite.
Everything + should by under +, but sometimes it's like that:
+++++
.+++++

Position of upper part is another than lower.

Author:  Gierek [ Mon Apr 28, 2008 6:28 pm ]
Post subject:  Re: 32x64 problem + graphic question

Ok, I discovered sth.
This bug appears only on two frames-right walking.
It appears when char goes to right. Any ideas now?:D

Author:  Stomach Pulser [ Mon Apr 28, 2008 8:24 pm ]
Post subject:  Re: 32x64 problem + graphic question

Give us a picture of you sprite on the tilesheet, cause I don't see anything wrong with the sprite...

Author:  Asrrin29 [ Mon Apr 28, 2008 8:34 pm ]
Post subject:  Re: 32x64 problem + graphic question

Gierek wrote:
Look:
Image


he did

Author:  Rian [ Mon Apr 28, 2008 8:40 pm ]
Post subject:  Re: 32x64 problem + graphic question

He means one straight from the sheet, so we have something to compare to find the problem

Author:  Gierek [ Tue Apr 29, 2008 2:27 pm ]
Post subject:  Re: 32x64 problem + graphic question

Ok, look
Image
First line is from sprites.bmp, secound is from game. Do you see it now?

Author:  Robin [ Tue Apr 29, 2008 2:29 pm ]
Post subject:  Re: 32x64 problem + graphic question

Gierek wrote:
Ok, look
Image
First line is from sprites.bmp, secound is from game. Do you see it now?


I've already told you how to solve your problem. Your animation code in BltPlayer and BltPlayerTop are mismatched.

Robin wrote:
Make sure the animation code in BltPlayer matches that of BltPlayerTop.

Author:  Lea [ Wed Apr 30, 2008 3:57 am ]
Post subject:  Re: 32x64 problem + graphic question

If you post your bltPlayer and bltPlayerTop code we can probably fix it up for you. I can see it in the second example, still not in the first.

Author:  Robin [ Wed Apr 30, 2008 2:18 pm ]
Post subject:  Re: 32x64 problem + graphic question

Actually, now I look again it might not be the animation code but the offset lines.

Author:  Rory [ Wed Apr 30, 2008 2:44 pm ]
Post subject:  Re: 32x64 problem + graphic question

ED2 always had a problem with 32x64 sprites, if you mean that the top half of the player is moved a pixel to the left or right.
There was a fix on the old forum somewhere there, but its lost forever.

Author:  Gierek [ Wed Apr 30, 2008 7:24 pm ]
Post subject:  Re: 32x64 problem + graphic question

Ok..

BltPlayer:
Code:
Sub BltPlayer(ByVal Index As Long)
Dim Anim As Byte
Dim x As Long, y As Long
Dim AttackSpeed As Long

    If GetPlayerWeaponSlot(Index) > 0 Then
        AttackSpeed = 1000 - (GetPlayerSPEED(Index) * 2)
    Else
        AttackSpeed = 1000
    End If

    ' Only used if ever want to switch to blt rather then bltfast
    ' I suggest you don't use, because custom sizes won't work any longer
    With rec_pos
        .Top = GetPlayerY(Index) * PIC_Y + Player(Index).YOffset - (SIZE_Y - PIC_Y)
        .Bottom = .Top + PIC_Y
        .Left = GetPlayerX(Index) * PIC_X + Player(Index).XOffset + ((SIZE_X - PIC_X) / 2)
        .Right = .Left + PIC_X + ((SIZE_X - PIC_X) / 2)
    End With
   
    ' Check for animation
    Anim = 0
    If Player(Index).Attacking = 0 Then
        Select Case GetPlayerDir(Index)
            Case DIR_UP
                If (Player(Index).YOffset < PIC_Y / 2) Then Anim = 1
            Case DIR_DOWN
                If (Player(Index).YOffset > PIC_Y / 2 * -1) Then Anim = 1
            Case DIR_LEFT
                If (Player(Index).XOffset < PIC_Y / 2) Then Anim = 1
            Case DIR_RIGHT
                If (Player(Index).XOffset > PIC_Y / 2 * -1) Then Anim = 1
        End Select
    Else
        If Player(Index).AttackTimer + Int(AttackSpeed / 2) > GetTickCount Then
            Anim = 2
        End If
    End If
   
    ' Check to see if we want to stop making him attack
    If Player(Index).AttackTimer + AttackSpeed < GetTickCount Then
        Player(Index).Attacking = 0
        Player(Index).AttackTimer = 0
    End If
   
    rec.Top = GetPlayerSprite(Index) * SIZE_Y + (SIZE_Y - PIC_Y)
    rec.Bottom = rec.Top + PIC_Y
    rec.Left = (GetPlayerDir(Index) * (3 * (SIZE_X / PIC_X)) + (Anim * (SIZE_X / PIC_X))) * PIC_X
    rec.Right = rec.Left + SIZE_X

    x = GetPlayerX(Index) * PIC_X - (SIZE_X - PIC_X) / 2 + sx + Player(Index).XOffset
    y = GetPlayerY(Index) * PIC_Y - (SIZE_Y - PIC_Y) + sx + Player(Index).YOffset + (SIZE_Y - PIC_Y)
   
    If SIZE_X > PIC_X Then
        If x < 0 Then
            x = Player(Index).XOffset + sx + ((SIZE_X - PIC_X) / 2)
            If GetPlayerDir(Index) = DIR_RIGHT And Player(Index).Moving > 0 Then
                rec.Left = rec.Left - Player(Index).XOffset
            Else
                rec.Left = rec.Left - Player(Index).XOffset + ((SIZE_X - PIC_X) / 2)
            End If
        End If
       
        If x > MAX_MAPX * 32 Then
            x = MAX_MAPX * 32 + sx - ((SIZE_X - PIC_X) / 2) + Player(Index).XOffset
            If GetPlayerDir(Index) = DIR_LEFT And Player(Index).Moving > 0 Then
                rec.Right = rec.Right + Player(Index).XOffset
            Else
                rec.Right = rec.Right + Player(Index).XOffset - ((SIZE_X - PIC_X) / 2)
            End If
        End If
    End If
   
    Call DD_BackBuffer.BltFast(x - (NewPlayerX * PIC_X) - NewXOffset, y - (NewPlayerY * PIC_Y) - NewYOffset, DD_SpriteSurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
End Sub


BltPlayerTop:
Code:
Sub BltPlayerTop(ByVal Index As Long)
Dim Anim As Byte
Dim x As Long, y As Long
Dim AttackSpeed As Long

    If GetPlayerWeaponSlot(Index) > 0 Then
        AttackSpeed = item(GetPlayerInvItemNum(Index, GetPlayerWeaponSlot(Index))).AttackSpeed
    Else
        AttackSpeed = 1000
    End If

    ' Only used if ever want to switch to blt rather then bltfast
    ' I suggest you don't use, because custom sizes won't work any longer
    With rec_pos
        .Top = GetPlayerY(Index) * PIC_Y + Player(Index).YOffset - (SIZE_Y - PIC_Y)
        .Bottom = .Top + PIC_Y
        .Left = GetPlayerX(Index) * PIC_X + Player(Index).XOffset + ((SIZE_X - PIC_X) / 2)
        .Right = .Left + PIC_X + ((SIZE_X - PIC_X) / 2)
    End With
   
    ' Check for animation
    Anim = 0
    If Player(Index).Attacking = 0 Then
        Select Case GetPlayerDir(Index)
            Case DIR_UP
                If (Player(Index).YOffset < PIC_Y / 2) Then Anim = 1
            Case DIR_DOWN
                If (Player(Index).YOffset < PIC_Y / 2 * -1) Then Anim = 1
            Case DIR_LEFT
                If (Player(Index).XOffset < PIC_Y / 2) Then Anim = 1
            Case DIR_RIGHT
                If (Player(Index).XOffset < PIC_Y / 2 * -1) Then Anim = 1
        End Select
    Else
        If Player(Index).AttackTimer + Int(AttackSpeed / 2) > GetTickCount Then
            Anim = 2
        End If
    End If
   
    ' Check to see if we want to stop making him attack
    If Player(Index).AttackTimer + AttackSpeed < GetTickCount Then
        Player(Index).Attacking = 0
        Player(Index).AttackTimer = 0
    End If
   
    rec.Top = GetPlayerSprite(Index) * SIZE_Y
    rec.Bottom = rec.Top + (SIZE_Y - PIC_Y)
    rec.Left = (GetPlayerDir(Index) * (3 * (SIZE_X / PIC_X)) + (Anim * (SIZE_X / PIC_X))) * PIC_X
    rec.Right = rec.Left + SIZE_X

    x = GetPlayerX(Index) * PIC_X - (SIZE_X - PIC_X) / 2 + sx + Player(Index).XOffset
    y = GetPlayerY(Index) * PIC_Y - (SIZE_Y - PIC_Y) + sx + Player(Index).YOffset
   
   
    If y < 0 Then
        y = 0
        If GetPlayerDir(Index) = DIR_DOWN And Player(Index).Moving > 0 Then
            rec.Top = rec.Top - Player(Index).YOffset
        Else
            rec.Top = rec.Top - Player(Index).YOffset + (SIZE_Y - PIC_Y)
        End If
    End If
   
    If SIZE_X > PIC_X Then
        If x < 0 Then
            x = Player(Index).XOffset + sx + ((SIZE_X - PIC_X) / 2)
            If GetPlayerDir(Index) = DIR_RIGHT And Player(Index).Moving > 0 Then
                rec.Left = rec.Left - Player(Index).XOffset
            Else
                rec.Left = rec.Left - Player(Index).XOffset + ((SIZE_X - PIC_X) / 2)
            End If
        End If
       
        If x > MAX_MAPX * 32 Then
            x = MAX_MAPX * 32 + sx - ((SIZE_X - PIC_X) / 2) + Player(Index).XOffset
            If GetPlayerDir(Index) = DIR_LEFT And Player(Index).Moving > 0 Then
                rec.Right = rec.Right + Player(Index).XOffset
            Else
                rec.Right = rec.Right + Player(Index).XOffset - ((SIZE_X - PIC_X) / 2)
            End If
        End If
    End If
   
    Call DD_BackBuffer.BltFast(x - (NewPlayerX * PIC_X) - NewXOffset, y - (NewPlayerY * PIC_Y) - NewYOffset, DD_SpriteSurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
End Sub

Author:  Robin [ Wed Apr 30, 2008 10:10 pm ]
Post subject:  Re: 32x64 problem + graphic question

What source do you use?

Author:  Gierek [ Thu May 01, 2008 9:18 am ]
Post subject:  Re: 32x64 problem + graphic question

Elysium Diamond 2.0

Author:  Robin [ Thu May 01, 2008 11:43 am ]
Post subject:  Re: 32x64 problem + graphic question

Right, I suggest you tell us that before hand as this is a Mirage forum, so we assume that you're using Mirage Source.

Author:  Rory [ Thu May 01, 2008 12:21 pm ]
Post subject:  Re: 32x64 problem + graphic question

Gierek wrote:
Ups, I didn't say sth :D
I use Elysium Diamond and I think, ekhm, Im sure that bltplayertop is there;]


Eh.. Robin

Author:  Robin [ Thu May 01, 2008 12:24 pm ]
Post subject:  Re: 32x64 problem + graphic question

He posted that after me. :D

Author:  Lea [ Thu May 01, 2008 1:06 pm ]
Post subject:  Re: 32x64 problem + graphic question

Agreed. Looking at it, the problem seems to be the way their code interferes with the tutorial here. I suggest you ask them :)

Page 1 of 3 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/