How do I make a "Yoshi Tongue" and "Toss" mechanism?

0 favourites
  • 6 posts
  • Hi everyone,

    I'm hoping someone can help me. I'm trying to program in a Yoshi Tongue that will extend from the player character, and be able to grab an enemy that will then be brought back to the player to be carried. The player can then toss the enemy.

    I can get it to sort of work, but for the most part it only works once and is prone to bugs if the player is moving while the tongue is extended. Also it only works in one direction, but I imagine reversing it is a matter of mirroring all the formulas.

    Another problem is that the formula I use for tossing the enemy (apply impulse at image point) doesn't take momentum into account and I'm not sure if there is a better tool to use.

    The platformer "Levelhead" has pretty much the exact system I'd like to use where boxes can be picked up with an extending arm and then thrown:

    youtube.com/watch

    File: drive.google.com/file/d/1w4wxHTXKtNMiCdJssHCIc1lnB7Xd3pmy/view

    Is anyone able to help me? Thank you for any and all responses.

    Edit: Demo Controls. Left/Right to move left and right, up to jump, space to extend grabber/toss enemy

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hi everyone,

    I have been experimenting for the past few days and I feel like I have something that almost works. At the very least, it shows what I want to happen. Unfortunately, it is incredibly buggy and it is easy to get it to lock-up if the player moves too quickly. It also stutters occasionally for reasons I can't identify.

    Is anyone able to have a look at this and see if they can help me clean it up? Anything at all would be a huge help.

    Link: drive.google.com/file/d/16cHFBbOtAbg15oPorF00S_9ME2V1hWBx/view

    Controls: Left/Right = movement; up = jump; space = extend/throw

    Note: The commands above the screenshot are to press Z to reset and to pin the grabber to the player.

    Thank you for any and all responses.

  • Sorry I don't have any sort of a detailed solution for you, but I can tell you at least that you decidedly do not want to mix physics with any other type of motion behavior, including pin.

    No detailed physics simulations were involved in Yoshi mechanics or Levelhead. Was there any particular reason you're using physics? Pin and tween should be sufficient to get that type of grapple, along with the platform behavior.

  • Thanks for the response :D.

    I'm quite unfamiliar with Construct and was having trouble adding falling behavior. I want players to be able to throw the objects they pick up across distances but couldn't get a natural parabolic arch to work. Honestly, I'm not even sure where to start. Physics for while it is in the air seems to be the closest I've gotten.

    I haven't played much with the "Platformer" behavior so I'll see if I can get that to work. I stopped early on in my experiments because it wouldn't throw at a distance the way the impulse tool has. That said, I was less experienced than I am now so I might be able to solve that problem.

    I'll keep experimenting. Thanks again for the response.

  • A parabolic arc would consist of a constant horizontal speed, and a vertical acceleration downward (gravity). The exact trajectory will depend on the initial speed and angle as well as the amount of gravity. The platformer behavior has gravity built in, as does the bullet behavior which may also be useful.

    In general though, if you're making a physics game, use physics for all movement. If you aren't, don't use the physics behavior at all, and make your own.

  • Thanks a lot for the help you've given me. I believe I finally have something workable. There are almost certainly glitches I'm not noticing but seems to be working the way I want.

    Grabber:

    Thrower:

    Link: drive.google.com/file/d/18KXX8RhIM1IbYY--4ixf-7lFt0hro3Pb/view

    Controls: Left/Right to move left and right, Up to jump, space to extend grabber and to throw. Z or hitting the blue exit will reset the layout.

    Edit: I added a fix for if the thrown item ends up inside the player or level.

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