Rewriting ships: Added some player interface and started rewriting star system

This commit is contained in:
2ndbeam 2024-04-30 16:22:55 +03:00
commit 4172b336c1
20 changed files with 300 additions and 139 deletions

View file

@ -0,0 +1,16 @@
extends Camera2D
## Desired value of zoom
@export var normal_zoom: float = 0.4
## Value of hull's scalar_velocity where zoom will be equal to normal_zoom
@export var normal_zoom_velocity: float = 200.0
## Maximum value of zoom
@export var max_zoom: float = 0.5
## Shortcut to get_parent()
@onready var ship: PlayerShip = get_parent()
func _process(_delta):
var scalar_velocity = ship.hull.scalar_velocity
zoom = Vector2(1, 1) * normal_zoom * (normal_zoom_velocity / (scalar_velocity + 1))
if zoom.x > max_zoom:
zoom = Vector2(1, 1) * max_zoom