• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Legacy GM Bbox_top / bottom not returning correct values?

C

Corablue

Guest
I'm using bbox_top and bbox_bottom for floor and ceiling collision purposes. They don't seem to be working how I imagine they should work. I'll include a few images for visual reference.





As you can see, my character is sinking well into the floor and ceiling before triggering collision events. The debug message here displays three numbers. These are y, bbox_top, and bbox_bottom. So the game is functioning correctly according to these numbers. The problem is these numbers are wrong.



As you can see here, there is a clear 60 pixel difference between the top and bottom of the bounding box. I'm not changing the sprite mask. I have no clue where the game is getting an only 20 pixel difference from. Any help would be really great.
 
I

icuurd12b42

Guest
Well I know the bbox works so... I agree your numbers dont make sense though. I would suspect you made an error in your code... are you sure you have the bbox of the right object?
 

BLang

Member
Huh, that's weird. Can we see your collision code?
Also, are you changing the object's mask anywhere in the code?

EDIT: On second thought, did you try using a mask instead of the sprite's bounding box? I think the problem might be that there is a size discrepancy between your jumping sprite bounding box and your standing sprite bounding box, and that might be what's causing the problem.
 
C

Corablue

Guest
Considering the advice here, I double checked all of my code (there was a lot of it) and found old code buried in another instance that was playing with the sprite mask, using an old placeholder sprite. That was the culprit. GM is giving me the correct values now. Thanks a bunch. I think I have this one solved.
 
Top