Hey, guys, I'm having trouble with jump through platforms. Here's a code for a normal nonsolid block (vertical floor collision) which for the most part works perfectly Code: platformID = place_meeting(x,y+ymovementspeed,object0) {if platformID and ymovementspeed > 0 //and y > platformID.y {var cc; cc = ymovementspeed + 1; while (!place_meeting(x,y+1,object0) and cc >= 0) {y += 1;} onground = 1; jumping = 0; ymovementspeed = 0; repeat(round(random(2))+4) {dust = instance_create(x+choose(-5,-4,-3,-2,-1,0,1,2,3,4,5),y+8,objDustCloud)};}} and here's the one for a jumpthrough, which comes right after. Also nonsolid Code: //Jumpthrough platforms platformID = place_meeting(x,y+ymovementspeed,objBlockJumpThrough) {if platformID == 1 and ymovementspeed > 0 and (!place_meeting(x,y,objBlockJumpThrough)) {var cc; cc = ymovementspeed + 1; while ( (!place_meeting(x,y+1,objBlockJumpThrough) ) and cc >= 0) {y += 1;} onground = 1; jumping = 0;
ymovementspeed = 0; //if y > platformID.y {y = platformID.y;} repeat(round(random(2))+4) {dust = instance_create(x+choose(-5,-4,-3,-2,-1,0,1,2,3,4,5),y+8,objDustCloud)};}} pretty much the only thing different here is that I'm checking for an additional collision with the jumpthrough to see if the player is touching it in general rather than just y+vertical speed. This code works okay, but the instant that the player comes into "general" contact with another jumpthrough, say one that's eye level to him while on another jumpthrough, he falls straight through the one he's currently walking on. I assume this is because I checked for the object and not the instance he is currently standing/walking on. However, when I change !place_meeting(x,y,objBlockJumpThrough) to !place_meeting(x,y,platformID), the instance's ID, the player glitches up get's stuck in the platform while he's jumping and has presumably a positive vertical speed. This doesn't make any sense because the game is checking if he ISN'T generally intersecting with the platform, not if he IS. Sorry, but changing any object's solidity is 100% out of the question because I need for all objects to always stay unsolid. It's so frustrating. :/
Hey, guys, I'm having trouble with jump through platforms.
Here's a code for a normal nonsolid block (vertical floor collision) which for the most part works perfectly
[code]platformID = place_meeting(x,y+ymovementspeed,object0)
{if platformID and ymovementspeed > 0 //and y > platformID.y
{var cc;
cc = ymovementspeed + 1;
while (!place_meeting(x,y+1,object0) and cc >= 0) {y += 1;}
onground = 1;
jumping = 0;
ymovementspeed = 0;
repeat(round(random(2))+4) {dust = instance_create(x+choose(-5,-4,-3,-2,-1,0,1,2,3,4,5),y+8,objDustCloud)};}}[/code]
and here's the one for a jumpthrough, which comes right after. Also nonsolid
[code]//Jumpthrough platforms
platformID = place_meeting(x,y+ymovementspeed,objBlockJumpThrough)
{if platformID == 1 and ymovementspeed > 0 and (!place_meeting(x,y,objBlockJumpThrough))
{var cc;
cc = ymovementspeed + 1;
while ( (!place_meeting(x,y+1,objBlockJumpThrough) ) and cc >= 0) {y += 1;}
onground = 1;
jumping = 0;
ymovementspeed = 0;
//if y > platformID.y {y = platformID.y;}
repeat(round(random(2))+4) {dust = instance_create(x+choose(-5,-4,-3,-2,-1,0,1,2,3,4,5),y+8,objDustCloud)};}}[/code]
pretty much the only thing different here is that I'm checking for an additional collision with the jumpthrough to see if the player is touching it in general rather than just y+vertical speed.
This code works okay, but the instant that the player comes into "general" contact with another jumpthrough, say one that's eye level to him while on another jumpthrough, he falls straight through the one he's currently walking on. I assume this is because I checked for the object and not the instance he is currently standing/walking on.
However, when I change !place_meeting(x,y,objBlockJumpThrough) to !place_meeting(x,y,platformID), the instance's ID, the player glitches up get's stuck in the platform while he's jumping and has presumably a positive vertical speed. This doesn't make any sense because the game is checking if he ISN'T generally intersecting with the platform, not if he IS.
Sorry, but changing any object's solidity is 100% out of the question because I need for all objects to always stay unsolid.
It's so frustrating. :/
|