Pin to Unpin to Physics force

  • Hi,

    I'm trying to get my player to lift up a box and then be able to throw it out again.

    If you hit the left mouse, the box is pinned to the player's image point.

    Once pinned you can unpin it by hitting the right mouse but a second action attached to that event (right clicking the mouse when the object is pinned) should evoke a pysics force 5 and hurdle the box away to a defined position.

    Only, the box just unpins, falls to the floor and the physics action is ignored.

    Any help on how to make my box get thrown away ? Did I make a mistake using the "pin" behaviour to simulate lifting up the box and keeping it lifted ?

    Thanks,

    J.

  • I might be able to help, if I could see the CAPX

  • I don't know how to attach it, but these are the events I've got so far:

    1. Mouse on left button clicked + player is overlapping Box > box set position to player (image point 1) + pin to player

    2. Mouse on right button clicked + box pin is pinned > pin unpin + apply force 5 towards position (Player.X+5,Player.Y+5, imagepoint 0)

    The Player has Platform behaviour, the box Pin behaviour and Physics behaviour.

    Does that tell you anything usefull ?

    Cheers,

    J.

  • Get yourself a DropBox Account and use this, to pass on your CAPY to the people who want to help you

    This might help:

    How to use DropBox

  • dl.dropbox.com/u/23570533/Games/index.html

    This is the link. For some reason the PNG pics don't show but the if you approch the bigger object with the smaller object you should be able to lift it by clicking your left mouse. The next step should be to throw it away again but if you hit the right mouse it just triggers the "unpin" action, not the physics.

    If anybody has a general tip on how to make a player lift up a box an throw it a couple of pixels further away, be happy to hear it.

    Thanks,

    J.

  • This is the linnk to your game, not to your CAPX

  • Saving and sharing projects.

    A capx will mke it easier to see what's going on indeed.

    Also, you should make a search on the forum the question was already asked several times.

    The reading of the physics basics and physics advanced tutorials should help you.

    I've had overseen the title of the topic and only focused on the pin.

    Actually, you will have unexpected behaviors using the pin behavior with the physic behavior (learn more in the tutorials linked).

    This recent topic is about a close subject and should provide leads to explore.

  • This is the Capx link: dl.dropbox.com/u/23570533/Game.capx

    I'll check out some more forum posts. Thanks a bunch !

    J

  • I didn't open your capx, but reading your explanation it looks like something I encountered a while ago. Basically you need to wait 1 or 2 ticks between the moment you unpin and the moment you apply the throwing force... I think.

  • Problems with your project:

    1, The Box uses the Physics behaviour, Mario uses the platform behaviour.

    Objects that use physics only interact with other objects that use Physics.

    2, Your Mario Sprite is too big ( I think it it was about 400x300 scaled down to its current size) and the box is only about 70 x 60)

    You really need to spend a few hours reading through the manual, or doing some of the tutorials!

    See Kyatric's post (above) for some links.

    Good luck

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Same Topic?!

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