How do I make droppable and pickupable items

Get help using Construct 2

Post » Fri Feb 19, 2016 3:21 am

I am working on a project currently and am not a noob with this engine. Yet I cannot seem to find a way to make a droppable item, and then pick it back up. I've tried using the Pin Behavior (all it does is make my guy not move and doesn't work) and there seems to be no other way.

If there is some easy way to do this, great. If not, i'll still try. thanks in advance
B
6
S
1
Posts: 18
Reputation: 444

Post » Fri Feb 19, 2016 4:46 am

Make sure your pin behavior is on the item, not the player. A simple system would be to pin the item to the player when you pick it up, and unpin when you want to drop it.
Mistakes were made.
B
53
S
27
G
114
Posts: 1,697
Reputation: 64,442

Post » Fri Feb 19, 2016 7:42 am

Depends on how you want to pick them up and move them. You could use drag n drop behavior.

with pin behavior on event unpin
B
29
S
13
G
10
Posts: 355
Reputation: 8,327

Post » Fri Feb 19, 2016 3:57 pm

I'll try this out and let you know. Thanks!
B
6
S
1
Posts: 18
Reputation: 444

Post » Fri Feb 19, 2016 6:25 pm

I have it assigned to "E" to pin to my little guy. I want to make it so he has to be in a certain radius of it to pick it up, and also have it move into his hand, not just generally follow him. Is that possible?

EDIT: I have tried to make it when the player is overlapping the item it will pick up, no dice.
B
6
S
1
Posts: 18
Reputation: 444

Post » Fri Feb 19, 2016 9:47 pm

Here you go, see if this helps

https://www.dropbox.com/s/gf5pnjr3jcrwr ... .capx?dl=0

Use arrow keys to move, pin is automatic when you run over the black dot, and press E to drop it.
Mistakes were made.
B
53
S
27
G
114
Posts: 1,697
Reputation: 64,442

Post » Fri Feb 19, 2016 10:28 pm

I see what you did there and it basically answeres my question. But I do have one more thing that bugs me for the sake of neatness, is there anyway to make it, when it pins, move to a certain point on the sprite? I know I could do it with a move object thing, but I want it to move there regardless of where the player is. Is that even feasibly possible with this engine?

EDIT: Got it to work! I simply went and said to change the location to origin point of the object. Works like a charm now!
B
6
S
1
Posts: 18
Reputation: 444

Post » Fri Feb 19, 2016 10:58 pm

Great!

Just an additional quick tip - you can add additional image points to a sprite besides just the origin point, and get those point positions via expressions for all sorts of uses. You can have different points/locations on different animation frames too.
Mistakes were made.
B
53
S
27
G
114
Posts: 1,697
Reputation: 64,442


Return to How do I....?

Who is online

Users browsing this forum: Google [Bot] and 53 guests