How do I make a swing mechanic like this?

Not favoritedFavorited Favorited 0 favourites
  • 3 posts
From the Asset Store
Step onto the fairway and master every swing in Swing Masters
  • Hi! I would like to implement a swing mechanic similar to Mickey's Magical Quest (SNES) hookshot power-up. The idea is that, initially, the character would only be able to swing by coming in close range to the "block" from where they'll hang (like Mickey's hook ability in the second installment of the series); later on the game they'll level up the tool to be able to shoot it from a distance exactly like Mickey in the first game. I'm still new to the engine, so I tried a few tutorials of swinging objects but to no avail. I would appreciate some light on this.

    This gif shows Mickey using the hookshot in the first game: cdn.capcom-unity.com/capcom-unity.com/user/gregaman/55d7ad15b06fef56213089dc38617d2a.gif

    This gif shows Mickey and Minnie using the hook at close range in the second game (If anyone knows how to make this diagonal slide I would also appreciate it but it's not the focus for now): i.pinimg.com/originals/38/02/ab/3802ab0bdd37acbcf399412247cbb9fe.gif

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • The most common way, I think, is to use physics. On the example browser, look up the example "Physics: Distance Joint" and "Physics: Vehicle". Those should help you with learning the needed concepts.

    If you want a more traditional look — non-physics based — then you can use hierarchy. Here's how you can do it with hierarchy:

    Create the following objects:

    • 9-patch "Rope"

    - make its graphic a square filling up the canvas

    - On the layout stretch the object horizontally

    - set its "Origin" to "Left"

    - add the behavior "Sine", "set Movement" to "Angle"

    - rotate the object to make it start upright

    • Sprite RopeGrabDetect

    - make it a circle

    Events:

    When the rope is created, attach a RopeGrabDetect object to the rope.

    Event: Rope > On Created

    - Action 1: Create Object > RopeGrabDetect, X = Rope.BBoxRight, Y = Rope.Height/2

    - Action 2: Rope > Add Child > RopeGrabDetect

    Attach the player when it collides with RopeGrabDetect.

    Event: Player > On collision with RopeGrabDetect

    - Action 1: RopeGrabDetect > Add Child > Player

    - Action 2 (after the previous action): Player > Set Position > X = RopeGrabDetect.X + (adjust to your liking), Y = RopeGrabDetect.Y + (adjust to your liking)

  • The most common way, I think, is to use physics. On the example browser, look up the example "Physics: Distance Joint" and "Physics: Vehicle". Those should help you with learning the needed concepts.

    If you want a more traditional look — non-physics based — then you can use hierarchy. Here's how you can do it with hierarchy:

    Create the following objects:

    • 9-patch "Rope"

    - make its graphic a square filling up the canvas

    - On the layout stretch the object horizontally

    - set its "Origin" to "Left"

    - add the behavior "Sine", "set Movement" to "Angle"

    - rotate the object to make it start upright

    • Sprite RopeGrabDetect

    - make it a circle

    Events:

    When the rope is created, attach a RopeGrabDetect object to the rope.

    Event: Rope > On Created

    - Action 1: Create Object > RopeGrabDetect, X = Rope.BBoxRight, Y = Rope.Height/2

    - Action 2: Rope > Add Child > RopeGrabDetect

    Attach the player when it collides with RopeGrabDetect.

    Event: Player > On collision with RopeGrabDetect

    - Action 1: RopeGrabDetect > Add Child > Player

    - Action 2 (after the previous action): Player > Set Position > X = RopeGrabDetect.X + (adjust to your liking), Y = RopeGrabDetect.Y + (adjust to your liking)

    Hi, thanks for the reply! Maybe I'm doing something wrong, but I can't get the RopeGrabDetect to follow the Rope, nor the Player to get attached to the RopeGrabDetect. That said, this type of mechanic will probably be useful in the future, but what I was actually looking for is a mechanic in which there is a static point for the player to swing itself, be it by coming in close range or by shooting a rope to attach to the point.

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