Minimap
This commit is contained in:
parent
231ff2bb1d
commit
6c5350d47e
32 changed files with 114 additions and 186 deletions
27
scripts/Ship/minimap.gd
Normal file
27
scripts/Ship/minimap.gd
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
extends Control
|
||||
|
||||
@export var marker : PackedScene
|
||||
|
||||
@onready var ship: PlayerShip = $"../.."
|
||||
|
||||
var markers = []
|
||||
|
||||
#func _process(_delta):
|
||||
# $Sprite.self_modulate = ship.material.get_shader_parameter('color')
|
||||
|
||||
func _ready():
|
||||
get_tree().create_timer(0.05).timeout.connect(init_markers)
|
||||
|
||||
func init_markers():
|
||||
for ship in ship.star_system.ships:
|
||||
add_marker(ship, MinimapMarker.Type.Ship)
|
||||
for base in ship.star_system.bases:
|
||||
add_marker(base, MinimapMarker.Type.Base)
|
||||
|
||||
func add_marker(target : Node, type : MinimapMarker.Type):
|
||||
var marker_inst = marker.instantiate()
|
||||
markers.append(marker_inst)
|
||||
marker_inst.target = target
|
||||
marker_inst.type = type
|
||||
marker_inst.position = Vector2(120, 120)
|
||||
add_child(marker_inst)
|
||||
Loading…
Add table
Add a link
Reference in a new issue