Results 1 to 2 of 2

Thread: Platform game

  1. #1

    Thread Starter
    Fanatic Member petrus's Avatar
    Join Date
    May 2002
    Location
    pBytes[sizeof(pBytes)/2]
    Posts
    553

    Platform game

    Hello, Im developing a platform game but now I'm stuck. Here's the code I'm using to draw all the tiles:

    VB Code:
    1. Dim offset1 As POINTAPI
    2.     Dim offset2 As POINTAPI
    3.     Dim X As Long, Y As Long
    4.    
    5.     X = iCurPos.X
    6.     Y = iCurPos.Y
    7.    
    8.     offset1.X = (X - picBackBuffer.ScaleWidth / 2) ' / 32
    9.     offset1.Y = (Y - picBackBuffer.ScaleHeight / 2) '/ 32
    10.    
    11.     If X < picBackBuffer.ScaleWidth / 2 Then offset1.X = 0
    12.     If Y < picBackBuffer.ScaleHeight / 2 Then offset1.Y = 0
    13.    
    14.     For iX = 0 To UBound(Map, 1)
    15.         For iY = 0 To UBound(Map, 2)
    16.             BitBlt picBackBuffer.hDC, iX * 32 - offset1.X, iY * 32 - offset1.Y, 32, 32, picTiles.hDC, Map(iX, iY).TileSrcX, Map(iX, iY).TileSrcY, vbSrcCopy
    17.        
    18.         Next iY
    19.     Next iX
    20.     X = X - (iCurPos.X - picBackBuffer.ScaleWidth / 2)
    21.     Y = Y - (iCurPos.Y - picBackBuffer.ScaleHeight / 2)
    22.    
    23.     DrawPlayer iCurPos.X - offset1.X, iCurPos.Y - offset1.Y, offset1.X, offset1.Y

    Yeah, it works but when the player is going up into the left corner it's going reaallllllly slow.
    Anyone knows how to solve this?
    ICQ: 128716725

  2. #2

    Thread Starter
    Fanatic Member petrus's Avatar
    Join Date
    May 2002
    Location
    pBytes[sizeof(pBytes)/2]
    Posts
    553
    AH!! I solved it by my self.. (Even when it's this late!)
    ICQ: 128716725

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width