0 Favourites

[Fixed] Platform engine failing collisions

This forum is currently in read-only mode.
  • Hello there,

    After not having touched MMF2 at all for the last couple of years I decided to go ahead and try my hand at game development again, but this time with Construct. However, it seems I got a little rusty. In fact, I can't even get a basic platform engine right anymore! With MMF2 I used to make custom platform engines all the time using loops to I could try to pixel perfect collisions. I'm trying that same approach here, but it looks like I've lost my touch. Can you guys help me?

    When you download the CAP first run it. You'll see what's going wrong: the player does stop falling, but actually falls into the ground. It's supposed to rest on top of the red collider bits.

    What am I doing wrong? Do the loops work differently here?

    [Download]

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • In which version did you do the .cap ? I'm on R1 and can't open the file.

  • This one is made in the latest one, R1.2

  • Well, my guess would be that it doesn't check for overlapping during the loop.

    In the layout, if you raise the objPlayer object manually by 5 pixels (should now be at 41 on Y axis), you'll see that the player stops correctly because it's right after a loop.

  • I managed to fix the problem I remembered something I'd do with my platform engines in MMF2. What I did now is basically this:

    On loop "moveY"
    If inertiaY is greater than 0
         move objPlayer down the Y axis by 1 pixel
    [/code:271gskcn]
    
    After which there is a collision detection. However, as with the logic I got used to with MMF2, the position of detectors (and the player sprite for that matter) isn't updated yet. This can either be fixed by moving the collisions before the positioning events, or by moving the detectors together with the main player object. That last thing is what I did.
    
    [code:271gskcn]
    On loop "moveY"
    If inertiaY is greater than 0
         move objPlayer down the Y axis by 1 pixel
         move objBCollider down the Y axix by 1 pixel
    [/code:271gskcn]
    
    Now it's functioning properly
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)