sprcoll and zoom functions

Previous topic - Next topic

kaotiklabs


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?
Vote Cthulhu! Because the stars are right!!!!
Ia Ia Cthulhu F' tang!

Schranz0r

Use tilemaps, much simpler and very handy to use !
I <3 DGArray's :D

PC:
AMD Ryzen 7 3800X 16@4.5GHz, 16GB Corsair Vengeance LPX DDR4-3200 RAM, ASUS Dual GeForce RTX™ 3060 OC Edition 12GB GDDR6, Windows 11 Pro 64Bit, MSi Tomahawk B350 Mainboard

Moru

Have a look at this map editor: Mappy
It's realy easy to use and I wote a map-loader for it too so you can use them easily in GL-Basic.

kaotiklabs

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?
Vote Cthulhu! Because the stars are right!!!!
Ia Ia Cthulhu F' tang!

Kitty Hello

Usually you don't do per pixel collisions. Especially not, when you have scaled images.
Then you try a circle-circle collision:

Code (glbasic) Select

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


kaotiklabs

Thanks for the advices.

Now I believe I´m in the right way to solve it.  =)
Vote Cthulhu! Because the stars are right!!!!
Ia Ia Cthulhu F' tang!