Mirage Source http://www.miragesource.net/forums/ |
|
bltPlayer & bltPlayerTop http://www.miragesource.net/forums/viewtopic.php?f=201&t=544 |
Page 1 of 2 |
Author: | William [ Sat Sep 23, 2006 3:49 pm ] |
Post subject: | bltPlayer & bltPlayerTop |
Im in need of some help, I can't seem to get a thing working. You see, when my player walks to the very top of the map, halv of him dissapears, I believe many have had the same problem. And the same goes when he walks to the very left, but only certain equipment dissapears then. 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 = Item(GetPlayerInvItemNum(Index, GetPlayerWeaponSlot(Index))).AttackSpeed Else AttackSpeed = 1000 End If ' 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 If Player(Index).Attacking = 0 Then Select Case GetPlayerDir(Index) Case DIR_UP If (Player(Index).YOffset < PIC_Y / 1) Then Anim = 1 End If If (Player(Index).YOffset < PIC_Y / 2) Then Anim = 2 End If If (Player(Index).YOffset < PIC_Y / 8) Then Anim = 0 End If Case DIR_DOWN If (Player(Index).YOffset > (PIC_Y / 1) * -1) Then Anim = 1 End If If (Player(Index).YOffset > (PIC_Y / 2) * -1) Then Anim = 2 End If If (Player(Index).YOffset > (PIC_Y / 8) * -1) Then Anim = 0 End If Case DIR_LEFT If (Player(Index).XOffset < PIC_Y / 1) Then Anim = 1 End If If (Player(Index).XOffset < PIC_Y / 2) Then Anim = 0 End If Case DIR_RIGHT If (Player(Index).XOffset < PIC_Y / 2 * -1) Then Anim = 1 End If End Select Else If Player(Index).AttackTimer + AttackSpeed > GetTickCount Then Anim = 3 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.Left = (GetPlayerDir(Index) * 4 + Anim) * PIC_X rec.Right = rec.Left + PIC_X 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 With rec .top = .top + (Y * -1) End With End If If GetPlayerDir(Index) = DIR_DOWN Then If Player(Index).Wing > 0 Then If GetPlayerAccess(Index) < 1 Then rec.top = 170 * PIC_Y + 32 ElseIf GetPlayerAccess(Index) > 0 Then rec.top = 172 * PIC_Y + 32 End If rec.Bottom = rec.top + PIC_Y rec.Left = (GetPlayerDir(Index) * 4 + Anim) * 64 rec.Right = rec.Left + PIC_X + 32 Call DD_BackBuffer.BltFast(X - 16, Y, DD_ItemSurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY) End If If Player(Index).Cape > 0 Then rec.top = Item(Player(Index).Cape).Pic * PIC_Y + 32 rec.Bottom = rec.top + PIC_Y rec.Left = (GetPlayerDir(Index) * 4 + Anim) * PIC_X rec.Right = rec.Left + PIC_X Call DD_BackBuffer.BltFast(X, Y, DD_ItemSurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY) End If End If If GetPlayerDir(Index) = DIR_UP Then If Player(Index).Shield > 0 Then rec.top = Item(Player(Index).Shield).Pic * PIC_Y + 32 rec.Bottom = rec.top + PIC_Y rec.Left = (GetPlayerDir(Index) * 4 + Anim) * PIC_X rec.Right = rec.Left + PIC_X Call DD_BackBuffer.BltFast(X, Y, DD_ItemSurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY) End If 'If Item(Player(Index).Weapon).Pic <= 19 Then ' Sword If Player(Index).Weapon > 0 Then rec.top = Item(Player(Index).Weapon).Pic * PIC_Y + 32 rec.Bottom = rec.top + PIC_Y rec.Left = (GetPlayerDir(Index) * 4 + Anim) * 64 rec.Right = rec.Left + PIC_X + 32 Call DD_BackBuffer.BltFast(X - 16, Y, DD_ItemSurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY) End If End If If GetPlayerDir(Index) = DIR_LEFT Then If Player(Index).Weapon > 0 Then rec.top = Item(Player(Index).Weapon).Pic * PIC_Y + 32 rec.Bottom = rec.top + PIC_Y rec.Left = (GetPlayerDir(Index) * 4 + Anim) * 64 rec.Right = rec.Left + PIC_X + 32 Call DD_BackBuffer.BltFast(X - 16, Y, DD_ItemSurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY) End If End If If GetPlayerDir(Index) = DIR_RIGHT Then If Player(Index).Shield > 0 Then rec.top = Item(Player(Index).Shield).Pic * PIC_Y + 32 rec.Bottom = rec.top + PIC_Y rec.Left = (GetPlayerDir(Index) * 4 + Anim) * PIC_X rec.Right = rec.Left + PIC_X Call DD_BackBuffer.BltFast(X, Y, DD_ItemSurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY) End If End If rec.top = GetPlayerSprite(Index) * PIC_Y rec.Bottom = rec.top + PIC_Y + 32 rec.Left = (GetPlayerDir(Index) * 4 + Anim) * PIC_X rec.Right = rec.Left + PIC_X 'Call DD_BackBuffer.BltFast(X, Y - 32, DD_SpriteSurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY) ''' With rec .top = GetPlayerSprite(Index) * PIC_Y + 32 .Bottom = .top + PIC_Y .Left = (GetPlayerDir(Index) * 4 + Anim) * PIC_X .Right = .Left + PIC_X End With '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 ' With rec ' .top = .top + (Y * -1) ' End With 'End If rec.top = (GetPlayerBody(Index) * 2) * PIC_Y + 32 rec.Bottom = rec.top + PIC_Y Call DD_BackBuffer.BltFast(X, Y, DD_BodySurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY) If GetPlayerDir(Index) = DIR_LEFT Or GetPlayerDir(Index) = DIR_RIGHT Then If Player(Index).Cape > 0 Then rec.top = Item(Player(Index).Cape).Pic * PIC_Y + 32 rec.Bottom = rec.top + PIC_Y rec.Left = (GetPlayerDir(Index) * 4 + Anim) * PIC_X rec.Right = rec.Left + PIC_X Call DD_BackBuffer.BltFast(X, Y, DD_ItemSurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY) End If If Player(Index).Wing > 0 Then If GetPlayerAccess(Index) < 1 Then rec.top = 170 * PIC_Y + 32 ElseIf GetPlayerAccess(Index) > 0 Then rec.top = 172 * PIC_Y + 32 End If rec.Bottom = rec.top + PIC_Y rec.Left = (GetPlayerDir(Index) * 4 + Anim) * 64 rec.Right = rec.Left + PIC_X + 32 Call DD_BackBuffer.BltFast(X - 16, Y, DD_ItemSurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY) End If End If If Player(Index).Armor > 0 Then rec.top = Item(Player(Index).Armor).Pic * PIC_Y + 32 rec.Bottom = rec.top + PIC_Y rec.Left = (GetPlayerDir(Index) * 4 + Anim) * PIC_X rec.Right = rec.Left + PIC_X Call DD_BackBuffer.BltFast(X, Y, DD_ItemSurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY) End If 'ElseIf Player(Index).Armor <= 0 Then ' rec.top = (GetPlayerBody(Index) * 2) * PIC_Y ' rec.Bottom = rec.top + PIC_Y + 32 ' Call DD_BackBuffer.BltFast(X, Y - 32, DD_BodySurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY) 'End If If GetPlayerDir(Index) = DIR_LEFT Then If Player(Index).Shield > 0 Then rec.top = Item(Player(Index).Shield).Pic * PIC_Y + 32 rec.Bottom = rec.top + PIC_Y rec.Left = (GetPlayerDir(Index) * 4 + Anim) * PIC_X rec.Right = rec.Left + PIC_X Call DD_BackBuffer.BltFast(X, Y, DD_ItemSurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY) End If End If If GetPlayerDir(Index) = DIR_RIGHT Then If Player(Index).Weapon > 0 Then rec.top = Item(Player(Index).Weapon).Pic * PIC_Y + 32 rec.Bottom = rec.top + PIC_Y rec.Left = (GetPlayerDir(Index) * 4 + Anim) * 64 rec.Right = rec.Left + PIC_X + 32 Call DD_BackBuffer.BltFast(X - 16, Y, DD_ItemSurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY) End If End If If GetPlayerDir(Index) = DIR_DOWN Then If Player(Index).Weapon > 0 Then rec.top = Item(Player(Index).Weapon).Pic * PIC_Y + 32 rec.Bottom = rec.top + PIC_Y rec.Left = (GetPlayerDir(Index) * 4 + Anim) * 64 rec.Right = rec.Left + PIC_X + 32 Call DD_BackBuffer.BltFast(X - 16, Y, DD_ItemSurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY) End If If Player(Index).Shield > 0 Then rec.Left = (GetPlayerDir(Index) * 4 + Anim) * PIC_X rec.Right = rec.Left + PIC_X rec.top = Item(Player(Index).Shield).Pic * PIC_Y + 32 rec.Bottom = rec.top + PIC_Y Call DD_BackBuffer.BltFast(X, Y, DD_ItemSurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY) End If End If If GetPlayerDir(Index) = DIR_UP Then If Player(Index).Cape > 0 Then rec.top = Item(Player(Index).Cape).Pic * PIC_Y + 32 rec.Bottom = rec.top + PIC_Y rec.Left = (GetPlayerDir(Index) * 4 + Anim) * PIC_X rec.Right = rec.Left + PIC_X Call DD_BackBuffer.BltFast(X, Y, DD_ItemSurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY) End If If Player(Index).Wing > 0 Then If GetPlayerAccess(Index) < 1 Then rec.top = 170 * PIC_Y + 32 ElseIf GetPlayerAccess(Index) > 0 Then rec.top = 172 * PIC_Y + 32 End If rec.Bottom = rec.top + PIC_Y rec.Left = (GetPlayerDir(Index) * 4 + Anim) * 64 rec.Right = rec.Left + PIC_X + 32 Call DD_BackBuffer.BltFast(X - 16, Y, DD_ItemSurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY) End If End If End Sub bltPlayerTop Code: Public 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 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 If Player(Index).Attacking = 0 Then Select Case GetPlayerDir(Index) Case DIR_UP If (Player(Index).YOffset < PIC_Y / 1) Then Anim = 1 End If If (Player(Index).YOffset < PIC_Y / 2) Then Anim = 2 End If If (Player(Index).YOffset < PIC_Y / 8) Then Anim = 0 End If Case DIR_DOWN If (Player(Index).YOffset > (PIC_Y / 1) * -1) Then Anim = 1 End If If (Player(Index).YOffset > (PIC_Y / 2) * -1) Then Anim = 2 End If If (Player(Index).YOffset > (PIC_Y / 8) * -1) Then Anim = 0 End If Case DIR_LEFT If (Player(Index).XOffset < PIC_Y / 1) Then Anim = 1 End If If (Player(Index).XOffset < PIC_Y / 2) Then Anim = 0 End If Case DIR_RIGHT If (Player(Index).XOffset < PIC_Y / 2 * -1) Then Anim = 1 End If End Select Else If Player(Index).AttackTimer + AttackSpeed > GetTickCount Then Anim = 3 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.Left = (GetPlayerDir(Index) * 4 + Anim) * PIC_X rec.Right = rec.Left + PIC_X 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 With rec .top = .top + (Y * -1) End With End If If GetPlayerDir(Index) = DIR_DOWN Then If Player(Index).Wing > 0 Then If GetPlayerAccess(Index) < 1 Then rec.top = 170 * PIC_Y ElseIf GetPlayerAccess(Index) > 0 Then rec.top = 172 * PIC_Y End If rec.Bottom = rec.top + PIC_Y rec.Left = (GetPlayerDir(Index) * 4 + Anim) * 64 rec.Right = rec.Left + PIC_X + 32 Call DD_BackBuffer.BltFast(X - 16, Y - 32, DD_ItemSurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY) End If If Player(Index).Cape > 0 Then rec.top = Item(Player(Index).Cape).Pic * PIC_Y rec.Bottom = rec.top + PIC_Y rec.Left = (GetPlayerDir(Index) * 4 + Anim) * PIC_X rec.Right = rec.Left + PIC_X Call DD_BackBuffer.BltFast(X, Y - 32, DD_ItemSurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY) End If End If If GetPlayerDir(Index) = DIR_UP Then If Player(Index).Shield > 0 Then rec.top = Item(Player(Index).Shield).Pic * PIC_Y rec.Bottom = rec.top + PIC_Y rec.Left = (GetPlayerDir(Index) * 4 + Anim) * PIC_X rec.Right = rec.Left + PIC_X Call DD_BackBuffer.BltFast(X, Y - 32, DD_ItemSurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY) End If 'If Item(Player(Index).Weapon).Pic <= 19 Then ' Sword If Player(Index).Weapon > 0 Then rec.top = Item(Player(Index).Weapon).Pic * PIC_Y rec.Bottom = rec.top + PIC_Y rec.Left = (GetPlayerDir(Index) * 4 + Anim) * 64 rec.Right = rec.Left + PIC_X + 32 Call DD_BackBuffer.BltFast(X - 16, Y - 32, DD_ItemSurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY) End If End If If GetPlayerDir(Index) = DIR_LEFT Then If Player(Index).Weapon > 0 Then rec.top = Item(Player(Index).Weapon).Pic * PIC_Y rec.Bottom = rec.top + PIC_Y rec.Left = (GetPlayerDir(Index) * 4 + Anim) * 64 rec.Right = rec.Left + PIC_X + 32 Call DD_BackBuffer.BltFast(X - 16, Y - 32, DD_ItemSurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY) End If End If If GetPlayerDir(Index) = DIR_RIGHT Then If Player(Index).Shield > 0 Then rec.top = Item(Player(Index).Shield).Pic * PIC_Y rec.Bottom = rec.top + PIC_Y rec.Left = (GetPlayerDir(Index) * 4 + Anim) * PIC_X rec.Right = rec.Left + PIC_X Call DD_BackBuffer.BltFast(X, Y - 32, DD_ItemSurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY) End If End If rec.top = GetPlayerSprite(Index) * PIC_Y rec.Bottom = rec.top + PIC_Y + 32 rec.Left = (GetPlayerDir(Index) * 4 + Anim) * PIC_X rec.Right = rec.Left + PIC_X 'Call DD_BackBuffer.BltFast(X, Y - 32, DD_SpriteSurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY) ''' With rec .top = GetPlayerSprite(Index) * PIC_Y + 32 .Bottom = .top + PIC_Y .Left = (GetPlayerDir(Index) * 4 + Anim) * PIC_X .Right = .Left + PIC_X End With '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 ' With rec ' .top = .top + (Y * -1) ' End With 'End If rec.top = (GetPlayerBody(Index) * 2) * PIC_Y rec.Bottom = rec.top + PIC_Y Call DD_BackBuffer.BltFast(X, Y - 32, DD_BodySurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY) If GetPlayerDir(Index) = DIR_LEFT Or GetPlayerDir(Index) = DIR_RIGHT Then If Player(Index).Cape > 0 Then rec.top = Item(Player(Index).Cape).Pic * PIC_Y rec.Bottom = rec.top + PIC_Y rec.Left = (GetPlayerDir(Index) * 4 + Anim) * PIC_X rec.Right = rec.Left + PIC_X Call DD_BackBuffer.BltFast(X, Y - 32, DD_ItemSurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY) End If If Player(Index).Wing > 0 Then If GetPlayerAccess(Index) < 1 Then rec.top = 170 * PIC_Y ElseIf GetPlayerAccess(Index) > 0 Then rec.top = 172 * PIC_Y End If rec.Bottom = rec.top + PIC_Y rec.Left = (GetPlayerDir(Index) * 4 + Anim) * 64 rec.Right = rec.Left + PIC_X + 32 Call DD_BackBuffer.BltFast(X - 16, Y - 32, DD_ItemSurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY) End If End If If Player(Index).Armor > 0 Then rec.top = Item(Player(Index).Armor).Pic * PIC_Y rec.Bottom = rec.top + PIC_Y rec.Left = (GetPlayerDir(Index) * 4 + Anim) * PIC_X rec.Right = rec.Left + PIC_X Call DD_BackBuffer.BltFast(X, Y - 32, DD_ItemSurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY) End If 'ElseIf Player(Index).Armor <= 0 Then ' rec.top = (GetPlayerBody(Index) * 2) * PIC_Y ' rec.Bottom = rec.top + PIC_Y + 32 ' Call DD_BackBuffer.BltFast(X, Y - 32, DD_BodySurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY) 'End If If Player(Index).Helmet > 0 Then rec.top = Item(Player(Index).Helmet).Pic * PIC_Y rec.Bottom = rec.top + PIC_Y rec.Left = (GetPlayerDir(Index) * 4 + Anim) * PIC_X rec.Right = rec.Left + PIC_X Call DD_BackBuffer.BltFast(X, Y - 37, DD_ItemSurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY) ElseIf Player(Index).Helmet <= 0 Then rec.top = GetPlayerHair(Index) * (PIC_Y) + 32 rec.Bottom = rec.top + PIC_Y rec.Left = (GetPlayerDir(Index) * 4 + Anim) * PIC_X rec.Right = rec.Left + PIC_X Call DD_BackBuffer.BltFast(X, Y - 37, DD_HairSurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY) End If If GetPlayerDir(Index) = DIR_LEFT Then If Player(Index).Shield > 0 Then rec.top = Item(Player(Index).Shield).Pic * PIC_Y rec.Bottom = rec.top + PIC_Y rec.Left = (GetPlayerDir(Index) * 4 + Anim) * PIC_X rec.Right = rec.Left + PIC_X Call DD_BackBuffer.BltFast(X, Y - 32, DD_ItemSurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY) End If End If If GetPlayerDir(Index) = DIR_RIGHT Then If Player(Index).Weapon > 0 Then rec.top = Item(Player(Index).Weapon).Pic * PIC_Y rec.Bottom = rec.top + PIC_Y rec.Left = (GetPlayerDir(Index) * 4 + Anim) * 64 rec.Right = rec.Left + PIC_X + 32 Call DD_BackBuffer.BltFast(X - 16, Y - 32, DD_ItemSurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY) End If End If If GetPlayerDir(Index) = DIR_DOWN Then If Player(Index).Weapon > 0 Then rec.top = Item(Player(Index).Weapon).Pic * PIC_Y rec.Bottom = rec.top + PIC_Y rec.Left = (GetPlayerDir(Index) * 4 + Anim) * 64 rec.Right = rec.Left + PIC_X + 32 Call DD_BackBuffer.BltFast(X - 16, Y - 32, DD_ItemSurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY) End If If Player(Index).Shield > 0 Then rec.Left = (GetPlayerDir(Index) * 4 + Anim) * PIC_X rec.Right = rec.Left + PIC_X rec.top = Item(Player(Index).Shield).Pic * PIC_Y rec.Bottom = rec.top + PIC_Y Call DD_BackBuffer.BltFast(X, Y - 32, DD_ItemSurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY) End If End If If GetPlayerDir(Index) = DIR_UP Then If Player(Index).Cape > 0 Then rec.top = Item(Player(Index).Cape).Pic * PIC_Y rec.Bottom = rec.top + PIC_Y rec.Left = (GetPlayerDir(Index) * 4 + Anim) * PIC_X rec.Right = rec.Left + PIC_X Call DD_BackBuffer.BltFast(X, Y - 32, DD_ItemSurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY) End If If Player(Index).Wing > 0 Then If GetPlayerAccess(Index) < 1 Then rec.top = 170 * PIC_Y ElseIf GetPlayerAccess(Index) > 0 Then rec.top = 172 * PIC_Y End If rec.Bottom = rec.top + PIC_Y rec.Left = (GetPlayerDir(Index) * 4 + Anim) * 64 rec.Right = rec.Left + PIC_X + 32 Call DD_BackBuffer.BltFast(X - 16, Y - 32, DD_ItemSurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY) End If End If End Sub I hope you can help me out :) By the way, im like 100% sure it has to do with this: Code: ' 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 |
Author: | Misunderstood [ Sat Sep 23, 2006 4:34 pm ] |
Post subject: | |
ugh I hate how ms has that bug in it, though with ms it isnt a bug since it never gets called, when people add 32x64 it turns into a bug Code: ' 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 you set y to 0. So the next line is just setting .top to .top because 0*-1 is 0. FUCKIN ZERO....GAHHHHH. (it angers me ) so put the y after the with... There might be other problems, but start with that |
Author: | pingu [ Sat Sep 23, 2006 4:47 pm ] |
Post subject: | |
I made an old tutorial for Elysium on how to fix that "bug" you get when you get near the top. It's what you are looking for, but you'll have to extract the information you need from it. http://www.splamm.com/elysium/forums/vi ... .php?t=704 Yeah, the subs that I coded for Elysium work all the time when your player goes above the screen for any size. I'm not sure about the sides when it is greater than 32, though. |
Author: | William [ Sat Sep 23, 2006 4:52 pm ] |
Post subject: | |
@Misunderstood: It didn't do any difference, here is what it looks like: And here is the new code: Code: If Y < 0 Then With rec .top = .top + (Y * -1) End With Y = 0 End If @Pingu: So your saying that I should use this: Code: x = GetPlayerX(Index) * PIC_X + sx + Player(Index).XOffset
y = GetPlayerY(Index) * PIC_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 + PIC_Y End If End If |
Author: | pingu [ Sat Sep 23, 2006 5:07 pm ] |
Post subject: | |
William wrote: @Pingu: So your saying that I should use this:
Code: x = GetPlayerX(Index) * PIC_X + sx + Player(Index).XOffset y = GetPlayerY(Index) * PIC_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 + PIC_Y End If End If Trying wouldn't hurt. Just do it for the sprite only first and then make it work with the items later. I'm assuming you have scrolling going and it uses the same variables to work. |
Author: | William [ Sat Sep 23, 2006 5:16 pm ] |
Post subject: | |
I dont really have scrolling atm, well I have it, but I just grabbed some wierd tut and it has a bug.. Since I cant find a bug free =/ Well anyhow.. let me test it now... hmm, works pretty well. Thank you. Now I check the x too, might work fine |
Author: | Misunderstood [ Sat Sep 23, 2006 6:09 pm ] |
Post subject: | |
my 32x64 tut for MS works |
Author: | William [ Sat Sep 23, 2006 8:43 pm ] |
Post subject: | |
Misunderstood wrote: my 32x64 tut for MS works
Well, my works to now So mission Closed. Thanks guys |
Author: | Dragoons Master [ Sat Sep 23, 2006 11:59 pm ] |
Post subject: | |
I have 64X64 npc on my game and I had the same problem. I solved it on a much easiest way. Instead of bliting top and bottom, why just blit on the right order? That's my code(you dont need to change anything on your BltNpc sub): Code: For Y = 0 To MAX_MAPY
For i = 1 To MAX_MAP_NPCS If MapNpc(i).Y = Y Then Call BltNpc(i) End If Next i Next Y |
Author: | Misunderstood [ Sun Sep 24, 2006 12:39 am ] |
Post subject: | |
I don't get what your saying DM, and if I do, it wont work and your way is slow, looping through so many extra times. It just seems like a waste to me. |
Author: | Kenko [ Sun Sep 24, 2006 12:40 am ] |
Post subject: | |
Because, if the player is big enough, his head will be under the npc. |
Author: | pingu [ Sun Sep 24, 2006 12:47 am ] |
Post subject: | |
Yeah, blitting the head needs to be in it's own loop because otherwise people could walk on top of other's heads. |
Author: | Dragoons Master [ Sun Sep 24, 2006 1:25 am ] |
Post subject: | |
Misunderstood wrote: I don't get what your saying DM, and if I do, it wont work and your way is slow, looping through so many extra times. It just seems like a waste to me.
It works and works perfectly. Sure it does loop a few times but its not slow at all, player dont notice it doesn't slowed my fps even 1 point... I'm already using it on my game for a while. |
Page 1 of 2 | All times are UTC |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |