mirror of
https://codeberg.org/Melon-Bread/Comets.gd.git
synced 2024-11-24 21:18:21 -05:00
Game now have a level system.
This commit is contained in:
parent
a3d1e2cd52
commit
6c32b12a3c
@ -1,9 +1,8 @@
|
||||
[gd_scene load_steps=5 format=3 uid="uid://bdarunpk3c2eh"]
|
||||
[gd_scene load_steps=4 format=3 uid="uid://bdarunpk3c2eh"]
|
||||
|
||||
[ext_resource type="Script" path="res://scripts/game.gd" id="1_6727i"]
|
||||
[ext_resource type="PackedScene" uid="uid://cbo47ftx0vcro" path="res://scenes/ship.tscn" id="1_esyqo"]
|
||||
[ext_resource type="FontFile" uid="uid://bkcxbtx1vcj8w" path="res://assets/fonts/Color Basic.otf" id="2_gwtm0"]
|
||||
[ext_resource type="PackedScene" uid="uid://6c6g7e5v3ifr" path="res://scenes/comet_spawner.tscn" id="3_gh4tl"]
|
||||
|
||||
[node name="Game" type="Node2D"]
|
||||
script = ExtResource("1_6727i")
|
||||
@ -42,7 +41,4 @@ color = Color(0, 0, 0, 1)
|
||||
z_index = 1
|
||||
position = Vector2(622, 309)
|
||||
|
||||
[node name="CometSpawner" parent="." instance=ExtResource("3_gh4tl")]
|
||||
|
||||
[connection signal="crashed" from="Ship" to="." method="game_over"]
|
||||
[connection signal="comet_shot" from="CometSpawner" to="." method="increase_score"]
|
||||
|
@ -14,12 +14,13 @@ func _ready() -> void:
|
||||
for comet in range(comet_count):
|
||||
random_position.x = randf_range(viewport_size.x - 100, viewport_size.x)
|
||||
random_position.y = randf_range(viewport_size.y - 100, viewport_size.y)
|
||||
spawn_comet(0, random_position)
|
||||
spawn_comet(2, random_position)
|
||||
|
||||
func _process(_delta: float) -> void:
|
||||
viewport_size = get_viewport_rect().size
|
||||
if $Comets.get_child_count() <= 0:
|
||||
screen_cleared.emit()
|
||||
queue_free()
|
||||
|
||||
|
||||
func spawn_comet(size : int, pos : Vector2) -> void:
|
||||
|
@ -1,24 +1,33 @@
|
||||
extends Node2D
|
||||
|
||||
# TODO: Display a game over screen when the ship is hit by a comet with abilty to restart
|
||||
# TODO: Detect when all comets are gone and increase the level (& maybe speed?)
|
||||
# TODO: Make a space like background, maybe some scrolling, maybe randomly generated
|
||||
# TODO: Make a small title screen that starts before the game scene
|
||||
# TODO: MAYBE track high score in a file & show it on HUD
|
||||
|
||||
@export var level : int = 1
|
||||
var score : int = 0
|
||||
const COMET_SPAWNER = preload("res://scenes/comet_spawner.tscn")
|
||||
|
||||
@export var level : int = 1
|
||||
|
||||
var score : int = 0
|
||||
var points_per_comet := 300
|
||||
|
||||
func _ready() -> void:
|
||||
pass
|
||||
new_level(level)
|
||||
|
||||
func _process(_delta: float) -> void:
|
||||
update_ui()
|
||||
|
||||
func new_level(current_level : int) -> void:
|
||||
pass
|
||||
var comet_spawner := COMET_SPAWNER.instantiate()
|
||||
comet_spawner.comet_count *= current_level
|
||||
comet_spawner.comet_shot.connect(increase_score)
|
||||
comet_spawner.screen_cleared.connect(level_finished)
|
||||
self.add_child(comet_spawner)
|
||||
|
||||
func level_finished() -> void:
|
||||
level += 1
|
||||
new_level(level)
|
||||
|
||||
func game_over() -> void:
|
||||
pass
|
||||
|
Loading…
Reference in New Issue
Block a user