bullet hell, asteroid and reaction done,. i think ill drop space invaders , 40 minutes left
This commit is contained in:
parent
82652730f2
commit
c000461fd6
23 changed files with 377 additions and 23 deletions
|
|
@ -3,11 +3,42 @@ extends Node
|
|||
signal game_win
|
||||
signal game_lose
|
||||
|
||||
@export var spawn_delay : float = 1.5
|
||||
@export var win_time : float = 15
|
||||
@export_group("Node References")
|
||||
@export var spawn_line : Path2D
|
||||
@export var follow_line : PathFollow2D
|
||||
@export var win_progress : ProgressBar
|
||||
|
||||
var spawn_timer : float = 5
|
||||
var alive_time : float = 0
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
spawn_timer = spawn_delay
|
||||
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta: float) -> void:
|
||||
pass
|
||||
spawn_timer -= delta
|
||||
alive_time += delta
|
||||
win_progress.value = alive_time/win_time
|
||||
if spawn_timer <= 0:
|
||||
spawn_timer = spawn_delay
|
||||
spawn_new_bullet()
|
||||
if alive_time> win_time:
|
||||
game_win.emit()
|
||||
|
||||
|
||||
func spawn_new_bullet():
|
||||
var newBullet : Node2D = load("res://games/bullet_hell/hellBullet.tscn").instantiate()
|
||||
follow_line.progress_ratio = randf()
|
||||
newBullet.global_position = follow_line.global_position
|
||||
#newBullet.heading = -newBullet.global_position.normalized()
|
||||
get_parent().add_child(newBullet)
|
||||
|
||||
|
||||
func _on_hitbox_area_entered(area: Area2D) -> void:
|
||||
game_lose.emit()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue