Force towards object (issue)

Hi Devs,
Serious NOOB here.

What am I trying to do:
Trying to make a pong like game. The Player presses SPACE until bar increases, if at MAX and then released, it shoots a ball towards the target.

This works fine; however, I know what the problem is, I just can’t think how to fix it.

I don’t want the ball to follow the target around… it’s supposed to be a single shot and will bounce around (that’s the idea).

I didn’t want a fire-bullets behaviour on this, as I didn’t feel it was right.

Thanks for your help.
Rob

screenshot
I’ve changed the force to this… it’s better but not perfect. The ball is offset to the target.

I realised I added Target instead of speed… but It’s still broken.

So I’m here and I’m lost. I have bounce behaviour off wall :frowning:

I watched Making pong in less than 20 minutes on YT and he makes it looks sooooo easy.

Hi @robertofreemano Why aren’t you using physics 2.0? - I don’t use it that often but it’s perfect for this sort of thing.
I was expecting you to add 1 to force while the key is pressed and then set a variable called something like ‘forceangle’ to AngleBetween(player.X(),player.Y(),target.X(),target.Y())
then apply the force at ‘forceangle’
I’ve not used bounce behaviour before - so i can’t make suggestions here.
you don’t have to use physics2 - you can use variables like ‘momentum’ ‘acceleration’ etc and do it like that, but have a loook at the physics examples - open them up and have a look at the settings they use.

Thanks petlimpet,
I’ll need to experiment with this as I don’t want to completely change the project too much.

1 Like

Proper action
YellowSquare.AngleToObject(Crosshair)

And

Thank you ZeroX4 so much, That’s done the trick.

Thanks to all who’ve replied.

1 Like