| Mirage Source http://miragesource.net/forums/ |
|
| bltNPCTOP http://miragesource.net/forums/viewtopic.php?f=201&t=1528 |
Page 1 of 1 |
| Author: | Rian [ Sun Mar 18, 2007 7:08 pm ] |
| Post subject: | bltNPCTOP |
Blting still isn't my thing. When my npcs are at y1, the top half doesn't blt and I compare the code to bltplayer top, and everything seems identical hlp plz i'm newb [edit] Oh, and also, they don't blt at all if the reach the very edge of the right side of the map |
|
| Author: | Robin [ Sun Mar 18, 2007 7:34 pm ] |
| Post subject: | |
You're gonna need to change the width and height and top and left of where you are getting the graphics from (the layer) to make it so you aren't trying to blt anything off the side of the picture box. |
|
| Author: | William [ Sun Mar 18, 2007 8:10 pm ] |
| Post subject: | |
try: 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: | Rian [ Sun Mar 18, 2007 8:18 pm ] |
| Post subject: | |
Still can't get it to work. I already had that code in there William. Kite, I see what you mean, but my 32x64 npc is on y1, so I don't see how I'm trying to draw anything outside the picture box. However, it's my 64x64 npcs that are disapearing on the very right side of the map. |
|
| Author: | Robin [ Sun Mar 18, 2007 8:21 pm ] |
| Post subject: | |
Sonire wrote: Still can't get it to work.
I already had that code in there William. Kite, I see what you mean, but my 32x64 npc is on y1, so I don't see how I'm trying to draw anything outside the picture box. However, it's my 64x64 npcs that are disappearing on the very right side of the map. Well, took me ages to fix this (I had it from my 96x64 sprites in Nr) and I think I just needed to change Williams code to accommodate for all the different faces of the box. |
|
| Author: | William [ Sun Mar 18, 2007 8:24 pm ] |
| Post subject: | |
This is what I have, and it works fine: Code: Public Sub BltNpcTop(ByVal MapNpcNum As Long)
Dim Anim As Byte Dim X As Long, y As Long ' Make sure that theres an npc there, and if not exit the sub If MapNpc(MapNpcNum).num <= 0 Then Exit Sub End If ' Only used if ever want to switch to blt rather then bltfast With rec_pos .top = MapNpc(MapNpcNum).y * PIC_Y + MapNpc(MapNpcNum).YOffset .Bottom = .top + PIC_Y .Left = MapNpc(MapNpcNum).X * PIC_X + MapNpc(MapNpcNum).XOffset .Right = .Left + PIC_X End With ' Check for animation Anim = 0 If MapNpc(MapNpcNum).Attacking = 0 Then Select Case MapNpc(MapNpcNum).Dir Case DIR_UP If (MapNpc(MapNpcNum).YOffset < PIC_Y / 2) Then Anim = 1 Case DIR_DOWN If (MapNpc(MapNpcNum).YOffset < PIC_Y / 2 * -1) Then Anim = 1 Case DIR_LEFT If (MapNpc(MapNpcNum).XOffset < PIC_Y / 2) Then Anim = 1 Case DIR_RIGHT If (MapNpc(MapNpcNum).XOffset < PIC_Y / 2 * -1) Then Anim = 1 End Select Else If MapNpc(MapNpcNum).AttackTimer + 500 > GetTickCount Then Anim = 2 End If End If ' Check to see if we want to stop making him attack With MapNpc(MapNpcNum) If .AttackTimer + 1000 < GetTickCount Then .Attacking = 0 .AttackTimer = 0 End If End With With rec .top = Npc(MapNpc(MapNpcNum).num).Sprite * PIC_Y .Bottom = .top + PIC_Y .Left = (MapNpc(MapNpcNum).Dir * 3 + Anim) * PIC_X .Right = .Left + PIC_X End With With MapNpc(MapNpcNum) X = .X * PIC_X + .XOffset y = .y * PIC_Y + .YOffset ' - 4 BJORN End With ' 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 Call DD_BackBuffer.BltFast(X, y - ESIZE_YTOP, DD_SpriteSurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY) End Sub |
|
| Author: | Rian [ Sun Mar 18, 2007 8:41 pm ] |
| Post subject: | |
Ah, thanks william. I see what I did now. Now for these dammed 64x64 npcs. I'll figure it out though. thanks guys |
|
| Author: | William [ Mon Mar 19, 2007 9:34 am ] |
| Post subject: | |
Okay, glad I could help |
|
| Page 1 of 1 | All times are UTC |
| Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |
|