Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

2D All the way! / Collision confusion

Author
Message
Garfield rules
21
Years of Service
User Offline
Joined: 12th Jun 2005
Location:
Posted: 1st Oct 2005 06:31 Edited at: 1st Oct 2005 06:35
I know that this has been asked multiple times all ready, but... How do you get 2d side-scrolling collision to work in DBC, using the paste tile method? I've searched the forum and found some answers, but still don't really understand. Pizzaman's awesome 2D tutorial (not the DBPro version, another version converted to DBC) helped me understand scrolling, but the four-corner collision still confuses me. I know it has something to do with getting the collision point to detect which tile it's on and which image number that tile has through the array, but how do I do that? Here's the code for the Mario fangame I'm making in DBC. I didn't include any jumping/gravity coding because at this point because Mario would just fall off screen, but I know how to implement the gravity, at least when using a sprite as the floor.



How would I go about working collision into this code? What things should I add, change or remove? Thanks in advance.

Edit: I also included the media that I'm using so the code can be tested.
Garfield rules
21
Years of Service
User Offline
Joined: 12th Jun 2005
Location:
Posted: 2nd Oct 2005 19:59 Edited at: 2nd Oct 2005 19:59
I changed the collision subroutine a bit, combining a couple of elements from Pizzaman's code with some of my own, and it almost works. The left collsion works like it should, but only in certain places, and I haven't been able to get the right collision to work. Top collision works well, but only in certain places as with before, and bottom collision... Well, it almost works, but Mario usually doesn't collide until he reaches the bottom of the tile, as opposed to colliding with the top of the tile as he should. And after scrolling for a bit it says "array accessed out of bounds". What am I doing wrong?

Login to post a reply

Server time is: 2026-07-06 18:57:41
Your offset time is: 2026-07-06 18:57:41