A game like Canabalt with hang on platforms

Get help using Construct 2

Post » Thu Jan 16, 2014 4:38 pm

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!

[URL=http://www.mardoch.com/runner.capx]Here is the file[/URL]mardoch2014-01-16 19:58:23
B
5
S
1
Posts: 29
Reputation: 433

Post » Fri Jan 17, 2014 4:52 pm

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

Of course during this action the platform control must be desactivate.
A solution anyone?
B
5
S
1
Posts: 29
Reputation: 433

Post » Fri Jan 17, 2014 5:53 pm

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.
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Fri Jan 17, 2014 6:57 pm

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.
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Fri Jan 17, 2014 9:55 pm

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?
B
5
S
1
Posts: 29
Reputation: 433

Post » Sat Jan 18, 2014 4:33 pm

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
B
5
S
1
Posts: 29
Reputation: 433

Post » Sun Jan 19, 2014 2:21 pm

Ok this is my fault. Maybe it was not clear enough.
So here's a picture to illustrate my problem:



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
B
5
S
1
Posts: 29
Reputation: 433

Post » Sun Jan 19, 2014 6:21 pm

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.
B
22
S
7
G
4
Posts: 154
Reputation: 3,709

Post » Sun Jan 19, 2014 6:41 pm

Thanks a lot 5Type!
You just save my day ^^
B
5
S
1
Posts: 29
Reputation: 433

Post » Tue Jan 28, 2014 9:56 am

@mardoch
Hi
Can you plaese share the final capx
I can't make it right

Thank's
B
7
S
1
Posts: 65
Reputation: 586

Next

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 28 guests