Collision while pinned problem

0 favourites
  • 7 posts
  • Hi,

    When my player object and a rectangular 'container' object are pinned and the 'container' is being pushed into a collision with another container or a wall, they become unpinned and the 'container' is stuck! I have to pin multiple times and press in the opposite direction to unstick it. I was having more trouble with this originally because when the 2 were pinned after the 'container' was stuck, I could re-pin and march the 'container' right through a wall that it was stuck to, aaaahhh. Somehow, applying the 'car movement' behavior without the default controls mended the invisible wall problem (the strangest thing is that the 'car movement' doesn't even seem to be enabled). Anyways, in a perfect world, the 'container' would just stop and not unpin on collision with other solid objects. It should stay pinned until prompted to unpin via the spacebar.

    Could someone please help me with this?

    Any help is much appreciated!!! Thanks in advance.

    I have attached my capx file dropbox link below. I'm having a couple problems with behaviors when objects are pinned to each other.

  • When saving your project, select "Save as single file" to get a .capx. You have attached a .rar file of your project files.

    The .capx is basically just an archive of your project (like .rar), but we can open it directly in C2 without having to extract the archive and cluttering our folders with a bunch of project files.

    Please upload a .capx, and I'll have a look to see if I can help you.

  • Hi Nimtrix,

    I didn't want to bother you again. You've already done a lot.

    I really appreciate it.

    Here is my .capx file:

    You'll notice, that I tried to solve the problem by having the player spawn a solid object when the containers collide with solid objects, but this is producing a nasty little backwards jump when the solid object spawns. If that worked, I was just going to destroy the spawned object when the player and the container become unpinned, but the nasty jump isn't selling me on my idea..

    Thanks again.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Oh, I didn't realize it was this game. The only way I can think of is to move the container away from the player when it collides. It's not perfect though:

    ThePusher_Edited2.capx (r99)

    The pin behaviour might not be the best thing to use for this game as it doesn't really work well with other behaviours. It kind of overrides the other behaviours like solids. Maybe using custom movement or physics to move the boxes would be better, I don't know.

    I'm sorry, but I'm out of ideas on this one. Maybe someone else can come up with a better solution.

  • Ok, so I couldn't leave it alone. I made an example of pushing and pulling objects with 8-dir behaviour, and as I thought it's a LOT more reliable than pinning.

    TopDown_PushPull.capx (r99)

    You can have a go at implementing it yourself. Give me a shout if you encounter any problems.

  • Thanks, I'll take a look

  • That's great Nimtrix, I'll try implementing it. Thanks a lot!!

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