| Mirage Source http://www.miragesource.net/forums/ |
|
| Sprites issue. http://www.miragesource.net/forums/viewtopic.php?f=201&t=4902 |
Page 1 of 1 |
| Author: | wisefire [ Wed Dec 31, 2008 12:05 am ] |
| Post subject: | Sprites issue. |
Okay, 32x64 Sprites are what I was using. I am switching to 64x64, yet keeping the same 32x64 sprite, just centering it. This allows me have larger ingame items(Wings, Weapons, Etc.). I finished the 64x64. Although now the player is centered in between two tiles when Blted. I need players to be on one tile, With pixels overlapping the tiles on the sides. Heres an image showing how it is, and how it needs to be.. If you have an idea on just how I can do this, It'd be highly appreciated if you would reply. |
|
| Author: | Labmonkey [ Wed Dec 31, 2008 1:46 am ] |
| Post subject: | Re: Sprites issue. |
its just some simple offsetting in the bltsprite code. Post your bltPlayer code, and ill fix it and send it back. |
|
| Author: | wisefire [ Wed Dec 31, 2008 2:13 am ] |
| Post subject: | Re: Sprites issue. |
It's not a normal BltPlayer code.. There's a lot of sprites per sheet, 36... Although here you go. Code: Sub BltPlayer(ByVal Index As Long)
Dim Anim As Byte Dim x As Long, y As Long ' Only used if ever want to switch to blt rather then bltfast With rec_pos .Top = GetPlayerY(Index) * PIC_Y + Player(Index).yOffset .Bottom = .Top + PIC_Y .Left = GetPlayerX(Index) * PIC_X + Player(Index).xOffset .Right = .Left + PIC_X End With ' Check for animation Anim = 0 If Player(Index).Attacking = 0 Then Select Case GetPlayerDir(Index) Case DIR_UP Anim = 0 If (Player(Index).yOffset < PIC_Y / 3) Then Anim = 0 ElseIf (Player(Index).yOffset > PIC_Y / 3) And ((Player(Index).yOffset > PIC_Y / 3 * 2)) Then Anim = 1 ElseIf (Player(Index).yOffset > PIC_Y / 3) And ((Player(Index).yOffset > PIC_Y / 3 * 1)) Then Anim = 2 End If If Player(Index).Sitting = 1 Then Anim = 8 End If Case DIR_DOWN Anim = 0 If (Player(Index).yOffset < PIC_X / 6 * -1) Then Anim = 1 If (Player(Index).yOffset < PIC_X / 4 * -1) Then Anim = 2 If Player(Index).Sitting = 1 Then Anim = 8 End If Case DIR_LEFT Anim = 0 If (Player(Index).xOffset < PIC_Y / 3) Then Anim = 0 ElseIf (Player(Index).xOffset > PIC_Y / 3) And ((Player(Index).xOffset > PIC_Y / 3 * 4)) Then Anim = 4 ElseIf (Player(Index).xOffset > PIC_Y / 3) And ((Player(Index).xOffset > PIC_Y / 3 * 3)) Then Anim = 3 ElseIf (Player(Index).xOffset > PIC_Y / 3) And ((Player(Index).xOffset > PIC_Y / 3 * 2)) Then Anim = 2 ElseIf (Player(Index).xOffset > PIC_Y / 3) And ((Player(Index).xOffset > PIC_Y / 3 * 1)) Then Anim = 1 End If If Player(Index).Sitting = 1 Then Anim = 8 End If Case DIR_RIGHT Anim = 0 If (Player(Index).xOffset < PIC_Y / 5 * -1) Then Anim = 4 If (Player(Index).xOffset < PIC_Y / 4 * -1) Then Anim = 3 If (Player(Index).xOffset < PIC_Y / 3 * -1) Then Anim = 2 If (Player(Index).xOffset < PIC_Y / 2 * -1) Then Anim = 1 If Player(Index).Sitting = 1 Then Anim = 8 End If End Select Else If Player(Index).AttackTimer + 500 > GetTickCount Then Anim = 6 If Player(Index).AttackTimer + 400 > GetTickCount Then Anim = 5 End If End If End If ' Check to see if we want to stop making him attack If Player(Index).AttackTimer + 1000 < GetTickCount Then Player(Index).Attacking = 0 Player(Index).AttackTimer = 0 End If rec.Top = GetPlayerSprite(Index) * 64 + 32 rec.Bottom = rec.Top + 32 rec.Left = (GetPlayerDir(Index) * 9 + Anim) * 64 rec.Right = rec.Left + 64 x = GetPlayerX(Index) * PIC_X + Player(Index).xOffset y = GetPlayerY(Index) * PIC_Y + Player(Index).yOffset - 4 ' Check if its out of bounds because of the offset If y < 0 Then y = 0 rec.Top = rec.Top + (y * -1) End If rec.Top = GetPlayerSprite(Index) * PIC_Y + PIC_Y rec.Bottom = rec.Top + PIC_Y Call DD_BackBuffer.BltFast(x, y, DD_SpriteSurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY) End Sub |
|
| Author: | Tony [ Wed Dec 31, 2008 2:18 am ] |
| Post subject: | Re: Sprites issue. |
Mess with this x = GetPlayerX(Index) * PIC_X + Player(Index).xOffset - 32 y = GetPlayerY(Index) * PIC_Y + Player(Index).yOffset |
|
| Author: | wisefire [ Wed Dec 31, 2008 4:55 am ] |
| Post subject: | Re: Sprites issue. |
TonyNooblet wrote: Mess with this x = GetPlayerX(Index) * PIC_X + Player(Index).xOffset - 32 y = GetPlayerY(Index) * PIC_Y + Player(Index).yOffset Worked perfect! I owe you one, Thanks a lot. |
|
| Author: | Doomy [ Wed Dec 31, 2008 5:20 am ] |
| Post subject: | Re: Sprites issue. |
wisefire wrote: TonyNooblet wrote: Mess with this x = GetPlayerX(Index) * PIC_X + Player(Index).xOffset - 32 y = GetPlayerY(Index) * PIC_Y + Player(Index).yOffset Worked perfect! I owe you one, Thanks a lot. can you tell me what you did i wanted to know this too |
|
| Author: | wisefire [ Wed Dec 31, 2008 7:38 am ] |
| Post subject: | Re: Sprites issue. |
doomteam1 wrote: can you tell me what you did i wanted to know this too In BltPlayer I changed Code: x = GetPlayerX(Index) * PIC_X + Player(Index).xOffset y = GetPlayerY(Index) * PIC_Y + Player(Index).yOffset - 4 to Code: x = GetPlayerX(Index) * PIC_X + Player(Index).xOffset - 16 y = GetPlayerY(Index) * PIC_Y + Player(Index).yOffset and Code: rec.Top = GetPlayerSprite(Index) rec.Bottom = rec.Top rec.Left = (GetPlayerDir(Index) * 9 + Anim) rec.Right = rec.Left to Code: rec.Top = GetPlayerSprite(Index) * 64 + 32
rec.Bottom = rec.Top + 32 rec.Left = (GetPlayerDir(Index) * 9 + Anim) * 64 rec.Right = rec.Left + 64 |
|
| Page 1 of 1 | All times are UTC |
| Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |
|