Make player surge towards center of window on jump

Get help using Construct 2

Post » Wed May 16, 2012 3:04 pm

Help! Little Bunny FooFoo is hopping through the forest, but when he jumps he just goes straight up. I want him to jump towards the center of the window so that it looks like he is surging forward and then as he falls move back towards the left.

I have no clue.

LittleBunnyFooFoo.capx

EDIT: I should have mentioned that the goal is to make something Canabalt-like. The player uses platform behavior with the default controls disabled, and on touch simulate jump. The scenery continuously scrolls in the opposite direction to the player.kittiewan2012-05-16 16:31:42
B
29
S
11
G
12
Posts: 281
Reputation: 11,868

Post » Wed May 16, 2012 5:47 pm

If bunny is jumping and his x position is lower than ScrollX (or something else in the middle of the screen), simulate pressing right or set x velocity to a positive value. When he falls, simulate pressing left.

Using lerp() might make this "sequence" look more natural.Tokinsom2012-05-16 20:58:41
Image
B
225
S
27
G
13
Posts: 1,774
Reputation: 18,024

Post » Wed May 16, 2012 7:38 pm

I'd say you want to move the bunny towards the centre of the screen when he's jumping and then back while falling. And then you have to adjust the scenery speed to match. There's no point using scrollTo since you can't actually scroll the viewport (as it's the same size as the layout). Anyway I was messing around with it and this the best I could come up with.

http://dl.dropbox.com/u/8367729/construct/example/Bunny.capx
B
54
S
28
G
18
Posts: 1,520
Reputation: 24,990

Post » Thu May 17, 2012 12:31 am

Thank you, thank you Tokinsom and ramones! I really appreciate your taking the time to look into this. I figured it needed some lerping. I got it to go forward pretty smoothly using vectorx, but it kept snapping back to the original X position at the height of the jump. ramones, your solutions just what I had in mind.
B
29
S
11
G
12
Posts: 281
Reputation: 11,868


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 15 guests