21 lines
438 B
GDScript
21 lines
438 B
GDScript
extends Node2D
|
|
class_name Ship
|
|
|
|
var ship_type : String
|
|
var speed := 100.0
|
|
var target_position
|
|
var direction := Vector2.RIGHT
|
|
|
|
|
|
func setup(type):
|
|
ship_type = type
|
|
speed = ShipsType.SHIP_TYPES[type].speed
|
|
# Ustawienie tekstury ze słownika
|
|
var tex_path = ShipsType.SHIP_TYPES[type]["texture"]
|
|
var texture = load(tex_path)
|
|
$Sprite2D.texture = texture
|
|
|
|
func _process(delta: float) -> void:
|
|
position += direction * speed * delta
|
|
pass
|