diff options
| -rw-r--r-- | Bullet.gd | 3 | ||||
| -rw-r--r-- | Coin.gd | 8 | ||||
| -rw-r--r-- | CoinCount.gd | 18 | ||||
| -rw-r--r-- | Enemy.gd | 11 | ||||
| -rw-r--r-- | Global.gd | 14 | ||||
| -rw-r--r-- | HealthBar.gd | 9 | ||||
| -rw-r--r-- | Main.gd | 8 | ||||
| -rw-r--r-- | Player.gd | 4 | ||||
| -rw-r--r-- | Player.tscn | 2 | ||||
| -rw-r--r-- | project.godot | 2 |
10 files changed, 8 insertions, 71 deletions
@@ -26,6 +26,3 @@ func _physics_process(delta): queue_free() if position.x > screen_size.x or position.x < 0 or position.y > screen_size.y or position.y < 0: queue_free() - - - @@ -1,12 +1,7 @@ extends StaticBody2D - -# Declare member variables here. Examples: -# var a = 2 -# var b = "text" var timer -# Called when the node enters the scene tree for the first time. func _ready(): timer = Timer.new() get_parent().add_child(timer) @@ -16,6 +11,3 @@ func _ready(): func _on_timer_timeout() -> void: queue_free() -# Called every frame. 'delta' is the elapsed time since the previous frame. -#func _process(delta): -# if timer.stopp diff --git a/CoinCount.gd b/CoinCount.gd index fadd9ba..e826496 100644 --- a/CoinCount.gd +++ b/CoinCount.gd @@ -1,19 +1,7 @@ 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. +var coins = 0 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 + coins += 1 + self.text = str(coins) @@ -1,17 +1,6 @@ extends KinematicBody2D - -# Declare member variables here. Examples: -# var a = 2 -# var b = "text" -# var player = get_node("") onready var globals = get_node("/root/Global") -# Called when the node enters the scene tree for the first time. -func _ready(): - pass # Replace with function body. - - -# Called every frame. 'delta' is the elapsed time since the previous frame. func _process(delta): move_and_collide(global_position.direction_to(globals.playerPos).normalized() * 300 * delta) @@ -1,17 +1,3 @@ extends Node - -# Declare member variables here. Examples: -# var a = 2 -# var b = "text" var playerPos - - -# Called when the node enters the scene tree for the first time. -func _ready(): - pass # Replace with function body. - - -# Called every frame. 'delta' is the elapsed time since the previous frame. -#func _process(delta): -# pass diff --git a/HealthBar.gd b/HealthBar.gd index e064039..3648c67 100644 --- a/HealthBar.gd +++ b/HealthBar.gd @@ -1,19 +1,10 @@ extends ProgressBar - -# Declare member variables here. Examples: -# var a = 2 -# var b = "text" 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/GameOver"), "_on_player_dead") - -# Called every frame. 'delta' is the elapsed time since the previous frame. -#func _process(delta): -# pass func _on_player_hit(delta): value -= delta * 20 var styleBox = self.get("custom_styles/fg") @@ -3,20 +3,14 @@ extends Node2D export(PackedScene) var enemy_scene onready var globals = get_node("/root/Global") -# Called when the node enters the scene tree for the first time. func _ready(): randomize() 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") + yield(get_tree().create_timer(15.0), "timeout") $EnemySpawnTimer.start() - -# Called every frame. 'delta' is the elapsed time since the previous frame. -#func _process(delta): -# pass - - func _on_EnemySpawnTimer_timeout(): var enemy = enemy_scene.instance() var spawn_loc = get_node("EnemySpawn/EnemySpawnLocation") @@ -1,9 +1,9 @@ extends Area2D -signal hit +signal hit(duration) signal coin var screen_size -export (int) var speed = 500 +var speed = 500 var spawn_object = load("res://Bullet.tscn") var velocity = Vector2() onready var globals = get_node("/root/Global") diff --git a/Player.tscn b/Player.tscn index 8491e22..7be19de 100644 --- a/Player.tscn +++ b/Player.tscn @@ -3,7 +3,7 @@ [ext_resource path="res://Player.gd" type="Script" id=1] [ext_resource path="res://assets/htm_tex.png" type="Texture" id=2] -[node name="Area2D" type="Area2D"] +[node name="Player" type="Area2D"] collision_mask = 3 script = ExtResource( 1 ) diff --git a/project.godot b/project.godot index 579b7f0..632986b 100644 --- a/project.godot +++ b/project.godot @@ -10,7 +10,7 @@ config_version=4 [application] -config/name="TowerDefence" +config/name="LikKanShootdown" run/main_scene="res://Main.tscn" config/icon="res://icon.png" |
