✨ More upgrades
This commit is contained in:
parent
8be0789b17
commit
f8bb0d3975
34
behaviours/rewards.json
Normal file
34
behaviours/rewards.json
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"id": "FIRE_COOLDOWN",
|
||||||
|
"value": [-0.05, 0.5],
|
||||||
|
"title": "快速扳机",
|
||||||
|
"subtitle": "一切恐惧都来源于火力不足",
|
||||||
|
"description": "快速扳机是一项专为追求速度和灵活性的射手设计的装备。使用该扳机可以显著减少武器射击的冷却时间,每次触发可降低 0.05s 的等待时间,使你在紧急情况下更加迅速地进行连续射击。然而,为了追求这种敏捷性,你需要注意,快速扳机的使用会导致武器威力的降低,每次射击将减少 0.5 的伤害。在速度和威力之间做出明智选择,以确保在战斗中找到最佳平衡点,发挥出最大的战术优势。",
|
||||||
|
"weight": 0.2
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "BULLET_DAMAGE",
|
||||||
|
"value": 2,
|
||||||
|
"title": "子弹调整",
|
||||||
|
"subtitle": "更大、更强、更棒",
|
||||||
|
"description": "子弹调整服务是一项定制化的武器优化服务,旨在显著提升射击火力。通过增加子弹的火药量,这项服务将每次射击的伤害提升至新的高度,每发子弹额外增加 2 点伤害。这意味着你的武器在战场上将变得更加毁灭性,能够更迅速地摧毁敌人的防线。",
|
||||||
|
"weight": 0.1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "BULLET_KNOCKBACK",
|
||||||
|
"value": 2,
|
||||||
|
"title": "强化枪机",
|
||||||
|
"subtitle": "把你的敌人弹向火星",
|
||||||
|
"description": "强化枪机是一项专为追求更强大战术控制的射手设计的武器升级服务。通过对武器的枪机系统进行增强,这项服务赋予了射击出的子弹更为强大的击退能力。每一发子弹都带有更大的冲击力,能够有效地推动目标并改变战场动态。",
|
||||||
|
"weight": 0.2
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "TOWER_HEALTH",
|
||||||
|
"value": 50,
|
||||||
|
"title": "修复套件",
|
||||||
|
"subtitle": "你的强大可靠后援",
|
||||||
|
"description": "修复套件是一项专门设计用于玩家的塔维护的服务。这个套件经过精心设计,能够快速而有效地修复你的塔,回复其50点的血量。无论是在激烈的战斗中受损还是在战局紧急情况下,这项服务都能确保你的塔保持在最佳状态,延长其在战场上的生存能力。",
|
||||||
|
"weight": 0.3
|
||||||
|
}
|
||||||
|
]
|
@ -1,4 +1,4 @@
|
|||||||
[gd_scene load_steps=10 format=3 uid="uid://l4mybb2dw107"]
|
[gd_scene load_steps=11 format=3 uid="uid://l4mybb2dw107"]
|
||||||
|
|
||||||
[ext_resource type="PackedScene" uid="uid://cwkcf8h5rspoh" path="res://scenes/objects/player.tscn" id="1_nq1ke"]
|
[ext_resource type="PackedScene" uid="uid://cwkcf8h5rspoh" path="res://scenes/objects/player.tscn" id="1_nq1ke"]
|
||||||
[ext_resource type="PackedScene" uid="uid://cxlgt8h33u7os" path="res://scenes/objects/tower.tscn" id="2_betjv"]
|
[ext_resource type="PackedScene" uid="uid://cxlgt8h33u7os" path="res://scenes/objects/tower.tscn" id="2_betjv"]
|
||||||
@ -8,10 +8,11 @@
|
|||||||
[ext_resource type="PackedScene" uid="uid://cjam63kp5sg2o" path="res://scenes/ui/stats_overlay.tscn" id="5_rymed"]
|
[ext_resource type="PackedScene" uid="uid://cjam63kp5sg2o" path="res://scenes/ui/stats_overlay.tscn" id="5_rymed"]
|
||||||
[ext_resource type="PackedScene" uid="uid://dy51uqtr2ng32" path="res://scenes/ui/finish_screen.tscn" id="6_b264x"]
|
[ext_resource type="PackedScene" uid="uid://dy51uqtr2ng32" path="res://scenes/ui/finish_screen.tscn" id="6_b264x"]
|
||||||
[ext_resource type="PackedScene" uid="uid://5mt7abqkbpei" path="res://scenes/ui/reward_claim_screen.tscn" id="6_t43s0"]
|
[ext_resource type="PackedScene" uid="uid://5mt7abqkbpei" path="res://scenes/ui/reward_claim_screen.tscn" id="6_t43s0"]
|
||||||
|
[ext_resource type="JSON" path="res://behaviours/rewards.json" id="7_yubu4"]
|
||||||
|
|
||||||
[sub_resource type="Curve2D" id="Curve2D_gwd20"]
|
[sub_resource type="Curve2D" id="Curve2D_gwd20"]
|
||||||
_data = {
|
_data = {
|
||||||
"points": PackedVector2Array(0, 0, 0, 0, -309, -271, 0, 0, 0, 0, -309, 850, 0, 0, 0, 0, 1369, 849, 0, 0, 0, 0, 1368, -272, 0, 0, 0, 0, -309, -271)
|
"points": PackedVector2Array(0, 0, 0, 0, -174, -153, 0, 0, 0, 0, -170, 795, 0, 0, 0, 0, 1362, 801, 0, 0, 0, 0, 1358, -153, 0, 0, 0, 0, -174, -151)
|
||||||
}
|
}
|
||||||
point_count = 5
|
point_count = 5
|
||||||
|
|
||||||
@ -34,8 +35,8 @@ statistics = NodePath("../Statistics")
|
|||||||
curve = SubResource("Curve2D_gwd20")
|
curve = SubResource("Curve2D_gwd20")
|
||||||
|
|
||||||
[node name="EnemySpawnPoint" type="PathFollow2D" parent="EnemySpawnPath"]
|
[node name="EnemySpawnPoint" type="PathFollow2D" parent="EnemySpawnPath"]
|
||||||
position = Vector2(-309, -271)
|
position = Vector2(-174, -153)
|
||||||
rotation = 1.5708
|
rotation = 1.56658
|
||||||
|
|
||||||
[node name="StatsOverlay" parent="." node_paths=PackedStringArray("stats") instance=ExtResource("5_rymed")]
|
[node name="StatsOverlay" parent="." node_paths=PackedStringArray("stats") instance=ExtResource("5_rymed")]
|
||||||
stats = NodePath("../Statistics")
|
stats = NodePath("../Statistics")
|
||||||
@ -44,6 +45,7 @@ stats = NodePath("../Statistics")
|
|||||||
visible = false
|
visible = false
|
||||||
tower = NodePath("../Tower")
|
tower = NodePath("../Tower")
|
||||||
player = NodePath("../Player")
|
player = NodePath("../Player")
|
||||||
|
behaviour_asset = ExtResource("7_yubu4")
|
||||||
|
|
||||||
[node name="FinishScreen" parent="." node_paths=PackedStringArray("stats") instance=ExtResource("6_b264x")]
|
[node name="FinishScreen" parent="." node_paths=PackedStringArray("stats") instance=ExtResource("6_b264x")]
|
||||||
visible = false
|
visible = false
|
||||||
|
@ -7,18 +7,17 @@
|
|||||||
[sub_resource type="CircleShape2D" id="CircleShape2D_k56cq"]
|
[sub_resource type="CircleShape2D" id="CircleShape2D_k56cq"]
|
||||||
radius = 52.0096
|
radius = 52.0096
|
||||||
|
|
||||||
[node name="Player" type="CharacterBody2D" node_paths=PackedStringArray("dash_cooldown_timer", "weapon_bullet_parent", "fire_cooldown_timer")]
|
[node name="Player" type="CharacterBody2D" node_paths=PackedStringArray("dash_cooldown_timer", "fire_cooldown_timer")]
|
||||||
collision_mask = 3
|
collision_mask = 3
|
||||||
script = ExtResource("1_sa7t7")
|
script = ExtResource("1_sa7t7")
|
||||||
dash_cooldown_timer = NodePath("DashCooldown")
|
dash_cooldown_timer = NodePath("DashCooldown")
|
||||||
weapon_bullet_scene = ExtResource("2_v83ov")
|
weapon_bullet_scene = ExtResource("2_v83ov")
|
||||||
weapon_bullet_parent = NodePath("")
|
|
||||||
fire_cooldown_timer = NodePath("ShootCooldown")
|
fire_cooldown_timer = NodePath("ShootCooldown")
|
||||||
|
|
||||||
[node name="DashCooldown" type="Timer" parent="."]
|
[node name="DashCooldown" type="Timer" parent="."]
|
||||||
|
|
||||||
[node name="ShootCooldown" type="Timer" parent="."]
|
[node name="ShootCooldown" type="Timer" parent="."]
|
||||||
wait_time = 0.2
|
wait_time = 0.8
|
||||||
|
|
||||||
[node name="PlayerSprite" type="Sprite2D" parent="."]
|
[node name="PlayerSprite" type="Sprite2D" parent="."]
|
||||||
position = Vector2(1.90735e-06, 1.78814e-06)
|
position = Vector2(1.90735e-06, 1.78814e-06)
|
||||||
|
@ -25,10 +25,21 @@ offset_right = 1152.0
|
|||||||
offset_bottom = 648.0
|
offset_bottom = 648.0
|
||||||
theme_override_styles/panel = SubResource("StyleBoxFlat_3xnq2")
|
theme_override_styles/panel = SubResource("StyleBoxFlat_3xnq2")
|
||||||
|
|
||||||
[node name="RewardContainer" type="HBoxContainer" parent="Panel"]
|
[node name="Title" type="Label" parent="Panel"]
|
||||||
layout_mode = 0
|
layout_mode = 0
|
||||||
offset_left = 32.0
|
offset_left = 32.0
|
||||||
offset_top = 32.0
|
offset_top = 32.0
|
||||||
offset_right = 1120.0
|
offset_right = 1120.0
|
||||||
|
offset_bottom = 88.0
|
||||||
|
theme_override_font_sizes/font_size = 28
|
||||||
|
text = "Pick a Upgrade"
|
||||||
|
horizontal_alignment = 1
|
||||||
|
vertical_alignment = 1
|
||||||
|
|
||||||
|
[node name="RewardContainer" type="HBoxContainer" parent="Panel"]
|
||||||
|
layout_mode = 0
|
||||||
|
offset_left = 32.0
|
||||||
|
offset_top = 96.0
|
||||||
|
offset_right = 1120.0
|
||||||
offset_bottom = 616.0
|
offset_bottom = 616.0
|
||||||
alignment = 1
|
alignment = 1
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
[ext_resource type="Script" path="res://scripts/ui/reward_item.gd" id="1_v4j3k"]
|
[ext_resource type="Script" path="res://scripts/ui/reward_item.gd" id="1_v4j3k"]
|
||||||
|
|
||||||
[node name="RewardItem" type="Panel"]
|
[node name="RewardItem" type="Panel"]
|
||||||
custom_minimum_size = Vector2(360, 584)
|
custom_minimum_size = Vector2(360, 520)
|
||||||
script = ExtResource("1_v4j3k")
|
script = ExtResource("1_v4j3k")
|
||||||
|
|
||||||
[node name="Title" type="Label" parent="."]
|
[node name="Title" type="Label" parent="."]
|
||||||
@ -29,15 +29,15 @@ layout_mode = 0
|
|||||||
offset_left = 52.0
|
offset_left = 52.0
|
||||||
offset_top = 208.0
|
offset_top = 208.0
|
||||||
offset_right = 308.0
|
offset_right = 308.0
|
||||||
offset_bottom = 504.0
|
offset_bottom = 432.0
|
||||||
bbcode_enabled = true
|
bbcode_enabled = true
|
||||||
text = "This is the world most powerful reward. Trust me, choose this is a great choice."
|
text = "This is the world most powerful reward. Trust me, choose this is a great choice."
|
||||||
|
|
||||||
[node name="ClaimButton" type="Button" parent="."]
|
[node name="ClaimButton" type="Button" parent="."]
|
||||||
offset_left = 52.0
|
offset_left = 52.0
|
||||||
offset_top = 520.0
|
offset_top = 448.0
|
||||||
offset_right = 308.0
|
offset_right = 308.0
|
||||||
offset_bottom = 552.0
|
offset_bottom = 480.0
|
||||||
text = "Claim"
|
text = "Claim"
|
||||||
|
|
||||||
[connection signal="pressed" from="ClaimButton" to="." method="_on_claim"]
|
[connection signal="pressed" from="ClaimButton" to="." method="_on_claim"]
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
extends CharacterBody2D
|
extends CharacterBody2D
|
||||||
|
|
||||||
@export var damage = 12.0
|
@export var damage = 4.0
|
||||||
@export var knockback = 4
|
@export var knockback = 4
|
||||||
|
|
||||||
func _physics_process(delta):
|
func _physics_process(delta):
|
||||||
|
@ -9,6 +9,8 @@ signal enemy_defeat
|
|||||||
@export var common_target: Node2D
|
@export var common_target: Node2D
|
||||||
|
|
||||||
@export var respawn_timer: Timer
|
@export var respawn_timer: Timer
|
||||||
|
@export var respawn_duration = 2.0
|
||||||
|
@export var respawn_multiplier = 0.25
|
||||||
|
|
||||||
func spawn():
|
func spawn():
|
||||||
var instance = target.instantiate()
|
var instance = target.instantiate()
|
||||||
@ -28,9 +30,14 @@ func spawn():
|
|||||||
common_parent.add_child(instance)
|
common_parent.add_child(instance)
|
||||||
|
|
||||||
func _on_wave_finished():
|
func _on_wave_finished():
|
||||||
|
for child in common_parent.get_children():
|
||||||
|
if not child is Timer:
|
||||||
|
child.queue_free()
|
||||||
respawn_timer.stop()
|
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()
|
respawn_timer.start()
|
||||||
|
|
||||||
func _on_enemy_defeat():
|
func _on_enemy_defeat():
|
||||||
|
@ -9,11 +9,13 @@ extends CharacterBody2D
|
|||||||
@export var dash_cooldown_duration = 1.0
|
@export var dash_cooldown_duration = 1.0
|
||||||
@export var dash_cooldown_timer: Timer
|
@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_speed = 3200
|
||||||
@export var weapon_bullet_scene: PackedScene
|
@export var weapon_bullet_scene: PackedScene
|
||||||
@export var weapon_bullet_parent: Node2D
|
@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 fire_cooldown_timer: Timer
|
||||||
|
|
||||||
@export var statistics: Statistics
|
@export var statistics: Statistics
|
||||||
@ -39,6 +41,8 @@ func deal_weapon_shoot():
|
|||||||
|
|
||||||
bullet.global_position = global_position
|
bullet.global_position = global_position
|
||||||
bullet.velocity = direction * weapon_bullet_speed
|
bullet.velocity = direction * weapon_bullet_speed
|
||||||
|
bullet.damage = weapon_bullet_damage
|
||||||
|
bullet.knockback = weapon_bullet_knockback
|
||||||
|
|
||||||
statistics.bullet_shoot += 1
|
statistics.bullet_shoot += 1
|
||||||
fire_cooldown_timer.start(fire_cooldown_duration)
|
fire_cooldown_timer.start(fire_cooldown_duration)
|
||||||
|
@ -14,7 +14,7 @@ var in_wave_gap: bool
|
|||||||
var enemies_defeated: int
|
var enemies_defeated: int
|
||||||
var bullet_shoot: 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_duration = 10
|
||||||
@export var wave_multiplier = 1.5
|
@export var wave_multiplier = 1.5
|
||||||
|
|
||||||
@ -66,6 +66,6 @@ func _on_wave_passed():
|
|||||||
|
|
||||||
func _on_wave_gap_passed():
|
func _on_wave_gap_passed():
|
||||||
in_wave_gap = false
|
in_wave_gap = false
|
||||||
wave_started.emit()
|
wave_started.emit(get_current_wave())
|
||||||
wave_timer.wait_time = get_current_wave_duration()
|
wave_timer.wait_time = get_current_wave_duration()
|
||||||
wave_timer.start()
|
wave_timer.start()
|
||||||
|
@ -1,18 +1,16 @@
|
|||||||
extends Control
|
extends Control
|
||||||
|
|
||||||
@export var card: PackedScene
|
@export var card: PackedScene
|
||||||
@export var tower: Tower
|
@export var tower: Tower
|
||||||
@export var player: Player
|
@export var player: Player
|
||||||
|
|
||||||
@export var items = [
|
@export var behaviour_asset: Resource
|
||||||
{
|
|
||||||
id = "QUICK_TRIGGER",
|
var items = []
|
||||||
title = "Quick Trigger",
|
|
||||||
subtitle = "Save your finger",
|
func _ready():
|
||||||
description = "Reduce the delay between two shot.",
|
var file = FileAccess.open(behaviour_asset.resource_path, FileAccess.READ)
|
||||||
weight = 0.1,
|
var content = file.get_as_text()
|
||||||
}
|
items = JSON.parse_string(content)
|
||||||
]
|
|
||||||
|
|
||||||
func pick_item() -> Dictionary:
|
func pick_item() -> Dictionary:
|
||||||
var total_weight: float = 0.0
|
var total_weight: float = 0.0
|
||||||
@ -33,7 +31,8 @@ func roll():
|
|||||||
child.queue_free()
|
child.queue_free()
|
||||||
|
|
||||||
var items = []
|
var items = []
|
||||||
for idx in range(3):
|
var count = randi_range(1, 3)
|
||||||
|
for idx in range(count):
|
||||||
items.append(pick_item())
|
items.append(pick_item())
|
||||||
|
|
||||||
for item in items:
|
for item in items:
|
||||||
@ -41,6 +40,7 @@ func roll():
|
|||||||
instance.tower = tower
|
instance.tower = tower
|
||||||
instance.player = player
|
instance.player = player
|
||||||
instance.id = item["id"]
|
instance.id = item["id"]
|
||||||
|
instance.value = item["value"]
|
||||||
instance.title = item["title"]
|
instance.title = item["title"]
|
||||||
instance.subtitle = item["subtitle"]
|
instance.subtitle = item["subtitle"]
|
||||||
instance.description = item["description"]
|
instance.description = item["description"]
|
||||||
|
@ -5,6 +5,8 @@ signal claimed
|
|||||||
@export var tower: Tower
|
@export var tower: Tower
|
||||||
@export var player: Player
|
@export var player: Player
|
||||||
|
|
||||||
|
var value
|
||||||
|
|
||||||
@export var id: String
|
@export var id: String
|
||||||
@export var title: String
|
@export var title: String
|
||||||
@export var subtitle: String
|
@export var subtitle: String
|
||||||
@ -16,7 +18,14 @@ func _ready():
|
|||||||
$Description.text = description
|
$Description.text = description
|
||||||
|
|
||||||
func _on_claim():
|
func _on_claim():
|
||||||
if id == "QUICK_TRIGGER":
|
match id:
|
||||||
if player.fire_cooldown_duration > 0:
|
"FIRE_COOLDOWN" when player.fire_cooldown_duration > 0:
|
||||||
player.fire_cooldown_duration -= 0.05
|
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()
|
claimed.emit()
|
||||||
|
Loading…
Reference in New Issue
Block a user