Rewriting ships: Added weapon base and changed hull parent to Node

This commit is contained in:
2ndbeam 2024-04-29 12:08:13 +03:00
commit 6957169ba5
13 changed files with 121 additions and 37 deletions

View file

@ -2,8 +2,8 @@ extends RigidBody2D
class_name Hull
## Shortcut to get_parent()
@onready var ship: Ship = get_parent()
## Shortcut to get_parent().get_parent()
@onready var ship: Ship = get_parent().get_parent()
## Hull ID to use with the Game.get_module func
@export var id: String = "hull"
@ -36,3 +36,8 @@ func add_ammunition(which: String, value: float) -> bool:
if ammunition[which] > max_ammunition[which]:
ammunition[which] = max_ammunition[which]
return true
## Update ship's position and rotation
func _physics_process(_delta):
ship.position = position
ship.rotation = rotation