S
Spin Attaxx
Guest
So I asked this recently and it got largely ignored. I guess to be fair, I didn't thorougly define the problem, so let's try this again.
So I have a door object (32 x 256) that takes me to a different room when I touch it. It has an offset variable that puts me in the new room at a position relative to how I left it - so if I'm jumping, I'm in the same spot when I enter, and if I'm just running, that run goes uninterrupted. At least, in theory. What I've noticed is that for a lone frame, if I leave a room on the ground, I'm not considered "grounded". It's more noticeable when I have an idle and run sprite, since the idle sprite appears briefly.
After much headaches, I believe my offset calculations and/or the sprite origin of my door/collision mask (which is 60 x 147) are what's causing it. See, here's the code for my door object:
In creation code, I would (for example) put "607" for target_y, as that is the last area of free space before the ground starts. In addition, my door's sprite doesn't sink into/float above the ground.
Now ideally, running on the ground should mean offset_y equals 0, and thus nothing gets added, and thus I'm put into position directly on the ground. However, for some reason, I'm either instead put slightly higher, or I sink two pixels into the ground. Looking in the debug mode, apparently the game considers my doors' y to be 1 extra pixel down than what I put as my target_y (in other words, it's in the same line of pixels as my ground).
So I modify my offset calculations so it's "other.bbox_bottom - (y-1)" (so it'll be the same as making my door's origin one pixel higher)... and it doesn't work. Well, it does, but only on one door. And I for the life of me can't figure out why that door in particular works as intended, when it is unchanged from every other door.
So yeah. This has been a pretty big impasse, I don't know how to get around it, it's giving me headaches, and I'd like to avoid being greeted with dead air again now that I've outlined my problem more thoroughly. If you need more info, please ask.
EDIT: Oh, also, I don't know if this is a contributor, but apparently my (persistent) player appears before any other solid objects do for a VERY brief time (like, if I pause at exactly the right time, I'll get a screenshot of my character, but no level). I don't know what's causing this either.
So I have a door object (32 x 256) that takes me to a different room when I touch it. It has an offset variable that puts me in the new room at a position relative to how I left it - so if I'm jumping, I'm in the same spot when I enter, and if I'm just running, that run goes uninterrupted. At least, in theory. What I've noticed is that for a lone frame, if I leave a room on the ground, I'm not considered "grounded". It's more noticeable when I have an idle and run sprite, since the idle sprite appears briefly.
After much headaches, I believe my offset calculations and/or the sprite origin of my door/collision mask (which is 60 x 147) are what's causing it. See, here's the code for my door object:
Code:
//NOTE: Door's origin is at 0 x 256 and player collision mask's is at 30 x 74
offset_y = other.bbox_bottom - y; //Player bottom minus door y equals offset
//These three vars are defined in instance creation code:
other.x = target_x; //Player goes to target X location
other.y = target_y + offset_y - 73; //Player goes to target Y location - minus 73 to account for collision mask's center
room_goto(target_r); //Game switches to target room
Now ideally, running on the ground should mean offset_y equals 0, and thus nothing gets added, and thus I'm put into position directly on the ground. However, for some reason, I'm either instead put slightly higher, or I sink two pixels into the ground. Looking in the debug mode, apparently the game considers my doors' y to be 1 extra pixel down than what I put as my target_y (in other words, it's in the same line of pixels as my ground).
So I modify my offset calculations so it's "other.bbox_bottom - (y-1)" (so it'll be the same as making my door's origin one pixel higher)... and it doesn't work. Well, it does, but only on one door. And I for the life of me can't figure out why that door in particular works as intended, when it is unchanged from every other door.
So yeah. This has been a pretty big impasse, I don't know how to get around it, it's giving me headaches, and I'd like to avoid being greeted with dead air again now that I've outlined my problem more thoroughly. If you need more info, please ask.
EDIT: Oh, also, I don't know if this is a contributor, but apparently my (persistent) player appears before any other solid objects do for a VERY brief time (like, if I pause at exactly the right time, I'll get a screenshot of my character, but no level). I don't know what's causing this either.
Last edited by a moderator: