Make an object pinned and follow another

Get help using Construct 2

Post » Wed Nov 14, 2012 3:35 pm

Hello!

I was wondering how to pin an object to another one and make it follow it.

The idea is to spawn it in players arms, and make it look like the player is carrying it. So the object moves with the player.

Thanks.
B
4
Posts: 14
Reputation: 510

Post » Wed Nov 14, 2012 3:51 pm

Add the "pin" behavior to your prop object,

then create an image point on your sprite where you want the object to be pined to eg: his hands

then use the action "pin to" on the prop in your event sheet to attach it to the arm image point

B
50
S
21
G
8
Posts: 844
Reputation: 10,299

Post » Wed Nov 14, 2012 4:10 pm

[QUOTE=justifun] Add the "pin" behavior to your prop object,

then create an image point on your sprite where you want the object to be pined to eg: his hands

then use the action "pin to" on the prop in your event sheet to attach it to the arm image point

[/QUOTE]
It works, but I can't find image point in the "pin to object" action.
There are modes like "Position & angle", etc.

Any ideas?
B
4
Posts: 14
Reputation: 510

Post » Wed Nov 14, 2012 4:30 pm

Hi dino000. You can use invisible sprites like helpers. Add an event "system:every tick: set position to another objet" for each invisible helper. Then pin your stuff to the helpers


B
9
S
1
G
1
Posts: 2
Reputation: 1,617

Post » Wed Nov 14, 2012 4:43 pm

Imagepoint is something you set in the image and animation editor.

Then you use the common expression object.ImagePointX(index) or object.ImagePointY(index) depending on the position you're looking for.
Before pinning the object, you set its position to the imagepointX/imagepointY location first.
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 6,998
Reputation: 57,786

Post » Wed Nov 14, 2012 6:58 pm

[QUOTE=Kyatric] Imagepoint is something you set in the

Then you use the common expression object.ImagePointX(index) or object.ImagePointY(index) depending on the position you're looking for.
Before pinning the object, you set its position to the imagepointX/imagepointY location first.[/QUOTE]

I did it. But my problem is that when I pin an object to another, it sets it to origin and not to image point.

I've sent you a link of my dropbox with my project, if you wouldn't mind looking at it.
B
4
Posts: 14
Reputation: 510

Post » Wed Nov 14, 2012 7:32 pm

Your player "Walking" animation's frames have no imagepoint(1).
Add this imagepoint in each frame and the game works as intended.

Prefer sending capx rather than compressed folder (a capx is basically already a zip file of the folder) and prefer to post your project (are at least a reproduction of the issue) in public rather than sending in PM, more people can give more help quicker.
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 6,998
Reputation: 57,786

Post » Wed Nov 14, 2012 8:49 pm

[QUOTE=Kyatric] Your player "Walking" animation's frames have no imagepoint(1).
Add this imagepoint in each frame and the game works as intended.

Prefer sending capx rather than compressed folder (a capx is basically already a zip file of the folder) and prefer to post your project (are at least a reproduction of the issue) in public rather than sending in PM, more people can give more help quicker.[/QUOTE]

Oh, thank you very much.

I wanted to post my link here, but apparently I do not have enough reputation points.

Sorry about that.
B
4
Posts: 14
Reputation: 510


Return to How do I....?

Who is online

Users browsing this forum: badmoodtaylor, Megavolt and 11 guests