LoginLogin

Has basic collision ever had a decent solution?

Root / General / [.]

thehammehCreated:
I've played both versions of PTC for quite a long time, and it seems as if there are no decent solutions for collisions. Right now it seems (for a 2d platformer) the first way of making collision is using SPHITSP but since you cannot duplicate sprites and the limit of sprites is very low, it doesn't seem useful. Another way is creating a map with BG tiles, filling them in with textures and checking for collision. Are there any easier methods to create collisions more easily? Both methods seem very limiting on a size of a game.

For anything that's tile-based, I would use an array. A 2d array, your map, could hold all of the bg values. Then you can use it to draw your map and check for collision. To check collision between the tiles and the sprite just divide the sprites x and y coordinates by 16(The size of a bg tile) and plug it into the map array. You could do something like: IF MAP[PLX/16,PLY/16]==0 THEN MOVE; IF MAP[PLX/16,PLY/16]==1 THEN DONTMOVE. Don't necessarily try that exact code though. You'll probably want to be checking in front of where the sprite is moving too.

A game I've been working on pretty much uses that method. I still haven't gotten it fully functional but it seems promising.

well, bgget() works well :/