I am struggling with this for days now. Basically I am trying to make aiming system where player will tap and hold anywhere on the screen, and that guideline from player’s gun will appear to show where the bullet will travel if shot. I tried using this tutorial (Add Aim Feature in GDevelop 5 - Physics Engine Tutorial - YouTube) but there is two issues with it. The length of guide line can’t be changed (or I don’t know how), and it’s just awful because it is spamming those white dots every single frame by creating them constantly which is big performance issue.
Will you be using physics to fire the bullet? Or can you do it ‘manually’?
The reason I’m asking is that I have a function that gets the position of a point anywhere along a bezier curve which is good for a manual bullet movement. If you combine this with a tween, you can place the guiding dots fairly evenly along the curve.
Let me know if this is something you’d lie to use, and I’ll see about knocking up an example.
Hi, thanks for replying. Yes, I am using physics for the missiles because I need physics functions that comes with it. Anyway, I just tried this method it it “almost” works for me. I tried adding minus (“-”) in the Y control point, in front of everything, and that did fixed the flipping issue but was inaccurate too.
Anyways, here’s the video what I mean and my events.
Video: https://streamable.com/qg9dm0
That 400 and distance functions are just some numbers I put in to create a decent curve. Play round with them to get the curve a better fit - make the 400 smaller to flatten the curve, or bigger to increase the ‘hump’ of the curve. And you can try multiplying the distance function to affect the curve’s height. I’d look at starting with multiplying by 1.25 and seeing how that impacts it and then working with slightly larger numbers.
Ooh, I did that and managed to make it work now. One issue still left tho, I still can’t find a way of reducing this guideline so that the player can’t use it across the whole map. For example I want it to be maximum of 400 pixels in length. Is it even possible to do it? Any advice or idea is welcomed.
I’ll just deal with the fact that this isn’t possible to do in this engine, and not to mention to customize the line so I’ll just remove this feature from my game.
There are numerous angry bird (and direct aim) style guidelines in games and demos made with Gdevelop, unfortunately people haven’t shared their math or events
I’d recommend you keep tinkering if you want it since it is definitely possible in the engine. I’m sorry that we cannot provide a direct solution, though.
Personally, I’d probably use a condition in the event that only has it be true if the mouse xposition is within whatever distance you want of the start position.
Edit: MrMens recommendation matches this as well, and should only require a single condition
You are right. I just found out this website Trajectory Calculator - Projectile Motion with instructions how to calculate trajectory of a missile, the only issue is that I don’t really know how to implement this in gdevelop but ig I’ll keep trying different methods untill I get it. Meanwhile, if anyone have any ideas about this, I am more then happy to hear it.
That’s the same as the tutorial OP linked in the first post. What @GasmoN is after is a bit more involved. I’m having a go at it, but the parameter equations are being a bit elusive.
I have also tinkered around with the Aiming sample. I love the idea and would use the mechanic in a game but it needs work and no work around I have found does it right.