A game like Canabalt with hang on platforms

  • Hi there!

    I'm actually working on an small game like Canabalt. It's a very simple runner with a single touch to jump on different platforms. For now my player can run after the countdown and accelerate if he didn't meet any obstacle.

    When the player jump on a platform he can hang on, climb and continue to run. But I have some trouble to do this, I create a collision box that check if the player is on a platform border and then play the climb animation and after that run again.

    As you can see on the capx file there is a lot of bugs. I don't know if I'm using a proper method so if someone have another solution, it will be great!

    Thanks!

    Here is the file

  • Here's an example of what I want to do:

    <img src="http://www.mardoch.com/runner001.jpg" border="0" />

    Of course during this action the platform control must be desactivate.

    A solution anyone?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • put the controls in a group, deactivate the group on collision with platform.

    compare player.y with platformedge.y to see if the player must and can grab on.

    play grabbing and climbing animation by choosing the right frame and animation based on the difference between player.y and platform.y

    once climbing is finished restart running movement and reactivate the controls group.

  • Nice character btw, maybe it would be a good idea to pin the animation to another sprite which is the controlled sprite with platform behaviour.

  • Thanks a lot LittleStain, but on the end of the climb animation, the player is falling from the platform. I try to change the X position (Player1.X+10) on the end of the animation but it doesn't really work...

    Do I have to change the origin point on the climb animation?

  • Ok so I made some change, I create another sprite who is the controlled sprite and I change the position of the animated sprite to the controlled sprite.

    It's working much better now but there is a new problem: at the end of the climb animation, I want the controller sprite to be place just after the platform edge. But when there are several, it always comes back after the first one.

    How to place the controlled sprite just after the last platform edge which it collided with?

    Any help would be really appreciable because I'm getting mad with that!

    Here is the new file

  • Ok this is my fault. Maybe it was not clear enough.

    So here's a picture to illustrate my problem:

    <img src="http://www.mardoch.com/construct/runner002.jpg" border="0" />

    The player hang on my sprite "edge" and then continues to run once the animation is complete. I change its position thanks this code:

    Player1 : set position to "edge" (image point 1)

    But when there are several sprite "edge" in my layout, my character is put on the first sprite "edge" of the layout! It should remain at its current position instead.

    Is there a way to fix this bug?

    Thank you if you have the answer to this problem

  • Hi,

    it's a picking problem.

    You have your actions set to "on collision with ..." thus it has a context of which object you just hit. But you only set a variable to true and then do all the other actions in your Player "is climb". That way it has lost the context and doesnt know which "climber" object you mean when you set the new position, so it chooses the first one.

  • Thanks a lot 5Type!

    You just save my day ^^

  • mardoch

    Hi

    Can you plaese share the final capx

    I can't make it right

    Thank's

  • Hi slanw

    I just replace the file, you'll find it here

    Good luck!

  • Thank's for the help

  • Hi guys,

    Ok so here is the capx file I created about the hang & climb action.

    It's still need some adjustments (the animation don't really fit for now) but the main idea is there.

    In fact I created a new group for the climb action, it's used when the player enter in collision with a small trigger on the platform. It set the player sprite collision on the trigger point instead of the player controller.

    Check the file to get what I mean

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