How do I "pick up and throw" like in Zelda?

Get help using Construct 2

Post » Mon Feb 08, 2016 1:40 pm

Okay the game is already a little long winded, and it would be hard to isolate for demonstrating the issue I'm having, but I'll try to explain it here:

I am making a Zelda-style game, and I'm stuck pretty bad on how to throw an item. I've been able to pick up an item, but there's a problem when it comes to throwing said item. Are there any examples anywhere regarding something like this?

In case anyone doesn't understand, I've recorded a short video of the technique I'm wanting from an actual Zelda game. I accidently go to the map first, but it's the basic "pick up a pot and throw it".

https://youtu.be/XkB5eGrmjE4

Thank you in advance!
B
25
S
6
G
6
Posts: 265
Reputation: 3,696

Post » Mon Feb 08, 2016 4:22 pm

How are you picking it up?
I would say the best way would be to destroy the one you picked up, spawn another at the same time with a bullet behavior attached, have that one also with a timer behavior set to a "distance" of whatever time looks right (0.3,0.5, etc) have the angle set the same as player angle. On "distance" timer tag have destroy animation play and destroy pot.

Am I missing something?
Check out my completed games on the Arcade! Capt. Doe Save the Universe! & Clicker Wizard!
B
68
S
17
G
8
Posts: 637
Reputation: 9,420

Post » Mon Feb 08, 2016 5:51 pm

chrisinfinger wrote:I would say the best way would be to destroy the one you picked up, spawn another at the same time with a bullet behavior attached, have that one also with a timer behavior set to a "distance" of whatever time looks right (0.3,0.5, etc) have the angle set the same as player angle. On "distance" timer tag have destroy animation play and destroy pot.


Yeah, I have him actually picking up the item that is placed:

The item (in this case a bush) already has a disabled bullet behavior.

When doing the "pick up" routine, I get the UID of the item, and focus on that, lifting the exact same UID that is on the ground. I replace the ground area with a "respawner" so when you go to the next screen it triggers to replace it.

The problem I'm mainly having is the throwing part, I cannot seem to "throw" the item in hand. The items have a bullet behavior, and depending on which way the player faces it should throw that direction. I cannot seem to figure out the curve or if even bullet is proper for this action. The bush/pot/etc should not go in a straight line, but curve down, which I've kind of done by compensating for the Y value of it's position, but when I implement the same thing for the other direction it doesn't work properly.

I'm thinking it might be easier to do a custom movement, but I've never worked with it before.

I'll be honest here, it's a remake for me, personally, to enjoy. I can PM you a CAPX if you wish, but keep in mind that it's early stages (I just started it less than a week ago).
B
25
S
6
G
6
Posts: 265
Reputation: 3,696

Post » Mon Feb 08, 2016 7:31 pm

Okay, I've refined the coding and have a few things a little more streamlined. I have two problems, but the main problem is on LinkLift page where the exact same theory but opposite for left/right is near the bottom (ThrowRight and ThrowLeft groups).

ThrowRight works properly, but ThrowLeft does not for some unknown reason.

Here's a CAPX with the latest changes:

[REMOVED]

The game starts on the lower left screen, just go up one screen via the ladder/stairs and you will see bushes you can pick up. You CANNOT YET throw up and down, just left and right, where the issue is.
Last edited by roracle on Tue Feb 09, 2016 1:44 am, edited 1 time in total.
B
25
S
6
G
6
Posts: 265
Reputation: 3,696

Post » Mon Feb 08, 2016 9:22 pm

Okay, I'll narrow it down:

This SHOULD work but it is NOT working in ANY way. I know this because the first group "ThrowRight" works perfectly fine, but doing the opposite for "ThrowLeft" doesn't work the way expected. Yes I've originally tried "Self.Y" method on ThrowLeft, did that first, but assumed I'd try something else before I took the screenshot.
Image
B
25
S
6
G
6
Posts: 265
Reputation: 3,696

Post » Mon Feb 08, 2016 11:50 pm

For left and right you could use gravity along with bullet behavior to make it drop after thrown, your timer should make it break simulating hitting the ground when really it just looked like it, collisions with other objects could break it as normal.. Up and down shouldn't show drop, if so it could be done with scaling object size down to simulate fall when thrown up...
as for direction of throw, set bullet angle of motion to player.angle wouldn't work?
Check out my completed games on the Arcade! Capt. Doe Save the Universe! & Clicker Wizard!
B
68
S
17
G
8
Posts: 637
Reputation: 9,420

Post » Tue Feb 09, 2016 12:06 am

Could you give me a capx of an example of such technique? The gravity+bullet, that is? I can imagine it but my mind is so wasted on trying to figure this out all day (yes, all day).
B
25
S
6
G
6
Posts: 265
Reputation: 3,696

Post » Tue Feb 09, 2016 1:45 am

Hey I figured it out using only the "bullet" behavior. Thanks for the input, it's pretty flawless as it stands now!
B
25
S
6
G
6
Posts: 265
Reputation: 3,696

Post » Tue Feb 09, 2016 9:08 pm

Hey, I've been following this thread - would you be willing to post a capx example of what you have got working? I've also been working on a "throw" action but there are more problems I keep running to, and also my code is really hack-job so I was looking for better ways to do it than my crappy band-aid job of code.
B
17
S
3
G
1
Posts: 13
Reputation: 1,370

Post » Tue Feb 09, 2016 10:05 pm

That's pretty much how mine's been, too. However, I don't feel inclined to share (I had it up but took it down) because I have a lot of other things I've worked on, and this isn't open source in the least. What I can do is tell you it involves separating each direction into it's own general code blocks, and it uses a lot of sub-events and carefully placed actions (things in the right order as little things like that matter).

The picture I posted is very long winded and not correct, as it was actually easier than is depicted.

It's not been easy, but it can be done. What I can say is throwing left and right has to do with bullet gravity, remembering where you threw it from (on Y axis) in a variable, and if it's 32 or 64 below that variable on the Y axis, destroy the object.
B
25
S
6
G
6
Posts: 265
Reputation: 3,696

Next

Return to How do I....?

Who is online

Users browsing this forum: MathNook and 48 guests