save work and menu

This commit is contained in:
2025-09-07 23:13:51 +02:00
parent 2dfa874181
commit 1290cd19fb
31 changed files with 647 additions and 4717 deletions

View File

@@ -4,6 +4,8 @@ class_name Ship
@export var MAX_SPEED: float = 200
@export var SHOOT_NODE: PackedScene
@export var TIME_INVUL := 1.0
@export var animation : AnimationPlayer
const SPEED = 25.0
const JUMP_VELOCITY = -400.0
@@ -14,19 +16,22 @@ var vertical : float
var rota_temp: float
var delay := 0.0
var is_in = true
var delay_inv := 0.0
func _input(event):
pass
if event is InputEventMouseMotion:
mouse_position = event.position
func _ready() -> void:
delay_inv = TIME_INVUL +1
GameController.connect("player_hit", start_inv)
func _physics_process(delta: float) -> void:
delay += delta
if Input.is_action_pressed("ui_accept") and delay >= 0.5:
shoot()
delay = 0
if is_inv():
delay_inv += delta
animation.play("blink")
else:
animation.play("RESET")
horizontal = Input.get_axis("ui_up", "ui_down")
vertical = Input.get_axis("ui_left", "ui_right")
@@ -41,8 +46,12 @@ func _physics_process(delta: float) -> void:
velocity.y = move_toward(velocity.y, 0, SPEED)
if horizontal != 0 or vertical != 0:
direction = velocity
direction = Vector2(vertical, horizontal)
rotation = atan2(horizontal, vertical)
if Input.is_action_pressed("ui_accept") and delay >= 0.5:
shoot()
delay = 0
move_and_slide()
@@ -52,3 +61,10 @@ func shoot()->void:
new.direction = direction
new.position = position + (32 * direction.normalized())
get_parent().add_child(new)
func is_inv() -> bool:
return delay_inv <= TIME_INVUL
func start_inv()->void:
delay_inv = 0.0