Excellent, thank you ggn!
That function is perfect, exactly what I was looking for. I added in the code as described and it worked straight away.
I then had a thought, I had some code from when I was messing around for getting the memory address and tried it out - that seems to work too. This means I don't have to modify the rbasic.h source code;
First I grabbed the address from the particle layer asset;
Then modified your code as below, just plugging in the mem% variable;
function getpixel(x as short, y as short) as short
if x band 1 then
function=(peek(mem%+x/2+y*160)) band 15
function=((peek(mem%+x/2+y*160))>>4) band 15
I'm just playing around to try out stuff, using the GetPixel as collision detection. I know this could be done other ways with an array etc but thought it might be cleaner to just check the pixel colour directly. It's not exactly a hardware taxing game
Here's a picture of what i've created so far to make it clear what it's for (pic hosted elsewhere). Red line around the edge is a wall, orange line is player 1.
As a side note, not sure if this is a bug, I can log in the other thread if you like - but it seems to be plotting a black pixel directly to the left of the actual pixel I am plotting.
This can be seen in the above picture by the horizontal lines that have been drawn left to right.
I wondered what it was at first thinking I must have been adding 2 to the x coord but that's not the case.
As i'm using the getpixel for collision, it means that if you're lucky you can zoom through the dotted line if you happen to line up with a black pixel or when travelling right to left you just go through yourself because the pixel in front of the "bike" is always black.
Anyway, thanks again for your work. It's been fun messing around so far. I have also added a second player to above game and would like to keep fleshing it out.
Edited by Sporadic, Sat May 23, 2015 2:17 AM.