Predicting player jump path accurately

Get help using Construct 2

Post » Mon Nov 19, 2012 6:11 am

Hi everyone

I was looking at this post where R0J0hound posted a sample capx of predicting the player jump path. I've been using it as a basis for my game but noticed that while it's great for a general idea of where the player will go, it's not too accurate.

For example, the lines below in pink are from where the player actually jumped and the one in blue is predicted in code:


My modded sample capx

As you can see it is a bit off.

I've been trying to come up with a way of making this more accurate all week and have nothing but tired eyes. If I want an accurate path as possible for where the jump path will go, should I be looking at a completely different solution? Are there any tweaks I can make to the code by R0J0hound to make it more accurate?


Times like this I realize I'm a web developer, not a game developer boolean2012-11-19 06:15:41
B
24
S
4
G
1
Posts: 244
Reputation: 3,462

Post » Mon Nov 19, 2012 5:19 pm

Set the deceleration of the player sprite to zero, and add an event to set the "platform vector X" to 0 when the player lands. That should make it more accurate.

I divided by 60 in the expressions assuming a constant 60fps. In reality the framerate varies so the exact path can't be found.
B
79
S
24
G
54
Posts: 4,746
Reputation: 40,755

Post » Mon Nov 19, 2012 5:33 pm

You know how sometimes you think "I should just post this question...no..NO I'll figure it out!" and then spend days and days on wrestling a problem to the ground? All which could be solved by just asking for help?

This is one of those times. The acceleration was indeed the problem. It makes sense too - The player has the platformer behaviour which applies acceleration/deceleration while moving, but the generated jump nodes have no idea of what that is. I added in a little condition that simply says while the player is jumping turn off acceleration.

You are a king amongst men R0J0hound :)
B
24
S
4
G
1
Posts: 244
Reputation: 3,462


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 19 guests