I am working on a fishing game and want it so when you catch the fish you have to mash to pull it in. I have this code and while it works you can hold down the button to make it easy, was wondering if there is a better way to do it. also wondering if you can make the progress bar horizontal not vertical. thanks in advance
extends AnimatedSprite2D
var fishCaughtLeveL = 0
It will then only register the key press once each time it is pressed, and not continuously if it is held down. “ui_accept” is set to space as a default.
In Project > Project Settings > Input Map you can set actions and assign keys to them. For example you could create a new action called “reel_fish” and assign the space key to it, and change the code to
if Input.is_action_just_pressed("reel_fish") :
What are you currently using for the progress bar?
octopuddle’s suggestion is a good one. Glad to see you’re still working on, and learning, with this game! Cool that you made progress already. Just a reminder, it’s easier to see, and share code, if you use the code formatting:
```
print(“use three backtick characters”)
```
which comes out looking like:
print("use three backtick characters")
And yes, please share what you’re currently using for the progress bar. Screenshots aren’t necessary but they can help, too.
Thanks for the tip about the code formatting I got the pulling mechanic down, even if it doesn’t look that good but that’s on my bad art skills. Thanks for all the help with the coding I’ll make sure to put the game on GitHub once its done.