0 votes

Hi,
I need advice how best to implement HIT (power) meter(like in the PGA Tour) for my simple 3d game...thank you so much for aid.

enter image description here

asked Dec 23, 2016 in Engine by Bishop (450 points)

this is quiet easy to figure out:
first try thinking of all the steps involved in what you want to accomplish.
when should the action start? when should it launch? how hard should it push the ball?

By figuring out the limits of all these actions (how far it can move at most, and what's the least it can move) You can now start forming a flow chart of when to do what in your script.

1 Answer

+1 vote

Can be like this:

extends CanvasLayer

var health = 100

func _ready():
    set_fixed_process(true)
    set_process_input(true)

func _input(event):
    if event.is_action_pressed("damage"): # space key in input map
        health -= 10

func _fixed_process(delta):
    get_node("Control/ProgressBar").set_value(health)
    health += delta * 2

enter image description here

answered Dec 24, 2016 by alpasp (34 points)

Thanks very much for answers...
@alpasp Thanks,this is a health hit counter,but a need something else....explain: the player has shoot the ball when pressed the left button mouse but before he must press(UPBUTTON) to set speed of the ball, say that four levels of the speed -
1. 0 - 25% very slowly
2. 25 - 50% slowly
3. 50 - 85% fast
4. 85 - 100% quickly ....on the speed meter.
speed meter works of 0 - 100% and back to 0% when I release UP
BUTTON
...but I do not know how link (with script) the speed meter with shooting the ball
..when player release UP button and on the speed meter will be 38% which is slowly so that the ball flew slowly and not quickly.
Thanks to everyone for aid.

Edit: bullshit....NO!! UP_BUTTON....speed meter will (start) be automatically counting 0-100 and 100-0 when a player press the RMB which I have set as adding another(new) ball into the game and then player press LMB to launch ball...
that means player must wait to click on the basis of how quickly the balloon shoot.
enter image description here

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.