Hi there!
Right, I dug around and found my code for my 2D game maker. In that code, there is a section where I import every pixel from the bitmap, and that code came from TDK.
So here is what I would do.
Lets say this is your island:
The graphics for your island can be higher than this. Then you make a background image. This image never really gets displayed, but is used for collision checking. It would look something like this:
This background image defines where the island is using one colour. So all you do then, is import that image with the following code:
rem import bitmap pixels(Thankyou TDK! :-)
rem setup arrays
dim collision(width,height)
Open to read 1,"image.bmp": Rem Colour Image
Read word 1,Discard: Rem Identifier
Read long 1,Discard: Rem File Size
Read long 1,Discard: Rem Reserved
Read long 1,Discard: Rem Bitmap Data Offset
Read long 1,Discard: Rem Bitmap Header Size
Read long 1,ImageWidth: Rem Width
Read long 1,ImageHeight: Rem Height
Read word 1,Discard: Rem Planes
Read word 1,bitsperpixel: Rem Bits Per Pixel
Read long 1,Discard: Rem Compression
Read long 1,bmpdatasize: Rem Bitmap Data Size
Read long 1,Discard: Rem HResolution
Read long 1,Discard: Rem VResolution
Read long 1,Discard: Rem Colors
Read long 1,Discard: Rem Important Colors
Rem Read in the pixel data into the array
For By = ImageHeight-1 to 0 step-1
For Bx=0 to ImageWidth-1
read byte 1,Blue
read byte 1,Green
read byte 1,Red
if blue=0 and green=128 and red=0 then collision(bx,by)=1
Next Bx
Next By
Close File 1
And then you check for collision in your code by checking if collision(playerx,playery)=1. And that's that!
I hope that helped you out, thanks very much and goodbye!
TheComet
Make the path of your enemies easier with Waypoint Pro!