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) :D
Printable View
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) :D
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
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...:(
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.
you mean something like this?
now whenever I move it moves up and right...sorry Im still getting the hang of 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
Gotta bring this back to the top :)
don't worry, I'm still here twidling my fingers...:(