Rewriting ships: Movement system
This commit is contained in:
parent
828f4c52c7
commit
e2b9fa6c69
10 changed files with 208 additions and 0 deletions
27
scripts/Ship/hull.gd
Normal file
27
scripts/Ship/hull.gd
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
extends RigidBody2D
|
||||
|
||||
class_name Hull
|
||||
|
||||
## Shortcut to get_parent()
|
||||
@onready var ship: Ship = get_parent()
|
||||
|
||||
## Hull ID to use with the Game.get_module func
|
||||
@export var id: String = "hull"
|
||||
|
||||
## Max HP of the hull
|
||||
@export var max_hp: float = 30.0
|
||||
|
||||
## Maximum amount of ammunition to be carried
|
||||
@export var max_ammunition: Dictionary = {
|
||||
"n/a": 0, # don't change this k thx
|
||||
"Laser Energy": 100,
|
||||
"Rockets": 10,
|
||||
}
|
||||
|
||||
## Current HP of the hull. If it reaches zero, it emits parent's destroyed signal
|
||||
var hp: float = max_hp:
|
||||
set(new_hp):
|
||||
if new_hp > 0:
|
||||
hp = new_hp
|
||||
else:
|
||||
ship.destroyed.emit()
|
||||
Loading…
Add table
Add a link
Reference in a new issue