Predictive trajectory line

Get help using Construct 2

Post » Thu May 08, 2014 3:43 pm

Hi everyone,

This is my first post on the forum :) . Just bought Construct 2 a couple of weeks ago and have been working on a ball tossing physics game. I've spent quite a bit of time on here and have found answers to most questions from previous threads but can't for the life of me find a good way to solve the following problem:

In my game, you can shot various sized objects with a slingshot similarly to angry birds, these balls then bounce off blocks etc. I've used a physics impulse to add the initial force to the ball. What I want to do, is to create a predictive dotted line showing exactly where the ball will end up when the player releases the mouse/touch.

My best attempt so far has been to shoot out an invisible ball (with identical properties to the actual ball) which spawns a small black dot every 0.2 seconds until the balls is too far from the slingshot. These dots are then destroyed and a new invisible ball created every time the player moves the mouse/touch. The problem with this however is that the player will have to wait for the invisible ball to make its way across the screen every time they move their mouse. If possible, what I'd rather have is a predicted trajectory path which updates instantaneously at all times so that the player can fine-tune their shot before releasing the ball.

Thanks in advance if anyone is able to help me out with this! I've really enjoyed my time with Construct 2 so far and must say there's an impressive amount of people on these forums who are willing to sacrifice their time to help out the community. Good on you! :D
Mega Game Studios is a tiny independent game studio run from our apartment in Melbourne, Australia. We're not quite sure what we do yet but we think it has something to do with apps, board games and plush toys.

www.megagamestudios.com
B
18
S
7
G
3
Posts: 85
Reputation: 2,920

Post » Thu May 08, 2014 8:46 pm

Here's an instantaneous way to plot the path:
parabola-tracjectory-tracing-with-physics-box2d_p640838?#p640838

It doesn't take into account collisions though. For that your current method is the only solution atm.
B
92
S
32
G
107
Posts: 5,280
Reputation: 69,971

Post » Thu May 08, 2014 10:15 pm

Vegamon007 wrote:...the player will have to wait for the invisible ball to make its way across the screen every time they move their mouse...


Can't you just destroy the invisible ball when the mouse moves?
B
6
S
2
Posts: 4
Reputation: 408

Post » Fri May 09, 2014 12:47 pm

R0J0hound - Thanks so much for the reply. I'll check it out tonight. Even if I can't get physics collisions in there it'll still be better than what I've got now.

Citron2010 - Sorry my explanation probably wasn't good enough. The invisible ball is destroyed every time the player moves the mouse and a new invisible ball is created. The problem is that the player can't instantaneously see where the new invisible ball is going but rather will have to wait for the new invisible ball to travel across the screen before knowing where their ball will end up. Hopefully R0J0hound's trick will fix this though! :)

Cheers guys
Mega Game Studios is a tiny independent game studio run from our apartment in Melbourne, Australia. We're not quite sure what we do yet but we think it has something to do with apps, board games and plush toys.

www.megagamestudios.com
B
18
S
7
G
3
Posts: 85
Reputation: 2,920


Return to How do I....?

Who is online

Users browsing this forum: sean080, Yahoo [Bot] and 18 guests