Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Blting Something to the GameScreen
#1
im trying to blt a graphic to a certain part of the gamescreen any idea how ?
im not wanting it to follow the player, i just want it to be fixed at the location that the player was in.

This is the code that is not working.

rec.Top = 0
rec.Bottom = 64
rec.Left = 0
rec.Right = 32

Call AddText("Sub TestSub has been Fired", Green)
x = PlantX '(GetPlayerX(Index) * PIC_X + sx + Player(Index).XOffset) - (NewPlayerX * PIC_X) - NewXOffset - 32
y = PlantY '(GetPlayerY(Index) * PIC_Y + sx + Player(Index).YOffset) - (NewPlayerY * PIC_Y) - NewYOffset - 35
Call DD_BackBuffer.BltFast(x - (NewPlayerX * PIC_X) + sx - NewXOffset, y - (NewPlayerY * PIC_Y) + sx - NewYOffset, DD_CorpseAnim, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)

i commented out the other stuff because they are not moving.
any ideas ?
thanks.
Reply
#2
If you check this code, you can easily edited it. Just rename it and run it like this:

Code:
call blttile1(2,2)
That would put it at 1 position all the time. Of course you should remove the layers and just keep 1 Call DD_BackBuffer.BltFast for the thing you want to blit.
Code:
Public Sub BltTile(ByVal x As Long, ByVal y As Long)
'****************************************************************
'* WHEN        WHO        WHAT
'* ----        ---        ----
'* 07/12/2005  Shannara   Optimized function.
'****************************************************************

Dim Ground As Long
Dim Anim1 As Long
Dim Anim2 As Long

    With Map.Tile(x, y)
        Ground = .Ground
        Anim1 = .Mask
        Anim2 = .Anim
    End With
    
    ' Only used if ever want to switch to blt rather then bltfast
    With rec_pos
        .top = y * PIC_Y
        .Bottom = .top + PIC_Y
        .Left = x * PIC_X
        .Right = .Left + PIC_X
    End With
    
    With rec
        .top = Int(Ground / 7) * PIC_Y
        .Bottom = .top + PIC_Y
        .Left = (Ground - Int(Ground / 7) * 7) * PIC_X
        .Right = .Left + PIC_X
    End With
    Call DD_BackBuffer.BltFast(x * PIC_X, y * PIC_Y, DD_TileSurf, rec, DDBLTFAST_WAIT)
    
    If (MapAnim = 0) Or (Anim2  0 Then
            With rec
                .top = Int(Anim2 / 7) * PIC_Y
                .Bottom = .top + PIC_Y
                .Left = (Anim2 - Int(Anim2 / 7) * 7) * PIC_X
                .Right = .Left + PIC_X
            End With
            Call DD_BackBuffer.BltFast(x * PIC_X, y * PIC_Y, DD_TileSurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
        End If
    End If
End Sub
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)