Character sprite interacting with other objects

Get help using Construct 2

Post » Wed May 30, 2012 7:25 pm

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.
B
4
Posts: 18
Reputation: 811

Post » Wed May 30, 2012 7:38 pm

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?
B
45
S
8
G
4
Posts: 414
Reputation: 6,805

Post » Wed May 30, 2012 10:47 pm

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.
B
12
S
5
G
5
Posts: 26
Reputation: 4,001

Post » Thu May 31, 2012 5:35 am

Thank you both, pinned is what I need. Good example joeykid6
B
4
Posts: 18
Reputation: 811

Post » Sat Jun 02, 2012 9:47 am

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.
B
4
Posts: 18
Reputation: 811


Return to How do I....?

Who is online

Users browsing this forum: Braus, jul, nimos100, Yahoo [Bot] and 17 guests