This is the intersect rect im talking about:
Type RECT Left As Long Top As Long Right As Long Bottom As Long End Type Declare Function IntersectRect Lib "user32" Alias "IntersectRect" (lpDestRect As RECT, lpSrc1Rect As RECT, lpSrc2Rect As RECT) As Long mblnCollision = IntersectRect(udtTempRect, mudtRect1, mudtRect2)
This is the code for the variable modual
'these variables are used for when you press a key Public Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As Long) As Integer Global Const KEY_TOGGLED As Integer = &H1 Global Const KEY_DOWN As Integer = &H1000
And this is the game loop that moves the tile and displays the map
Dim xPos As Integer, yPos As Integer Dim SpriteX As Integer, SpriteY As Integer Public Sub GameLoop() Running = True 'running becomes false only Do Until Running = False 'when you press the escape key, which 'the code is in the form keyup sub DoEvents 'these are the events triggered when you press a key 'they modify the x or y postion of where the sprite is located If (GetKeyState(vbKeyRight) And KEY_DOWN) Then SpriteX = SpriteX + 1 End If If (GetKeyState(vbKeyLeft) And KEY_DOWN) Then SpriteX = SpriteX - 1 End If If (GetKeyState(vbKeyUp) And KEY_DOWN) Then SpriteY = SpriteY - 1 End If If (GetKeyState(vbKeyDown) And KEY_DOWN) Then SpriteY = SpriteY + 1 End If For xPos = 1 To 20 DrawXY Grass, xPos, 1, True For yPos = 1 To 15 DrawXY Grass, xPos, yPos, True Next yPos Next xPos ' The Sprite ' | multiplied by sprite width, on the x axis it will be shown ' | | multiplied by the sprite height, on the y axis it will be shown ' | | | Whether you want it to be transparent ' | | | | DrawXY Mushrooms, 12, 5, True For xPos = 6 To 12 DrawXY GrassMid, xPos, 9, True For yPos = 9 To 14 DrawXY GrassMid, xPos, yPos, True Next yPos Next xPos DrawAnyWhere Rock, SpriteX, SpriteY, True '16, 12 'calls to the backbuffer RenderBackBuffer Loop Leave End Sub

This post has been edited by giuseppe105: 16 July 2008 - 11:28 AM