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

0 favourites
  • 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!

  • 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?

  • 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).

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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.

  • 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.

  • 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?

  • 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).

  • Hey I figured it out using only the "bullet" behavior. Thanks for the input, it's pretty flawless as it stands now!

  • 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.

  • 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.

  • Completely understandable and thank you for the tips, hopefully I'll be able to work out something as well.

  • Thought I'd give this a try. Uses LiteTween: viewtopic.php?t=70700&start=0

    http://www.blackhornettechnologies.com/ ... ample.capx

    P to pickup, Space to throw.

  • Interesting, might be useful in the future. I'll try it out in mine, too, could make things cleaner.

  • Thought I'd give this a try. Uses LiteTween: viewtopic.php?t=70700&start=0

    http://www.blackhornettechnologies.com/ ... ample.capx

    P to pickup, Space to throw.

    Not sure if its just me but that LiteTween plugin seems to be very outdated and I cannot run C2 with it.

  • I just made this yesterday, and the plugin was updated in December. I don't see how this is outdated.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)