Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Aug 3, 2011 20:02:32 GMT -5
So, after not listening to moon about READTILE I'm finally giving up on reading VRAM for collisions. Even without my quirky map loading/drawing code collisions are unreliable with READTILES. I've decided to use the map data itself. However, I noticed that even when dividing the player x or y by 8, I still don't get pixel perfect collisions with tiles. Sometimes my player still gets wedged, say, half a tile into a solid object.
Am I chasing a red herring here? Is x/8 or (x >> 3) actually bad for getting tile coordinates for collisions?
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Aug 3, 2011 20:11:06 GMT -5
Is x/8 or (x >> 3) actually bad for getting tile coordinates for collisions? Nope, that method is just fine ( and widely used ) for pixel- to tile-coordinate conversion. Your collision routine is probably busted
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Aug 3, 2011 21:40:43 GMT -5
Is x/8 or (x >> 3) actually bad for getting tile coordinates for collisions? Nope, that method is just fine ( and widely used ) for pixel- to tile-coordinate conversion. Your collision routine is probably busted Thanks for the sanity check moon! I just edited your READTILES example to use an array and it still works great. Kudos to your code! EDITED: Not the best example code. Redacted per moon.
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Aug 4, 2011 4:34:44 GMT -5
Dude, you're making me look bad The ONLY reason I send you the readtile example, was because you couldn't get it to work. Besides, did you not read this part of the PM?
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Aug 4, 2011 6:50:38 GMT -5
Dude, you're making me look bad The ONLY reason I send you the readtile example, was because you couldn't get it to work. Besides, did you not read this part of the PM? Sorry! I thought it was very simple, elegant code where it had to be. In this case confirming collisions in 4 directions. In my case it gave be tangible proof that array based collision can work. This after 2 weeks of failing with my own collision detection problems. I guess I got a little too excited Before I posted I checked the other examples for anything that comes close. Soliel.bex doesn't have proper collision. Collision.bex shows a collision for a single point. collision_detection.bex is frankly useless and don't get me started on Chicken_Wee.bex!
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Aug 4, 2011 7:20:45 GMT -5
Soliel.bex doesn't have proper collision. You mean "Soleil.bex doesn't have ANY collision" instead of "proper". That example was meant to explain noobs the concept of scrolling / drawing a map, nothing more .. so of course there's no collision. Collision.bex shows a collision for a single point. Can't remember who requested this example, but I'm pretty sure he / she asked how to check for collision with bullets / small-sprites. So, that doesn't have anything to do with tile-based map collision either. Anyway, no idea whether any proper examples for sprite vs tile collision have been posted .. I surely haven't though. Thing is, it really depends on your game what exact implementation is best.
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Aug 4, 2011 7:47:59 GMT -5
Soliel.bex doesn't have proper collision. You mean "Soleil.bex doesn't have ANY collision" instead of "proper". That example was meant to explain noobs the concept of scrolling / drawing a map, nothing more .. so of course there's no collision. Collision.bex shows a collision for a single point. Can't remember who requested this example, but I'm pretty sure he / she asked how to check for collision with bullets / small-sprites. So, that doesn't have anything to do with tile-based map collision either. Anyway, no idea whether any proper examples for sprite vs tile collision have been posted .. I surely haven't though. Thing is, it really depends on your game what exact implementation is best. Sadly, your not proper example was the closet thing. I only mentioned the others as possible candidates. Again, my apologies.
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Aug 4, 2011 9:40:29 GMT -5
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Aug 4, 2011 10:45:31 GMT -5
The interesting part is that he checks additional "hot spots" on the player sprite based on its direction. Even before high school I always checked additional collision points based on what key the user was pressing. Big difference.
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Aug 5, 2011 9:22:47 GMT -5
@moon: I think theelf was the one who requested that, if I remember correctly from reading all of the old posts a few months back.
@theloon: as moon said, your collision routine is broken. That's how I'm doing collision right now, except I'm using a map array to draw the map, which also doubles up as a "check the coords in front, back, and to the sides" of my character to see if he can walk in said directions. I'm not sure if you're doing something similar, but this is one method that I found works well for me.
|
|