diff options
| -rw-r--r-- | CoinCount.gd (renamed from Money.gd) | 0 | ||||
| -rw-r--r-- | Enemy.gd (renamed from Enemy0.gd) | 0 | ||||
| -rw-r--r-- | Enemy.tscn (renamed from Enemy0.tscn) | 2 | ||||
| -rw-r--r-- | GameOver.gd (renamed from Wordart.gd) | 0 | ||||
| -rw-r--r-- | HUD.tscn | 19 | ||||
| -rw-r--r-- | HealthBar.gd | 2 | ||||
| -rw-r--r-- | Label2.gd | 20 | ||||
| -rw-r--r-- | Main.gd | 6 | ||||
| -rw-r--r-- | Main.tscn (renamed from Node2D.tscn) | 22 | ||||
| -rw-r--r-- | project.godot | 2 |
10 files changed, 25 insertions, 48 deletions
@@ -1,7 +1,7 @@ [gd_scene load_steps=3 format=2] [ext_resource path="res://assets/Likkan-boss.png" type="Texture" id=1] -[ext_resource path="res://Enemy0.gd" type="Script" id=2] +[ext_resource path="res://Enemy.gd" type="Script" id=2] [node name="Enemy" type="KinematicBody2D"] script = ExtResource( 2 ) @@ -1,11 +1,10 @@ -[gd_scene load_steps=12 format=2] +[gd_scene load_steps=11 format=2] [ext_resource path="res://HealthBar.gd" type="Script" id=1] -[ext_resource path="res://Wordart.gd" type="Script" id=2] +[ext_resource path="res://GameOver.gd" type="Script" id=2] [ext_resource path="res://assets/wordart.png" type="Texture" id=3] [ext_resource path="res://assets/preview_4.tres" type="AudioStream" id=4] -[ext_resource path="res://Money.gd" type="Script" id=5] -[ext_resource path="res://Label2.gd" type="Script" id=6] +[ext_resource path="res://CoinCount.gd" type="Script" id=5] [ext_resource path="res://assets/MinecraftRegular-Bmg3.otf" type="DynamicFontData" id=7] [ext_resource path="res://assets/wordart(1).png" type="Texture" id=8] @@ -54,25 +53,25 @@ margin_right = 1262.0 margin_bottom = 14.0 text = "Coins:" -[node name="Money" type="Label" parent="HBoxContainer"] +[node name="CoinCount" type="Label" parent="HBoxContainer"] margin_left = 1272.0 margin_right = 1280.0 margin_bottom = 14.0 text = "0" script = ExtResource( 5 ) -[node name="Wordart" type="Sprite" parent="."] +[node name="GameOver" type="Sprite" parent="."] position = Vector2( 626, 246 ) scale = Vector2( 0.171967, 0.186029 ) texture = ExtResource( 3 ) script = ExtResource( 2 ) -[node name="Wordart(1)" type="Sprite" parent="Wordart"] +[node name="GameOverCoinMessage" type="Sprite" parent="GameOver"] position = Vector2( -488.465, 1451.39 ) scale = Vector2( 0.639108, 0.832261 ) texture = ExtResource( 8 ) -[node name="Label" type="Label" parent="Wordart/Wordart(1)"] +[node name="GameOverCoinCount" type="Label" parent="GameOver/GameOverCoinMessage"] margin_left = 3885.16 margin_top = -219.604 margin_right = 5987.16 @@ -80,8 +79,8 @@ margin_bottom = 983.396 custom_fonts/font = SubResource( 3 ) text = "0 " -script = ExtResource( 6 ) +script = ExtResource( 5 ) -[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="Wordart"] +[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="GameOver"] pause_mode = 2 stream = ExtResource( 4 ) diff --git a/HealthBar.gd b/HealthBar.gd index 57e9283..e064039 100644 --- a/HealthBar.gd +++ b/HealthBar.gd @@ -8,7 +8,7 @@ signal player_dead # Called when the node enters the scene tree for the first time. func _ready(): - connect("player_dead", get_node("/root/Main/HUD/Wordart"), "_on_player_dead") + connect("player_dead", get_node("/root/Main/HUD/GameOver"), "_on_player_dead") # Called every frame. 'delta' is the elapsed time since the previous frame. diff --git a/Label2.gd b/Label2.gd deleted file mode 100644 index b35e3a3..0000000 --- a/Label2.gd +++ /dev/null @@ -1,20 +0,0 @@ -extends Label - - -# Declare member variables here. Examples: -# var a = 2 -# var b = "text" - -var score = 0 - - -# Called when the node enters the scene tree for the first time. -func _ready(): - pass # Replace with function body. - -func _on_coin_hit(): - score += 1 - self.text = str(score) -# Called every frame. 'delta' is the elapsed time since the previous frame. -#func _process(delta): -# pass @@ -6,9 +6,9 @@ onready var globals = get_node("/root/Global") # Called when the node enters the scene tree for the first time. func _ready(): randomize() - get_node("KinematicBody2D").connect("hit", get_node("HUD/HBoxContainer/HealthBar"), "_on_player_hit") - get_node("KinematicBody2D").connect("coin", get_node("HUD/HBoxContainer/Money"), "_on_coin_hit") - get_node("KinematicBody2D").connect("coin", get_node("HUD/Wordart/Wordart(1)/Label"), "_on_coin_hit") + get_node("Player").connect("hit", get_node("HUD/HBoxContainer/HealthBar"), "_on_player_hit") + get_node("Player").connect("coin", get_node("HUD/HBoxContainer/CoinCount"), "_on_coin_hit") + get_node("Player").connect("coin", get_node("HUD/GameOver/GameOverCoinMessage/GameOverCoinCount"), "_on_coin_hit") $EnemySpawnTimer.start() @@ -1,10 +1,10 @@ [gd_scene load_steps=7 format=2] -[ext_resource path="res://HUD.tscn" type="PackedScene" id=1] -[ext_resource path="res://Player.tscn" type="PackedScene" id=2] -[ext_resource path="res://Main.gd" type="Script" id=3] -[ext_resource path="res://assets/maps/map2.jpg" type="Texture" id=4] -[ext_resource path="res://Enemy0.tscn" type="PackedScene" id=5] +[ext_resource path="res://Main.gd" type="Script" id=1] +[ext_resource path="res://HUD.tscn" type="PackedScene" id=2] +[ext_resource path="res://Player.tscn" type="PackedScene" id=3] +[ext_resource path="res://Enemy.tscn" type="PackedScene" id=4] +[ext_resource path="res://assets/maps/map2.jpg" type="Texture" id=5] [sub_resource type="Curve2D" id=1] _data = { @@ -12,20 +12,18 @@ _data = { } [node name="Main" type="Node2D"] -script = ExtResource( 3 ) -enemy_scene = ExtResource( 5 ) +script = ExtResource( 1 ) +enemy_scene = ExtResource( 4 ) [node name="Sprite" type="Sprite" parent="."] scale = Vector2( 0.64, 0.64 ) -texture = ExtResource( 4 ) +texture = ExtResource( 5 ) centered = false -[node name="KinematicBody2D" parent="." instance=ExtResource( 2 )] +[node name="Player" parent="." instance=ExtResource( 3 )] position = Vector2( 544, 216 ) -[node name="Node" type="Node" parent="."] - -[node name="HUD" parent="." instance=ExtResource( 1 )] +[node name="HUD" parent="." instance=ExtResource( 2 )] [node name="EnemySpawn" type="Path2D" parent="."] curve = SubResource( 1 ) diff --git a/project.godot b/project.godot index c209dd1..579b7f0 100644 --- a/project.godot +++ b/project.godot @@ -11,7 +11,7 @@ config_version=4 [application] config/name="TowerDefence" -run/main_scene="res://Node2D.tscn" +run/main_scene="res://Main.tscn" config/icon="res://icon.png" [audio] |
