Made pause controller to be created on player if it exists
This commit is contained in:
parent
350b9853f2
commit
93aa83dcaa
11 changed files with 129 additions and 17 deletions
|
|
@ -18,7 +18,7 @@ class_name Hull
|
|||
"Rockets": 10,
|
||||
}
|
||||
## Current ammunition. Change this with set_ammunition
|
||||
@onready var ammunition: Dictionary = max_ammunition
|
||||
@onready var ammunition: Dictionary = max_ammunition.duplicate()
|
||||
|
||||
## Current HP of the hull. If it reaches zero, it emits parent's destroyed signal
|
||||
@onready var hp: float = max_hp:
|
||||
|
|
@ -35,9 +35,8 @@ var scalar_velocity: float = 0.0
|
|||
func add_ammunition(which: String, value: float) -> bool:
|
||||
if ammunition[which] + value < 0:
|
||||
return false
|
||||
ammunition[which] += value;
|
||||
if ammunition[which] > max_ammunition[which]:
|
||||
ammunition[which] = max_ammunition[which]
|
||||
ammunition[which] = snapped(ammunition[which] + value, 0.01)
|
||||
ammunition[which] = min(ammunition[which], max_ammunition[which])
|
||||
return true
|
||||
|
||||
## Update ship's position and rotation
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue