Character gets stuck on platform sprite

0 favourites
  • 10 posts
From the Asset Store
2d warrior machrom platformer game character assets
  • .capx file here:

    Hello all!

    My current problem rests in a "little" obstruction or...I don't know what it is...that stops Mr Stick (that's the stick man you can control) from moving forward just as he reaches the apex of the two-triangle incline (made of two instances of the platform45Slanted sprite object.

    Once the .capx loads, simply start running to the right (A and D to move left and right, W to jump) and once the PlayerBox (the sprite objected that the MrStick image is set to) reaches the top of the first slanted platform instance and apparently collides with the second, it just gets stuck.

    This doesn't happen 100% of time and doesn't seem to happen again after the first time (ie: you move away and come back again). I have Dr Box (that's the box with "evil" eyes) running on Simulate Platform movement and I've noticed he occasionally gets stuck, too...usually after Mr Stick is already stuck. But it seems to happen much less with Dr Box.

    I have checked the collision polygon settings for BOTH instances of the slanted platform sprite. It's a triangle shape stretched as far as each point can go to their appropriate corners of the sprite. Both sprites on are equal in terms of the Y-axis. Both are the same size.

    The ONLY possible explanation I can think of is that there is (I THINK) a pixel-wide space between the two instances. I haven't devised a way to test this or if it's even the actual problem.

    Could someone poke around see what they can find, please? Thank you, much!

  • *bump* My apologies if the bump is too soon as I only posted this yesterday, but it was already on page 4. I was afraid it would get lost with no reply.

  • You should use a non changing invisible rectangular collision sprite as your character and then stick the stickman graphics on top and set it so it follows the invisible collision.


    Because here you're collision is resized to fit your character while he is running.

    When you the frame changes from 1 (narrow collision) to 0 (wider collision) and when you're on slanted surface, the bottom corner of the rectangle collision gets into the surface collision. Usually you have a push off algorithm going on, but well... You can get stuck.

  • What Yann said...

    I learned this lesson the hard way as well.

  • Yann - *BLINKS* Well, that's news to me. I assumed my PlayerBox sprite was staying uniform in size and not adjusting despite the frames of the MrStick sprite. If that's the case, how do I keep the PlayerBox sprite (or the collision lines, as you said) from resizing? And thank you very much for checking it out for me.

    RangerJim - First, I LOVE that you have a Pixar character for your avatar. Second, thank you for also checking it out and confirming what Yann shared.

  • 1. clone your player object (rightClick clone and click on the viewport)

    2. rename it "playerSkin"

    3. edit your player object, delete all animations, delete all the frame of the default animation, and just put a rectangle on frame 0.

    This way you won't have to rewrite most of the code

    4. on event sheet do an "always -> playerSkin set position to player"

    5. just for the part concerning the animation on your event sheet, rewire that on the playerSkin object

    And be carefull about origin, put everything on the bottom it's easier

  • Yann - Forgive me...I'm a tad confused.

    Am I cloning my PlayerBox - that which the player actually CONTROLS but is invisible - or am I cloning the MrStick sprite that the player sees when playing the game?

    I haven't yet done as you suggested, but I did try editing the origin point on my PlayerBox. APPARENTLY, moving the origin point on the PlayerBox down one pixel seems to have fixed the problem...for the moment. The seemingly random nature of when the collision with the platform sprite makes it difficult to tell.

  • well it's common practice to use an invisible rectangle as your true character and make the graphics/animation of your character follows it.

    What I discribed earlier is just the step to follow to have the least amount of thing to change in your event.

    Mainly transforming the original player sprite into the aforementionned rectangle (so you still control it) but before, you clone it to create a new object but with your animations in it, so you just have to re write the events concerning animation to target this new clone (clone isn't an instance by the way it's a whole new object)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Yann - Oooooh! Okay. I gotcha now. Actually, that IS what I was doing, but when I saved the .capx to be shared, I forgot to set the PlayerBox (the object actually being controlled) back to invisible. I do have my MrStick character (images and animations and all) set to follow the PlayerBox.

  • Oh, indeed, my bad, you can discard all my replies I didn't see you were already doing what I discribed (:

    So for now I don't know why you have collision bugs, one of my hypothesis at some point was imprecision in the collision polygon or in the shape's position. But it seems you were pretty cautious here.

    So, dunno (:

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)