How do I Make Pinned Objects Collide With Solids

0 favourites
  • 8 posts
From the Asset Store
Wall Pin Board is a hyper causal game developed for fun and inspired by YouTube video whose link is given in description
  • G'day All,

    I'm having trouble with a pinned object travelling through solid blocks.

    I have a character ("Mot") with Platform Behavior. When Mot runs into a Solid "Block", he stops (as would be expected).

    Now, Mot can attach different "Legs" that can do different things (move faster, jump higher etc). If you press Space while Mot is touching a set of "Legs" (the green rectangles), then "Mot" is pinned to "Legs", his Platform Behavior is disabled, and the "Legs" Platform Behavior stops ignoring input (if Mot already has Legs, then pressing Space will make him dismount):

    Which looks like this:

    The problem is, now that Mot is attached to Legs, the Mot sprite no longer interacts with Solid objects:

    If I let Mot keep the Platform behavior enabled and just Ignore Input, the pinned sprites shudder against each other.

    I have considered making the Legs sprites big enough to cover the whole of the character, but that seems a little excessive, and it seems like there is something simple that I am missing.

    Any ideas what the problem might be? Or am I going about the whole thing the wrong way? Should I keep the platform movement on Mot (but have him somehow suspended off the ground)?

    Any help would be appreciated. Cheers.

  • Don't use pin. Try using "Set Position to another Object"

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks for the reply TheDom

    I'm already setting the position of "Mot" (the blue box) to an Image Point of "Legs1" (the green rectangle). If I remove the Pin, then "Mot" jumps into position fine, but once you move "Legs1", the legs move, but "Mot" stays in place.

    Is there something I am missing? Is there a way to make "Mot" stay attached to "Legs" without the Pin behaviour?

  • ..you can use invisible "PlayerBox" sprite for platform behavior..."Mot" and Legs just pin to "PlayerBox"..

    "Legs" is pinned... set "PlayerBox" max speed...set jump strength...else..

  • Hi korbaach, thanks for the ideas.

    "Mot" was always going to be just a Hitbox/Playerbox, with the character sprite attached, but I need to keep the Platform behaviour on "Legs" so that they will fall back to the ground if you detach them while in the air (without Platform, then "Legs" just hang in the air).

    What you have suggested is pretty much what I have ended up doing. I'm keeping Platform on "Legs", but not turning on Input at all, while keeping Platform active on "Mot" at all times.

    What I have done is make a new animation frame on "Mot" with a larger hitbox to encompass both the character sprite and the "Legs" sprite, then when Legs=Attached, change "Mot" frame and set "Legs" to invisible.

    It will take some tweaking to get it all to work with the proper graphics (once I have made them), but I think this is the way for me to go forward.

    Eventually I want to make it so the character can jump straight from one set of legs to another without touching the ground, but that is giving me even more trouble than this clipping issue.

    Thank you both TheDom and korbaach for taking your time to give me a hand.

  • but I need to keep the Platform behaviour on "Legs" so that they will fall back to the ground if you detach them while in the air (without Platform, then "Legs" just hang in the air).

    ...add "Legs" variable.. "fall"..... if you detach them while in the air...set "fall" to true(1)

    "fall" is true(=1)...."Legs set Y to ...lerp(Legs.Y,ground.Y,dt)

    (..or 2*dt..6*dt....etc)

    On collision with ground ..set "fall" to false(0)

  • korbaach ooh, I had seen the word "lerp" used around the place, but didn't know what it was for. I'll have to give this a go when I get the chance. I'll keep you updated with the results.

  • Hmm, the Lerp seems to do weird things. I can't get "Legs" drop at the right speed, and they actually fall slightly into "Block" when they land (rather than just resting on top of "Block"). Also, If I detach while still on the ground, "Legs" actually slide through "Block" and stop at the bottom of it.

    Most of these problems can probably be overcome with additional Events/Actions, but at the moment that is more work than I have time to put into it.

    Thanks again for your help korbaach

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