forums

TNT Basic Forums > Bugs!
Moving Viewports and Sprite Collisions
< Last Thread     Next Thread >
Author
Thread        Post A Reply

03-23-2006 14:17

Posted by:
Jacob

Location:
San Francisco, CA

Click Here to Email Jacob   Find more posts by Jacob

My sprite collisions work fine until the viewport starts to move.
When that happens the player falls through the tiles (sprites).
This only happens 50% of the time, so the player will fall half of the way through the tile and then pop back up.

And one more note: Can Mark make sprite collisions work at least the image width of the sprite off the screen?

03-23-2006 22:58

Posted by:
someone

Location:
Quebec ( Canada )

Click Here to Email someone   Find more posts by someone

even if your tiles are made of sprites,, you shouldn't use sprite collision for terrain collisions... maybe a map, or a double-dimension array if you're not using a map, etc. as far as i know collisions work properly

> so the player will fall half of the way through the tile and then pop back up.

I haven't seen your code but from my own experiences this sounds like an issue in your code rather than an issue in TNT (well i can't really tell but when i was learning to do maps it often happened to me to have characters going halfway into the ground then back up on it.)

This can if you move the character to the top of the ground after drawing it halfway inside it,
if you're checking its collision with the ground and making it fall down in wrong order so that it falls into the ground, get drawns, and collision occurs only next frame, etc.

03-24-2006 00:43

Posted by:
Jacob

Location:
San Francisco, CA

Click Here to Email Jacob   Find more posts by Jacob

Well, I use sprites for the tiles so I can have exact collisions.

And if you want to see my code goto my website and download the first example, that's the code I'm using.

I also found out that this doesn't only happen when the viewport is moving.
I think for some reason the sprite for the tile isn't being moved to the next object fast enough or something like that.
what ever it is, it's very strange and I can't find aything wrong with my code.

Possibly it has something to do with TNT Basic not always updating sprites before you call draw frame.

03-24-2006 15:17

Posted by:
allnodcoms

Location:
hertfordshire (England)

Click Here to Email allnodcoms   Find more posts by allnodcoms

Sounds like your code I'm afraid...

TNT will update sprite data at the same time, every time... It doesn't really matter whether it happens pre or post draw frame as long as it is consistent, and it is. Therefor if it was a problem with the engine it wouldn't happen "50% of the time", it would happen every time. Sounds like you're jumping through a collision, just missing it on one loop and catching it half way through the next... try reducing your sprite displacements or enlarging the catchment area around the ground tiles / sprites. You could do this by adding a couple of pix to the mask data by hand...

Danny (nods)

All times are GMT        Post A Reply

Forum Jump:
< Last Thread     Next Thread >

< Contact Us - TNT Basic >

Powered by: vBulletin Lite Version 1.0.1 Lite
Copyright © Jelsoft Enterprises Limited 2000.