Results 1 to 7 of 7

Thread: Whats wrong with my bitblt? (nods to fox's direction)

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jul 1999
    Posts
    1,800
    http://www.geocities.com/steve_cr_mack/game.zip

    this is my rpg (hehehe, so far anyway, thats about an hours work!) but It always scrolls even If im not moving, someone please find the error!


    thanks guys (and gals)

  2. #2
    PowerPoster Fox's Avatar
    Join Date
    Jan 2000
    Location
    *afk*
    Posts
    2,088
    Hm, nice But mhm, you should not use a picturebox to hold the tiles/pixs you know

    however, to your problem.. erm, when checking the player position (if he's outer screen) you move the scrolling position, but you don't move the player...

    see:
    Code:
       If Player.y < ScrollDist then
          ScrollY = ScrollY - 1
          Player.Y = player.y + 1 'You forgot that ;)
       Endif

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Jul 1999
    Posts
    1,800
    I know I shouldn't use pic boxes but this is my first scrolling bitblt game so...

    For some reason, after I added that, the map still seems to move up and right...

  4. #4
    PowerPoster Fox's Avatar
    Join Date
    Jan 2000
    Location
    *afk*
    Posts
    2,088
    Erm, you -of course- need to add this in all directions The player moves - if the scrolling moves + for X and Y... as in my example above, ScrollY decreases while PlayerY increases.

  5. #5

    Thread Starter
    Frenzied Member
    Join Date
    Jul 1999
    Posts
    1,800
    you mean something like this?
    Code:
    Public Sub CheckKeys()
        If KD(vbKeyEscape) = True Then: Active = False
        
        'Check if any key's pressed and move the player if in viewport
        
        If KD(vbKeyLeft) = True Then
            Player.x = Player.x - 1 'moves player
            If Player.x < 0 Then: Player.x = 0 'keeps from moving offscreen
            PlayerX = PlayerX - 1 'for coordinates
                lblPlayerX = PlayerX 'makes lblPlayerX PlayerX
                lblPlayerY = PlayerY 'makes lblPlayerY PlayerY
                'If player moves outer screen update scrolling
        If Player.x + Player.w + ScrollDist > FrontW Then
            ScrollX = ScrollX + 1
        End If
        
        If Player.y + Player.h + ScrollDist > FrontH Then
            ScrollY = ScrollY + 1
        End If
        
        If Player.x < ScrollDist Then
            ScrollX = ScrollX - 1
            Player.x = Player.x + 1
        End If
        
        If Player.y < ScrollDist Then
          ScrollY = ScrollY - 1
          Player.y = Player.y + 1
       End If
        End If
        
        If KD(vbKeyRight) = True Then
            Player.x = Player.x + 1
            If Player.x + Player.w > Front.Width Then: Player.x = Front.Width - Player.w
            PlayerX = PlayerX + 1
                lblPlayerX = PlayerX 'makes lblPlayerX PlayerX
                lblPlayerY = PlayerY 'makes lblPlayerY PlayerY
                'If player moves outer screen update scrolling
        If Player.x + Player.w + ScrollDist > FrontW Then
            ScrollX = ScrollX + 1
        End If
        
        If Player.y + Player.h + ScrollDist > FrontH Then
            ScrollY = ScrollY + 1
        End If
        
        If Player.x < ScrollDist Then
            ScrollX = ScrollX - 1
            Player.x = Player.x + 1
        End If
        
        If Player.y < ScrollDist Then
          ScrollY = ScrollY - 1
          Player.y = Player.y + 1
       End If
        End If
        If KD(vbKeyUp) = True Then
            Player.y = Player.y - 1
            If Player.y < 0 Then: Player.y = 0
            PlayerY = PlayerY - 1
                lblPlayerX = PlayerX
                lblPlayerY = PlayerY 'makes lblPlayerY PlayerY
                'If player moves outer screen update scrolling
        If Player.x + Player.w + ScrollDist > FrontW Then
            ScrollX = ScrollX + 1
        End If
        
        If Player.y + Player.h + ScrollDist > FrontH Then
            ScrollY = ScrollY + 1
        End If
        
        If Player.x < ScrollDist Then
            ScrollX = ScrollX - 1
            Player.x = Player.x + 1
        End If
        
        If Player.y < ScrollDist Then
          ScrollY = ScrollY - 1
          Player.y = Player.y + 1
       End If
        End If
        
        If KD(vbKeyDown) = True Then
            Player.y = Player.y + 1
            If (Player.y + Player.h) > Front.Height Then Player.y = Front.Height - Player.h
            PlayerY = PlayerY + 1
                lblPlayerX = PlayerX
                lblPlayerY = PlayerY 'makes lblPlayerY PlayerY
                'If player moves outer screen update scrolling
        If Player.x + Player.w + ScrollDist > FrontW Then
            ScrollX = ScrollX + 1
        End If
        
        If Player.y + Player.h + ScrollDist > FrontH Then
            ScrollY = ScrollY + 1
        End If
        
        If Player.x < ScrollDist Then
            ScrollX = ScrollX - 1
            Player.x = Player.x + 1
        End If
        
        If Player.y < ScrollDist Then
          ScrollY = ScrollY - 1
          Player.y = Player.y + 1
       End If
        End If
        
    
    
        
        'Check scrolling
        If ScrollX < 0 Then: ScrollX = 0
        If ScrollY < 0 Then: ScrollY = 0
        
        If (ScrollX + FrontW) / TileW > MapW Then: ScrollX = (MapW * TileW) - FrontW
        If (ScrollY + FrontH) / TileH > MapH Then: ScrollY = (MapH * TileH) - FrontH
    
    End Sub
    now whenever I move it moves up and right...sorry Im still getting the hang of this...

  6. #6

    Thread Starter
    Frenzied Member
    Join Date
    Jul 1999
    Posts
    1,800
    Gotta bring this back to the top

  7. #7

    Thread Starter
    Frenzied Member
    Join Date
    Jul 1999
    Posts
    1,800
    don't worry, I'm still here twidling my fingers...

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