How - hit (power) meter like in the PGA Tour?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Bishop
:warning: Old Version Published before Godot 3 was released.

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.

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.

Jatz | 2016-12-23 20:53

:bust_in_silhouette: Reply From: alpasp

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

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(UP_BUTTON) 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.

Bishop | 2016-12-27 19:17