E
Enagic
Guest
Hi there! I'm really confused with this. I imported my GMS1.4 project into GMS2 and it works perfectly. But since I didn't have much progress and I wanted to get used to the new program, I started it again on GMS2.
Until know, everything perfect, but the problem came when trying to work with one-way platforms. In the previous project, I used instance_place for detecting the platform below the player so it could collide properly. It even worked with two platforms one right above the other. But now it doesn't.
I'm using the exact same code for collisions than before, but now I suppose that, if I have two platforms nearby each other, the function instance_place will detect both of them? This is a problem because I'm detecting if I'm about to collide with it, without being inside it. If one platform is right above the other, then it will detect that I'm inside one while colliding with the other, and the player will pass through it.
The weirdest thing of all, is that in the imported project (from GMS1.4 to GMS2), that doesn't happen. It work perfectly, as always, even with two platforms and all. And is the EXACT same code. I've checked everything involved in that collision, and everything is the same. So with two projects on GMS2 with the same code for the collision, one will detect both platforms and one won't.
If someone is curious, this is the code (in both projects in GMS2):
And here's an example of it working and not working:
I've checked everything involved in the collision and everything is the same. So that's it! I literally have no idea and I'm reaaaally confused about it. Any help is welcome <3
Until know, everything perfect, but the problem came when trying to work with one-way platforms. In the previous project, I used instance_place for detecting the platform below the player so it could collide properly. It even worked with two platforms one right above the other. But now it doesn't.
I'm using the exact same code for collisions than before, but now I suppose that, if I have two platforms nearby each other, the function instance_place will detect both of them? This is a problem because I'm detecting if I'm about to collide with it, without being inside it. If one platform is right above the other, then it will detect that I'm inside one while colliding with the other, and the player will pass through it.
The weirdest thing of all, is that in the imported project (from GMS1.4 to GMS2), that doesn't happen. It work perfectly, as always, even with two platforms and all. And is the EXACT same code. I've checked everything involved in that collision, and everything is the same. So with two projects on GMS2 with the same code for the collision, one will detect both platforms and one won't.
If someone is curious, this is the code (in both projects in GMS2):
Code:
var platform = instance_place(x,y+vspd,obj_platform);
if (platform != noone) and sign(vspd) == 1 {
if !place_meeting(x,y,platform) {
while !place_meeting(x,y+sign(vspd),platform) {
y += sign(vspd);
}
vspd = 0;
}
}
And here's an example of it working and not working:
(Platforms are highlighted in purple, Player's mask in blue)
Old project (GMS2) working perfectly with two platforms.
New project (GMS2), passing through platforms.
Old project (GMS2) working perfectly with two platforms.
New project (GMS2), passing through platforms.
I've checked everything involved in the collision and everything is the same. So that's it! I literally have no idea and I'm reaaaally confused about it. Any help is welcome <3