Sprites issue. - wisefire - 31-12-2008
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..
![[Image: spritesnh5.png]](http://img201.imageshack.us/img201/4839/spritesnh5.png)
If you have an idea on just how I can do this, It'd be highly appreciated if you would reply.
Re: Sprites issue. - Labmonkey - 31-12-2008
its just some simple offsetting in the bltsprite code. Post your bltPlayer code, and ill fix it and send it back.
Re: Sprites issue. - wisefire - 31-12-2008
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
Re: Sprites issue. - Tony - 31-12-2008
Mess with this
x = GetPlayerX(Index) * PIC_X + Player(Index).xOffset - 32
y = GetPlayerY(Index) * PIC_Y + Player(Index).yOffset
Re: Sprites issue. - wisefire - 31-12-2008
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.
Re: Sprites issue. - Doomy - 31-12-2008
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
Re: Sprites issue. - wisefire - 31-12-2008
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
|