Mirage Source
bltNPCTOP - Printable Version

+- Mirage Source (https://mirage-engine.uk/forums)
+-- Forum: Mirage Source (Nostalgia) (https://mirage-engine.uk/forums/forumdisplay.php?fid=61)
+--- Forum: Archive (2006-2011) (https://mirage-engine.uk/forums/forumdisplay.php?fid=18)
+---- Forum: General (https://mirage-engine.uk/forums/forumdisplay.php?fid=17)
+---- Thread: bltNPCTOP (/showthread.php?tid=835)



bltNPCTOP - Rian - 18-03-2007

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


- Robin - 18-03-2007

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.


- William - 18-03-2007

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



- Rian - 18-03-2007

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.


- Robin - 18-03-2007

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.


- William - 18-03-2007

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  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



- Rian - 18-03-2007

Ah, thanks william. I see what I did now. Now for these dammed 64x64 npcs.

I'll figure it out though. thanks guys


- William - 19-03-2007

Okay, glad I could help Smile