Use a tile based system and assign two different two dimensional arrays to each tile. for instance, tx(tile number,tile width) and ty(tile number,tile height).
Use these arrays to store the x,y collision data for each tile. In your main loop, check to make sure your sprite is not beaching the x/y coords supplied in the array for each tile.
There, I just supplied you with a theory on how to do your engine.
You'll also need a two dimensional array that holds your level. Perhaps something like map(map width, map height) which will store what tile is where.
So there you have it, three two dimensional arrays.
dim map(map_width, map_height) as integer
dim tilex(tile_number, tile_width) as integer
dim tiley(tile_number, tile_height) as integer
You define the map width/map height and the tile width/tile height, aswell as the number of tiles you have have in your tile set.
You'll know what tiles to check depending on what direction your object is moving. You won't need to check all 8 directions in your main loop, just 5 at the most.
All you need to do now is assemble a bunch of
IF STATEMENTS to set your conditions. You'll also need
DATA STATEMENTS that contain your
map data and your
tile collision table.