mirror of
https://codeberg.org/Melon-Bread/Comets.gd.git
synced 2024-11-24 21:18:21 -05:00
Compare commits
7 Commits
15ab4d720e
...
130fc73076
Author | SHA1 | Date | |
---|---|---|---|
|
130fc73076 | ||
17bc3578ba | |||
560f66b32d | |||
5ad6c6d3b1 | |||
4f025868e6 | |||
0b22409369 | |||
fed245fee2 |
@ -1,3 +1,5 @@
|
|||||||
# Comets.gd
|
# Comets.gd
|
||||||
|
|
||||||
My take on a simple Astroids-like game. Really just me playing around in Godot
|
This is just a little Androids-like clone I made to get more familiar with the Godot game engine over the course of a few days. Nothing crazy or special, but it is important to finish and release games!
|
||||||
|
|
||||||
|
You can find screenshots, builds, & more info [here!](https://melon-bread.itch.io/cometsdotgd)
|
BIN
assets/_RAW_/comet2.pxo
Normal file
BIN
assets/_RAW_/comet2.pxo
Normal file
Binary file not shown.
BIN
assets/_RAW_/comet3.pxo
Normal file
BIN
assets/_RAW_/comet3.pxo
Normal file
Binary file not shown.
BIN
assets/_RAW_/comet4.pxo
Normal file
BIN
assets/_RAW_/comet4.pxo
Normal file
Binary file not shown.
BIN
assets/img/comet2.png
Normal file
BIN
assets/img/comet2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 563 B |
34
assets/img/comet2.png.import
Normal file
34
assets/img/comet2.png.import
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://b8swdgkngg7a3"
|
||||||
|
path="res://.godot/imported/comet2.png-5c168a7393426970d7715a9f51cb4f6a.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://assets/img/comet2.png"
|
||||||
|
dest_files=["res://.godot/imported/comet2.png-5c168a7393426970d7715a9f51cb4f6a.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=false
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
process/hdr_as_srgb=false
|
||||||
|
process/hdr_clamp_exposure=false
|
||||||
|
process/size_limit=0
|
||||||
|
detect_3d/compress_to=1
|
BIN
assets/img/comet3.png
Normal file
BIN
assets/img/comet3.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 588 B |
34
assets/img/comet3.png.import
Normal file
34
assets/img/comet3.png.import
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://dk2lcceleqyal"
|
||||||
|
path="res://.godot/imported/comet3.png-524767f527dbc8f654c976b7aa94ad66.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://assets/img/comet3.png"
|
||||||
|
dest_files=["res://.godot/imported/comet3.png-524767f527dbc8f654c976b7aa94ad66.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=false
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
process/hdr_as_srgb=false
|
||||||
|
process/hdr_clamp_exposure=false
|
||||||
|
process/size_limit=0
|
||||||
|
detect_3d/compress_to=1
|
BIN
assets/img/comet4.png
Normal file
BIN
assets/img/comet4.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 506 B |
34
assets/img/comet4.png.import
Normal file
34
assets/img/comet4.png.import
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://by4nqr5c4t6i"
|
||||||
|
path="res://.godot/imported/comet4.png-02d5c45d52e8bd739a883c09308a279d.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://assets/img/comet4.png"
|
||||||
|
dest_files=["res://.godot/imported/comet4.png-02d5c45d52e8bd739a883c09308a279d.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=false
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
process/hdr_as_srgb=false
|
||||||
|
process/hdr_clamp_exposure=false
|
||||||
|
process/size_limit=0
|
||||||
|
detect_3d/compress_to=1
|
@ -1,8 +1,8 @@
|
|||||||
[gd_scene load_steps=13 format=3 uid="uid://bsonrs8vhtly8"]
|
[gd_scene load_steps=13 format=3 uid="uid://bsonrs8vhtly8"]
|
||||||
|
|
||||||
[ext_resource type="Texture2D" uid="uid://54mfrkbp1kcg" path="res://assets/img/comet.png" id="1_6q67h"]
|
|
||||||
[ext_resource type="Script" path="res://scripts/comet.gd" id="1_33qxe"]
|
[ext_resource type="Script" path="res://scripts/comet.gd" id="1_33qxe"]
|
||||||
[ext_resource type="Shader" path="res://assets/shaders/PixelExplosion.gdshader" id="2_2l5nu"]
|
[ext_resource type="Shader" path="res://assets/shaders/PixelExplosion.gdshader" id="2_2l5nu"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://b8swdgkngg7a3" path="res://assets/img/comet2.png" id="3_7qdji"]
|
||||||
[ext_resource type="AudioStream" uid="uid://eb71wdy8dy4x" path="res://assets/sfx/explosion.wav" id="3_awuk4"]
|
[ext_resource type="AudioStream" uid="uid://eb71wdy8dy4x" path="res://assets/sfx/explosion.wav" id="3_awuk4"]
|
||||||
|
|
||||||
[sub_resource type="FastNoiseLite" id="FastNoiseLite_wa814"]
|
[sub_resource type="FastNoiseLite" id="FastNoiseLite_wa814"]
|
||||||
@ -114,10 +114,11 @@ script = ExtResource("1_33qxe")
|
|||||||
|
|
||||||
[node name="Sprite2D" type="Sprite2D" parent="."]
|
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||||
material = SubResource("ShaderMaterial_6s6e6")
|
material = SubResource("ShaderMaterial_6s6e6")
|
||||||
texture = ExtResource("1_6q67h")
|
texture = ExtResource("3_7qdji")
|
||||||
|
|
||||||
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="."]
|
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="."]
|
||||||
polygon = PackedVector2Array(19, -27, 22, -25, 25, -24, 27, -21, 31, -17, 32, -3, 32, 27, 27, 30, -8, 29, -17, 28, -25, 26, -32, 22, -32, 18, -23, 8, -20, 7, -21, 2, -29, -17, -29, -26, -27, -29, -25, -32, -14, -32, 0, -30)
|
position = Vector2(0, -1.5)
|
||||||
|
polygon = PackedVector2Array(17, -29.5, 30, -19.5, 31, 2.5, 32, 28.5, 18, 33.5, -25, 32.5, -29, 25.5, -31, -18.5, -22, -26.5)
|
||||||
|
|
||||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||||
libraries = {
|
libraries = {
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
[gd_scene load_steps=6 format=3 uid="uid://bdarunpk3c2eh"]
|
[gd_scene load_steps=7 format=3 uid="uid://bdarunpk3c2eh"]
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://scripts/game.gd" id="1_6727i"]
|
[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="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="FontFile" uid="uid://bkcxbtx1vcj8w" path="res://assets/fonts/Color Basic.otf" id="2_gwtm0"]
|
||||||
[ext_resource type="PackedScene" uid="uid://0yktrbyp6cr3" path="res://scenes/game_over_screen.tscn" id="3_yy075"]
|
[ext_resource type="PackedScene" uid="uid://0yktrbyp6cr3" path="res://scenes/game_over_screen.tscn" id="3_yy075"]
|
||||||
[ext_resource type="PackedScene" uid="uid://cemhlom425afn" path="res://scenes/stars.tscn" id="4_064lo"]
|
[ext_resource type="PackedScene" uid="uid://cemhlom425afn" path="res://scenes/stars.tscn" id="4_064lo"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://e647ck5fxo17" path="res://scenes/invader_spawner.tscn" id="5_itvtr"]
|
||||||
|
|
||||||
[node name="Game" type="Node2D"]
|
[node name="Game" type="Node2D"]
|
||||||
script = ExtResource("1_6727i")
|
script = ExtResource("1_6727i")
|
||||||
@ -58,8 +59,11 @@ color = Color(0, 0, 0, 1)
|
|||||||
|
|
||||||
[node name="Stars" parent="Background" instance=ExtResource("4_064lo")]
|
[node name="Stars" parent="Background" instance=ExtResource("4_064lo")]
|
||||||
|
|
||||||
|
[node name="InvaderSpawner" parent="." instance=ExtResource("5_itvtr")]
|
||||||
|
|
||||||
[node name="Ship" parent="." instance=ExtResource("1_esyqo")]
|
[node name="Ship" parent="." instance=ExtResource("1_esyqo")]
|
||||||
z_index = 1
|
z_index = 1
|
||||||
position = Vector2(622, 309)
|
position = Vector2(622, 309)
|
||||||
|
|
||||||
|
[connection signal="shot" from="InvaderSpawner" to="." method="_on_invader_spawner_shot"]
|
||||||
[connection signal="crashed" from="Ship" to="." method="game_over"]
|
[connection signal="crashed" from="Ship" to="." method="game_over"]
|
||||||
|
@ -35,6 +35,33 @@ shader_parameter/strength = 1.0
|
|||||||
shader_parameter/noise_tex_normal = SubResource("NoiseTexture2D_vfidg")
|
shader_parameter/noise_tex_normal = SubResource("NoiseTexture2D_vfidg")
|
||||||
shader_parameter/noise_tex = SubResource("NoiseTexture2D_ca84o")
|
shader_parameter/noise_tex = SubResource("NoiseTexture2D_ca84o")
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id="Animation_cojig"]
|
||||||
|
length = 0.001
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/path = NodePath("CrashSound:playing")
|
||||||
|
tracks/0/interp = 1
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PackedFloat32Array(0),
|
||||||
|
"transitions": PackedFloat32Array(1),
|
||||||
|
"update": 1,
|
||||||
|
"values": [false]
|
||||||
|
}
|
||||||
|
tracks/1/type = "value"
|
||||||
|
tracks/1/imported = false
|
||||||
|
tracks/1/enabled = true
|
||||||
|
tracks/1/path = NodePath("Sprite2D:material:shader_parameter/progress")
|
||||||
|
tracks/1/interp = 1
|
||||||
|
tracks/1/loop_wrap = true
|
||||||
|
tracks/1/keys = {
|
||||||
|
"times": PackedFloat32Array(0),
|
||||||
|
"transitions": PackedFloat32Array(1),
|
||||||
|
"update": 0,
|
||||||
|
"values": [null]
|
||||||
|
}
|
||||||
|
|
||||||
[sub_resource type="Animation" id="Animation_l62j8"]
|
[sub_resource type="Animation" id="Animation_l62j8"]
|
||||||
resource_name = "crash"
|
resource_name = "crash"
|
||||||
length = 0.4
|
length = 0.4
|
||||||
@ -80,33 +107,6 @@ tracks/2/keys = {
|
|||||||
"values": [null, 0.33, 0.66, 1.0]
|
"values": [null, 0.33, 0.66, 1.0]
|
||||||
}
|
}
|
||||||
|
|
||||||
[sub_resource type="Animation" id="Animation_cojig"]
|
|
||||||
length = 0.001
|
|
||||||
tracks/0/type = "value"
|
|
||||||
tracks/0/imported = false
|
|
||||||
tracks/0/enabled = true
|
|
||||||
tracks/0/path = NodePath("CrashSound:playing")
|
|
||||||
tracks/0/interp = 1
|
|
||||||
tracks/0/loop_wrap = true
|
|
||||||
tracks/0/keys = {
|
|
||||||
"times": PackedFloat32Array(0),
|
|
||||||
"transitions": PackedFloat32Array(1),
|
|
||||||
"update": 1,
|
|
||||||
"values": [false]
|
|
||||||
}
|
|
||||||
tracks/1/type = "value"
|
|
||||||
tracks/1/imported = false
|
|
||||||
tracks/1/enabled = true
|
|
||||||
tracks/1/path = NodePath("Sprite2D:material:shader_parameter/progress")
|
|
||||||
tracks/1/interp = 1
|
|
||||||
tracks/1/loop_wrap = true
|
|
||||||
tracks/1/keys = {
|
|
||||||
"times": PackedFloat32Array(0),
|
|
||||||
"transitions": PackedFloat32Array(1),
|
|
||||||
"update": 0,
|
|
||||||
"values": [null]
|
|
||||||
}
|
|
||||||
|
|
||||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_1dk2o"]
|
[sub_resource type="AnimationLibrary" id="AnimationLibrary_1dk2o"]
|
||||||
_data = {
|
_data = {
|
||||||
"RESET": SubResource("Animation_cojig"),
|
"RESET": SubResource("Animation_cojig"),
|
||||||
|
14
scenes/invader_spawner.tscn
Normal file
14
scenes/invader_spawner.tscn
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
[gd_scene load_steps=2 format=3 uid="uid://e647ck5fxo17"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" path="res://scripts/invader_spawner.gd" id="1_y3j7g"]
|
||||||
|
|
||||||
|
[node name="InvaderSpawner" type="Node2D"]
|
||||||
|
script = ExtResource("1_y3j7g")
|
||||||
|
|
||||||
|
[node name="SpawnTimer" type="Timer" parent="."]
|
||||||
|
wait_time = 30.0
|
||||||
|
autostart = true
|
||||||
|
|
||||||
|
[node name="Invaders" type="Node" parent="."]
|
||||||
|
|
||||||
|
[connection signal="timeout" from="SpawnTimer" to="." method="_on_spawn_timer_timeout"]
|
@ -2,12 +2,18 @@ extends Area2D
|
|||||||
|
|
||||||
@export var speed := 1400.00
|
@export var speed := 1400.00
|
||||||
var direction := Vector2.UP
|
var direction := Vector2.UP
|
||||||
|
var life_span = 0.5
|
||||||
|
var screen_wrap = true
|
||||||
|
|
||||||
|
func _ready() -> void:
|
||||||
|
$LifeTimer.wait_time = life_span
|
||||||
|
|
||||||
func _physics_process(delta: float) -> void:
|
func _physics_process(delta: float) -> void:
|
||||||
# Movement
|
# Movement
|
||||||
position += direction.rotated(rotation) * speed * delta
|
position += direction.rotated(rotation) * speed * delta
|
||||||
|
|
||||||
# Screenwrap
|
# Screenwrap
|
||||||
|
if screen_wrap:
|
||||||
var viewport_size := get_viewport_rect().size
|
var viewport_size := get_viewport_rect().size
|
||||||
position.x = wrap(position.x, 0, viewport_size.x)
|
position.x = wrap(position.x, 0, viewport_size.x)
|
||||||
position.y = wrap(position.y, 0,viewport_size.y)
|
position.y = wrap(position.y, 0,viewport_size.y)
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
extends Area2D
|
extends Area2D
|
||||||
|
|
||||||
# TODO: Have like 1 in 4 different sprites (and maybe shapes) the comet can be
|
|
||||||
|
|
||||||
signal exploded (new_size: SIZE, current_position: Vector2)
|
signal exploded (new_size: SIZE, current_position: Vector2)
|
||||||
|
|
||||||
@ -14,6 +13,13 @@ var size_data = {
|
|||||||
SIZE.LARGE : {"Scale": 2.5, "Speed-Multi": 0.5}
|
SIZE.LARGE : {"Scale": 2.5, "Speed-Multi": 0.5}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var texture_options = [
|
||||||
|
"res://assets/img/comet.png",
|
||||||
|
"res://assets/img/comet2.png",
|
||||||
|
"res://assets/img/comet3.png",
|
||||||
|
"res://assets/img/comet4.png"
|
||||||
|
]
|
||||||
|
|
||||||
var movement_speed : int
|
var movement_speed : int
|
||||||
var movement_speed_min : int = 50
|
var movement_speed_min : int = 50
|
||||||
var movement_speed_max : int = 250
|
var movement_speed_max : int = 250
|
||||||
@ -23,6 +29,9 @@ var rotation_speed : int
|
|||||||
var rotaion_direction : int
|
var rotaion_direction : int
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
|
$Sprite2D.texture = load(texture_options.pick_random())
|
||||||
|
|
||||||
|
|
||||||
movement_speed = randi_range(movement_speed_min, movement_speed_max)
|
movement_speed = randi_range(movement_speed_min, movement_speed_max)
|
||||||
movement_speed *= size_data[current_size]["Speed-Multi"]
|
movement_speed *= size_data[current_size]["Speed-Multi"]
|
||||||
|
|
||||||
|
@ -38,10 +38,14 @@ func game_over() -> void:
|
|||||||
if score > high_score:
|
if score > high_score:
|
||||||
save_score()
|
save_score()
|
||||||
|
|
||||||
|
func _on_invader_spawner_shot() -> void:
|
||||||
|
# This is not the most modular way to do this.
|
||||||
|
score += 500
|
||||||
|
|
||||||
func increase_score(comet_size : int) -> void:
|
func increase_score(comet_size : int) -> void:
|
||||||
# We add one since comet_size starts count at 0
|
# We add one since comet_size starts count at 0
|
||||||
comet_size += 1
|
comet_size += 1
|
||||||
score += points_per_comet / comet_size
|
score += int(points_per_comet / comet_size)
|
||||||
|
|
||||||
func update_ui()-> void:
|
func update_ui()-> void:
|
||||||
# Label strings must be all caps for font to render proper
|
# Label strings must be all caps for font to render proper
|
||||||
@ -59,5 +63,3 @@ func load_score() -> int:
|
|||||||
return file.get_var(score)
|
return file.get_var(score)
|
||||||
else:
|
else:
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ func _ready() -> void:
|
|||||||
movement_direction.x = -1
|
movement_direction.x = -1
|
||||||
else:
|
else:
|
||||||
movement_direction.x = 1
|
movement_direction.x = 1
|
||||||
random_position.y = randi_range(32, viewport_size.y + 32)
|
random_position.y = randf_range(32, viewport_size.y + 32)
|
||||||
position = random_position
|
position = random_position
|
||||||
|
|
||||||
|
|
||||||
@ -32,7 +32,7 @@ func _process(delta: float) -> void:
|
|||||||
|
|
||||||
if can_shoot:
|
if can_shoot:
|
||||||
# FIXME: Proper shoot angle and not able to sudoku
|
# FIXME: Proper shoot angle and not able to sudoku
|
||||||
shoot($GunMarker.global_position, randf_range(90.0, 100.0))
|
shoot($GunMarker.global_position, randf_range(90.0, 92.0))
|
||||||
|
|
||||||
# "Die", if off screen
|
# "Die", if off screen
|
||||||
if position.x > viewport_size.x or position.x < 0:
|
if position.x > viewport_size.x or position.x < 0:
|
||||||
@ -54,6 +54,8 @@ func shoot(pos : Vector2, rot : float) -> void:
|
|||||||
var bullet := BULLET.instantiate()
|
var bullet := BULLET.instantiate()
|
||||||
bullet.position = pos
|
bullet.position = pos
|
||||||
bullet.rotation = rot
|
bullet.rotation = rot
|
||||||
|
bullet.life_span = 0.3
|
||||||
|
bullet.screen_wrap = false
|
||||||
$Projectiles.add_child(bullet)
|
$Projectiles.add_child(bullet)
|
||||||
$ShootSound.play()
|
$ShootSound.play()
|
||||||
can_shoot = false
|
can_shoot = false
|
||||||
|
26
scripts/invader_spawner.gd
Normal file
26
scripts/invader_spawner.gd
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
extends Node2D
|
||||||
|
|
||||||
|
signal shot
|
||||||
|
|
||||||
|
const INVADER = preload("res://scenes/invader.tscn")
|
||||||
|
|
||||||
|
var can_spawn = false
|
||||||
|
|
||||||
|
func _process(_delta: float) -> void:
|
||||||
|
if can_spawn:
|
||||||
|
spawn_invader()
|
||||||
|
$SpawnTimer.wait_time = randi_range(20, 40)
|
||||||
|
|
||||||
|
|
||||||
|
func _on_spawn_timer_timeout() -> void:
|
||||||
|
can_spawn = true
|
||||||
|
|
||||||
|
func spawn_invader() -> void:
|
||||||
|
var invader := INVADER.instantiate()
|
||||||
|
invader.shot.connect(player_shot)
|
||||||
|
$Invaders.add_child(invader)
|
||||||
|
can_spawn = false
|
||||||
|
$SpawnTimer.start()
|
||||||
|
|
||||||
|
func player_shot() -> void:
|
||||||
|
shot.emit()
|
Loading…
Reference in New Issue
Block a user