[SOLVED] How can I ensure that the bullet always hits exactly the same spot?

Hello,

Doing my game I created an Enemy that shoots upwards and the shot gradually begins to fall. The problem is: it don’t hit the same spot every time. Sometimes it’s more to the right, sometimes more to the left. The variation isn’t huge, but it exists.

The problem is: the player could stop in a position they consider safe based on where the shoot hits, but because of the variation, sometimes they get hit. This makes the gameplay difficult and unpredictable.

I tried with TimeDelta(), but still I don’t get it. I think I understand the concept of TimeDelta(), but I don’t know how to apply it very well. That’s why I’ve included TimeDelta() everywhere just to test. Here the events of my test:

How could I possibly make a shot like that always hit the exact same spot?

1 Like

I don’t understand idea of putting time/frame expression in position here?

Why not just fire toward angle -90° which is directly up?

1 Like

Hi @Rasterisko - Like @ZeroX4 - i don’t really understand why you’re doing it the way that you’re doing it. If you want it to fire to the same position …why not use force toward that position? Or if you want a curved path use physics 2 or force at object angle and tween or lerp angle to angle to target - then once reach …tween or lerp to 90. I too don’t really understand why you’re using Time Delta there.

Thanks for the answers, guys!

In the game itself, there is no TimeDelta(). I was assuming that the variation in the location reached could be due to the variation in FPS and that’s why I tested it with TimeDelta(). I want a curved path to my bullet. The way I shot is working, it just doesn’t always land in the same place and I don’t know why…

@petlimpet , yes, a curved path! I never used physics in Gdevelop. I don’t know how lerp works. I’m also not familiar with tween (I don’t even use it in my project). :eyes:

I actually don’t know where the shot will land. I just set the shot to always be the same for all instances. The complicated thing is that my phases are already done. If I changed the shot now it would have a very similar result so as not to impact my level design. But I’m going to research something about lerp and tween…

When I designed this shot I hadn’t noticed this small variation. Just now that I’m testing the game better. My fault… :face_with_peeking_eye:

Edit: I think i understand you wrong, ZeroX4. I will try to remove the Timer and just set the action to -90 and change de values.

There’s been a few threads on following a curved path …there’s an extension to do it but there’s quite a few ways of doing it. Later I’ll see if i can find the thread im thinking of!

1 Like

Show me screenshot on which is your player and draw on it path how you wanna your bullet to fly
Then another screenshot how bullet should fly or more like where
Draw the path in paint or something

Cause when you say SHOOT UP i understand straight up idk where curving anything here would fit

Big thanks for the help, @ZeroX4 and @petlimpet ! :heart_hands:

it’s working now perfectly! I removed the timer from the condition and changed the values. Here a simple print of my shoot inside my game (not the test):

image

1 Like

It’s great that it’s working how you want now…so it goes straight up and straight back down again?

Yes! Actually, the shot was already following that trajectory (curved path), but sometimes it was hitting slightly different spots on the ground. Removing the timer from the condition solved the problem. :v:

1 Like