Pin to Unpin to Physics force

Get help using Construct 2

Post » Sat Feb 11, 2012 3:10 pm

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.
B
4
Posts: 17
Reputation: 434

Post » Sat Feb 11, 2012 3:28 pm

I might be able to help, if I could see the CAPX
B
42
S
19
G
12
Posts: 723
Reputation: 13,911

Post » Sat Feb 11, 2012 3:51 pm

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.
B
4
Posts: 17
Reputation: 434

Post » Sat Feb 11, 2012 3:55 pm

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 DropBoxWeishaupt2012-02-11 16:05:41
B
42
S
19
G
12
Posts: 723
Reputation: 13,911

Post » Sat Feb 11, 2012 4:29 pm

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 » Sat Feb 11, 2012 5:36 pm

http://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.
B
4
Posts: 17
Reputation: 434

Post » Sat Feb 11, 2012 5:57 pm

This is the linnk to your game, not to your CAPX
B
42
S
19
G
12
Posts: 723
Reputation: 13,911

Post » Sat Feb 11, 2012 7:09 pm

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.
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 » Sat Feb 11, 2012 7:45 pm

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


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

J
B
4
Posts: 17
Reputation: 434

Post » Sat Feb 11, 2012 8:00 pm

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.
B
60
S
22
G
14
Posts: 1,479
Reputation: 16,346

Next

Return to How do I....?

Who is online

Users browsing this forum: BackendFreak and 19 guests