How do I jump and grab a "bar"?

0 favourites
  • 12 posts
From the Asset Store
Health Bars & More
$3.60 USD
40% off
Health, Weapon & Rage Bars for your Games. Easy to use & Customize.
  • Hi there!

    I'm desperate to know how to jump and grab a bar and move grabbing the same bar.

    This is an example of the "Megaman" and he want to jump to grab that bar!

    Is it with Physics???

    Please reply this! ;)

  • You could set the player Y to specific value and add a grab animation. Then as you press left/right to move you keep the Y the same so it's like he is hanging. You give the player a 'grab' state, so when they press down while in grab state they will drop from the bar and return to normal platform behaviour (no fixed Y).

  • Thank you very much!

    I've tried to do that, I guess :P, Kinda newbie in this. As you can see he jumps and grab the bar, but I don't know, yet, how to add the "X value" for move the character in the bar.

    This is the Grab animation with the X & Y value:

    This was the "code" with a PIN behavior:

    The result:

  • The key to what plinkie said was the "grab state". Basically when the player is in the hanging state, he will move by different rules/events than normal. You'll need to set these up yourself. Disable the normal movement events, which is probably the platform bvehavior, then create events for what do you want to happen with each input individually.

  • Have a grab state, since it is player can be a global variable I suppose, a bool isGrab

    Player on collision with bar and isGrab=false, set isGrab to true

    On down key pressed and isGrab=true, set isGrab to false

    if isGrab is true, set player Y to ?, where ? is some value that makes it look like you are hanging from the bar

    Don't use pin, you can't move with pin...

  • Hi there, I realy apreciate your patience!

    I've created the Global Bool "isGrab" initial value as false.

    Well... Megaman jumps and grab the bar, but he keeps on bouncing and when I press the "S" Key for let go the bar as "isGrab" is false, nothing happens!

    I know guys, you're probably saying that I'm an idiot! :P But learning with so many youtube tuts that doesn't explain what we want is frustrating!!!

    Once again, Thanx a lot for your patience and if you steal wanna help, well I'm here!!!

  • Did you use 'is overlapping' the bar? because you can still be overlapping it when you press S so it's stuck in a loop.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Nop, I've used "on collision with another object".

    And the loop thing is when I jump Megaman got stuck on the Bar bouncing.

    I've been thinking if is becouse the "Image Point"??? I've tried bottom, middle, top, but none of them worked out.

  • Its best to have the character a simple block shape sprite and have it invisible, you do all your movements and collisions and things on that, then have the character sprite pinned to it.

  • Thanx!

    Tried that too and... damn! Didn't worked ahhhhhhh! What am I'm missing here???? It's been a pain!

  • The events are missing major parts of what I suggested. Where are the conditions? You can be moving left/right and 'colliding' with the bar. Also use set Y not set XY.

  • Hi!

    Yes you're probably right 'bout that! :P

    Like I said I'm learning and I realy don't know how to figure out that "conditions" or where to put them.

    Can you give me a especific exemple?

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