More upgrades

This commit is contained in:
2024-02-17 12:04:43 +08:00
parent 8be0789b17
commit f8bb0d3975
11 changed files with 97 additions and 31 deletions

View File

@@ -1,6 +1,6 @@
extends CharacterBody2D
@export var damage = 12.0
@export var damage = 4.0
@export var knockback = 4
func _physics_process(delta):

View File

@@ -9,6 +9,8 @@ signal enemy_defeat
@export var common_target: Node2D
@export var respawn_timer: Timer
@export var respawn_duration = 2.0
@export var respawn_multiplier = 0.25
func spawn():
var instance = target.instantiate()
@@ -28,9 +30,14 @@ func spawn():
common_parent.add_child(instance)
func _on_wave_finished():
for child in common_parent.get_children():
if not child is Timer:
child.queue_free()
respawn_timer.stop()
func _on_wave_started():
func _on_wave_started(count):
var additional = respawn_multiplier * (count - 1)
respawn_timer.wait_time = respawn_duration - additional
respawn_timer.start()
func _on_enemy_defeat():

View File

@@ -9,11 +9,13 @@ extends CharacterBody2D
@export var dash_cooldown_duration = 1.0
@export var dash_cooldown_timer: Timer
@export var weapon_bullet_damage = 4.0
@export var weapon_bullet_knockback = 4
@export var weapon_bullet_speed = 3200
@export var weapon_bullet_scene: PackedScene
@export var weapon_bullet_parent: Node2D
@export var fire_cooldown_duration = 0.2
@export var fire_cooldown_duration = 0.35
@export var fire_cooldown_timer: Timer
@export var statistics: Statistics
@@ -39,6 +41,8 @@ func deal_weapon_shoot():
bullet.global_position = global_position
bullet.velocity = direction * weapon_bullet_speed
bullet.damage = weapon_bullet_damage
bullet.knockback = weapon_bullet_knockback
statistics.bullet_shoot += 1
fire_cooldown_timer.start(fire_cooldown_duration)

View File

@@ -14,7 +14,7 @@ var in_wave_gap: bool
var enemies_defeated: int
var bullet_shoot: int
@export var wave_gap_duration = 10
@export var wave_gap_duration = 3
@export var wave_duration = 10
@export var wave_multiplier = 1.5
@@ -66,6 +66,6 @@ func _on_wave_passed():
func _on_wave_gap_passed():
in_wave_gap = false
wave_started.emit()
wave_started.emit(get_current_wave())
wave_timer.wait_time = get_current_wave_duration()
wave_timer.start()

View File

@@ -1,18 +1,16 @@
extends Control
@export var card: PackedScene
@export var tower: Tower
@export var player: Player
@export var items = [
{
id = "QUICK_TRIGGER",
title = "Quick Trigger",
subtitle = "Save your finger",
description = "Reduce the delay between two shot.",
weight = 0.1,
}
]
@export var behaviour_asset: Resource
var items = []
func _ready():
var file = FileAccess.open(behaviour_asset.resource_path, FileAccess.READ)
var content = file.get_as_text()
items = JSON.parse_string(content)
func pick_item() -> Dictionary:
var total_weight: float = 0.0
@@ -33,7 +31,8 @@ func roll():
child.queue_free()
var items = []
for idx in range(3):
var count = randi_range(1, 3)
for idx in range(count):
items.append(pick_item())
for item in items:
@@ -41,6 +40,7 @@ func roll():
instance.tower = tower
instance.player = player
instance.id = item["id"]
instance.value = item["value"]
instance.title = item["title"]
instance.subtitle = item["subtitle"]
instance.description = item["description"]

View File

@@ -5,6 +5,8 @@ signal claimed
@export var tower: Tower
@export var player: Player
var value
@export var id: String
@export var title: String
@export var subtitle: String
@@ -16,7 +18,14 @@ func _ready():
$Description.text = description
func _on_claim():
if id == "QUICK_TRIGGER":
if player.fire_cooldown_duration > 0:
player.fire_cooldown_duration -= 0.05
match id:
"FIRE_COOLDOWN" when player.fire_cooldown_duration > 0:
player.fire_cooldown_duration += value[0]
player.weapon_bullet_damage -= value[1]
"BULLET_DAMAGE":
player.weapon_bullet_damage += value
"BULLET_KNOCKBACK":
player.weapon_bullet_knockback += value
"TOWER_HEALTH":
tower.health += value
claimed.emit()