Hi,
I´m coding a 2d top-down scrolling game. Kind of Gauntlet.
I´m using big sprites, 1024x768, same as in-game screen resolution. One for the background and one for colliding objects using transparency.
I want to zoom the backgrounds in order to save file space, but if I use strechsprite or zoomsprite collision borders aren´t updated to the new zoomed images.
I believe, sprcoll is only using the original image to do the calculations.
How could I solve it?
Use tilemaps, much simpler and very handy to use !
Have a look at this map editor: Mappy (http://www.tilemap.co.uk/mappy.php)
It's realy easy to use and I wote a map-loader for it too so you can use them easily in GL-Basic.
Thanks for the advice, maybe your approach is better for my requirements.
Either way, will be useful if someone can through a bit of light on this.
Using zoomed or streched sprites is very common. So if sprcoll can only deal with the original sprite? How can we solve this?
Usually you don't do per pixel collisions. Especially not, when you have scaled images.
Then you try a circle-circle collision:
FUNCTION CircCol: x1,y1,R1, x2,y2,R2
LOCAL dx, dy, dR
dx=x2-x1
dy=y2-y1
dR=R2-R1
IF dx*dx + dy*dy < dR*dR THEN RETURN TRUE
RETURN FALSE
ENDFUNCTION
Thanks for the advices.
Now I believe I´m in the right way to solve it. =)