Shoot and swing weapon from roap

Get help using Construct 2

Post » Wed Nov 20, 2013 8:04 pm

Am new to Construct2 and have been running in circles for a bit and figured it would be best to reach out. I am trying to create an action in a game that has a sprite (anchor) attached to another sprite (chain) that on the first click (A in the attached diagram) it shoots the weapon out with the chain attached, then when they press that same button (B in the diagram) it stops extending and drops like a swinging pendulum. I have tried a lot of custom movements, sine waves, physics, and pivot arms but cant seem to get it.

Attached is a file I have been trying to get this to work on as well as a diagram showing what I described above.

In the file you will notice I created an A and B button to easily map to the diagram but I would prefer for both actions to be done by clicking the same button twice.

File
neversettle.it/forums/weapon-swing.capx

Diagram
neversettle.it/forums/Untitled%20_6to7%20by%20UPAD%20Lite_06.png

B
14
S
2
Posts: 39
Reputation: 689

Post » Wed Nov 20, 2013 9:03 pm

I dont have time atm to look into your capx. sry...

But wanted to suggest a few links.

Have you looked at Rex's plugin "swing"?

and
link to rex's wiki

That might give you some of what you are looking for.
B
20
S
6
G
4
Posts: 347
Reputation: 4,451

Post » Wed Nov 20, 2013 9:42 pm

I made a very simple example without plugins, its just the movement.

web example

capx

red one is button


*if you dont have r150 beta

here are the events
lennaert2013-11-20 21:45:10
Who dares wins
B
57
S
17
G
21
Posts: 1,878
Reputation: 19,562

Post » Wed Dec 18, 2013 7:58 pm

Thanks for both ideas, greatly appreciate it. They were both close but not exactly what I was hoping for, however they did inspire me to find the solution. See the capx file for it working.

neversettle.it/forums/swinging-object.capx

With that I now have two questions - how to the button release and launch to be the same button.

Second, how to make the "chain" sprite more of a rope instead of a straight line. Trying to figure out how to give the "chain" a physics like property where it would bend like a normal rope or chain connected to a flying object. I was thinking I could maybe spawn many small lines and link them together through hubs somehow so that it appears to be a bending rope/chain but not exactly sure. Any ideas?
kenn2013-12-18 19:59:31
B
14
S
2
Posts: 39
Reputation: 689

Post » Wed Dec 18, 2013 8:03 pm

Have you looked into the pin behaviour? It has pin rope-style.
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Wed Dec 18, 2013 8:13 pm

Yes, but cannot get it to work within my concept. Were you able to open the capx file? The rope has to extend from a pivot point and stay attached to another flying object. The rope then would need to have a rope like behavior vs just a rotating straight line. Can't get the pin behavior to accomplish this yet.
B
14
S
2
Posts: 39
Reputation: 689

Post » Wed Dec 18, 2013 8:22 pm

couldn't you use the straight line for the movement, set it invisible and use pinned rope style sprites to fake rope animation?
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Wed Dec 18, 2013 10:06 pm

Not sure I exactly follow. The distance of the rope will always be different so how would I be able to pin a sprite and have it be the right size dynamically. I think we might be on slightly different pages, if you can take a look at the capx file it would probably help a ton. The file I provided a link to is stripped down to just this one movement.
B
14
S
2
Posts: 39
Reputation: 689

Post » Wed Dec 18, 2013 10:47 pm

[QUOTE=kenn] I was thinking I could maybe spawn many small lines and link them together through hubs somehow so that it appears to be a bending rope/chain but not exactly sure. Any ideas?
[/QUOTE]

My reaction was aimed at this remark you made. I will download your capx tomorrow and see if my ideas could work within your setup. I think it will, although it might need some tweaking to get it to look exactly the way you want.LittleStain2013-12-18 22:48:45
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Thu Dec 19, 2013 12:00 am

Thanks appreciate it, just have been playing with it and have not figured out how to make them spawn and connect into a longer line. The other key is that eventually (not shown in that file) the rope returns as well so they would need to destroy as they came back.
B
14
S
2
Posts: 39
Reputation: 689

Next

Return to How do I....?

Who is online

Users browsing this forum: David181, Hadyurik, webebiz and 2 guests