0 Favourites

Character sprite interacting with other objects

  • I have a family of sprite objects (rectangular containers) that I want my character sprite to have the option of attaching to when the 2 are in close proximity to each other and releasing at will. While attached, I want the character sprite to move forwards and backwards with the 'containers'. My 'character' was able to push the 'containers' forward on collision by including the move at angle of my character action, but it looks quite glitchy because it's not a smooth animation (I need to move it at 25 pixels per second and it jumps, so I think if I apply the 8 direction movement, it will be smoother, but the when I tried that, all of the 'containers' move when I press the direction keys..??) and most importantly, I couldn't attach the 2 sprites so they move forwards and backwards together.

    Can anybody help me with these dilemmas? I'm a total newb and any info would be much appreciated. Thanks in advance for your help.

  • You know about the pinned behavior?

    Maybe when they are close, pin them and control the container instead of the player sprite?, then upon release, un-pin and switch controls back to the player sprite?

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • Is this what you're after?

    http://dl.dropbox.com/u/47015043/construct2/pinned-container-example.capx

    Hold down the space bar to attach, then tap space again to detach.

  • Thank you both, pinned is what I need. Good example joeykid6

  • Ok, so I thought it would work with the pinned behavior, but there are a couple of problems:

    1) when I press space to pin my character sprite to the "container" sprite, the 2 sprites seem to stay in one area and just ever so slightly drift in the direction that I press because I need the solid behavior on the 'containers' to make sure that the player can't walk through them, they don't go through walls, etc. The transition is smooth without solid behavior, but how do I keep the smooth transition to pinned without loosing the solid attributes?

    2)Another problem is that once my player is pinned to the 'container', the movement should be only forwards and backwards, but always facing the same direction (example: if the 'container' sprite is pinned on the southern side of player, the player stays facing South while only being allowed to move North and South until unpinned). With the 8 directional movement applied while the sprites are pinned, it doesn't work. Does anybody shed some light on how I can mend this?

    Sorry, this might be easy stuff, but I'm so fresh at this. Thanks.

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