some exp balancing
This commit is contained in:
parent
fce86322c7
commit
5e85af9d00
@ -1,8 +1,14 @@
|
||||
class_name PlayerUI
|
||||
extends Control
|
||||
|
||||
@export var buttonGroup : ButtonGroup
|
||||
@onready var bludGen : Label = $UIRoot/ControlPanel/StatPanel/Blud/HBoxContainer/VBoxContainer/BludGenContainer/BludGen
|
||||
@onready var bludTotal : Label = $UIRoot/ControlPanel/StatPanel/Blud/HBoxContainer/VBoxContainer/BludTotalContainer/BludTotal
|
||||
@onready var enemyXPBar : ProgressBar = $UIRoot/ControlPanel/StatPanel/Other/MarginContainer/GridContainer/EnemyXPBar
|
||||
@onready var enemyXPLabel : Label = $UIRoot/ControlPanel/StatPanel/Other/MarginContainer/GridContainer/EnemyXPBar/EnemyXPLabel
|
||||
@onready var enemyHPBar : ProgressBar = $UIRoot/ControlPanel/StatPanel/Other/MarginContainer/GridContainer/EnemyHPBar
|
||||
@onready var enemyHPLabel : Label = $UIRoot/ControlPanel/StatPanel/Other/MarginContainer/GridContainer/EnemyHPBar/EnemyHPLabel
|
||||
|
||||
|
||||
signal button_changed(currentButton : Button)
|
||||
|
||||
@ -22,3 +28,14 @@ func set_blud_gen(gen):
|
||||
|
||||
func set_blud_total(total):
|
||||
bludTotal.text = str(floor(total))
|
||||
|
||||
func set_hp(current, total):
|
||||
enemyHPBar.max_value = total
|
||||
enemyHPBar.value = current
|
||||
enemyHPLabel.text = str(current) + "/" + str(total) + " HP"
|
||||
|
||||
func set_xp(current, min, max, level):
|
||||
enemyXPBar.max_value = max
|
||||
enemyXPBar.min_value = min
|
||||
enemyXPBar.value = current
|
||||
enemyXPLabel.text = "Lvl " + str(level) + " (" + str(current) + "/" + str(max) + "xp)"
|
||||
|
@ -1,10 +1,27 @@
|
||||
[gd_scene load_steps=6 format=3 uid="uid://dmvukn3rl6gbx"]
|
||||
[gd_scene load_steps=12 format=3 uid="uid://dmvukn3rl6gbx"]
|
||||
|
||||
[ext_resource type="Script" path="res://Scenes/Player/UI/player_ui.gd" id="1_4nwdk"]
|
||||
[ext_resource type="PackedScene" uid="uid://dl0d1m1gfcd4o" path="res://Scenes/Player/UI/bat_button.tscn" id="1_tnnk6"]
|
||||
[ext_resource type="Theme" uid="uid://dr1h7to56a2pv" path="res://Themes/base_theme.tres" id="3_4fgkw"]
|
||||
[ext_resource type="ButtonGroup" uid="uid://gjbbywsr8n8b" path="res://Scenes/Player/UI/spawnables_button_group.tres" id="3_7a133"]
|
||||
[ext_resource type="Texture2D" uid="uid://kbd5cnmgbqso" path="res://Assets/Sprite-0001.png" id="4_s5lk5"]
|
||||
[ext_resource type="Texture2D" uid="uid://bof6qeuo2rnso" path="res://Assets/Knight/noBKG_KnightRun_strip.png" id="5_7a8uf"]
|
||||
[ext_resource type="Texture2D" uid="uid://djjqhipuo3byw" path="res://Assets/Knight/noBKG_KnightShield_strip.png" id="5_t0ay2"]
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_v6oad"]
|
||||
bg_color = Color(0.243137, 0.713726, 0.0627451, 0.301961)
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_b74dp"]
|
||||
bg_color = Color(0.333333, 0.721569, 0.270588, 0.886275)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_5ptrg"]
|
||||
atlas = ExtResource("5_7a8uf")
|
||||
region = Rect2(132.276, 0.393494, 39.1181, 55.8829)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_57m6r"]
|
||||
resource_local_to_scene = true
|
||||
atlas = ExtResource("5_t0ay2")
|
||||
region = Rect2(32, 0, 64, 64)
|
||||
|
||||
[node name="PlayerUI" type="Control"]
|
||||
layout_mode = 3
|
||||
@ -118,6 +135,106 @@ theme = ExtResource("3_4fgkw")
|
||||
text = "100"
|
||||
vertical_alignment = 2
|
||||
|
||||
[node name="Other" type="Control" parent="UIRoot/ControlPanel/StatPanel"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="UIRoot/ControlPanel/StatPanel/Other"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
theme_override_constants/margin_left = 0
|
||||
theme_override_constants/margin_top = 5
|
||||
theme_override_constants/margin_bottom = 5
|
||||
|
||||
[node name="GridContainer" type="GridContainer" parent="UIRoot/ControlPanel/StatPanel/Other/MarginContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="EnemyXPBar" type="ProgressBar" parent="UIRoot/ControlPanel/StatPanel/Other/MarginContainer/GridContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
theme = ExtResource("3_4fgkw")
|
||||
theme_override_styles/background = SubResource("StyleBoxFlat_v6oad")
|
||||
theme_override_styles/fill = SubResource("StyleBoxFlat_b74dp")
|
||||
max_value = 300.0
|
||||
step = 1.0
|
||||
value = 100.0
|
||||
show_percentage = false
|
||||
|
||||
[node name="EnemyTexture" type="TextureRect" parent="UIRoot/ControlPanel/StatPanel/Other/MarginContainer/GridContainer/EnemyXPBar"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 4
|
||||
anchor_top = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_top = -16.5
|
||||
offset_right = 24.0
|
||||
offset_bottom = 16.5
|
||||
grow_vertical = 2
|
||||
texture = SubResource("AtlasTexture_5ptrg")
|
||||
expand_mode = 3
|
||||
stretch_mode = 5
|
||||
|
||||
[node name="EnemyXPLabel" type="Label" parent="UIRoot/ControlPanel/StatPanel/Other/MarginContainer/GridContainer/EnemyXPBar"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -0.5
|
||||
offset_top = -11.5
|
||||
offset_right = 0.5
|
||||
offset_bottom = 11.5
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 6
|
||||
text = "Lvl 1 (100/300xp)"
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="EnemyHPBar" type="ProgressBar" parent="UIRoot/ControlPanel/StatPanel/Other/MarginContainer/GridContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
theme = ExtResource("3_4fgkw")
|
||||
step = 1.0
|
||||
value = 99.0
|
||||
show_percentage = false
|
||||
|
||||
[node name="EnemyTexture" type="TextureRect" parent="UIRoot/ControlPanel/StatPanel/Other/MarginContainer/GridContainer/EnemyHPBar"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 9
|
||||
anchor_bottom = 1.0
|
||||
offset_top = -8.0
|
||||
offset_right = 33.0
|
||||
offset_bottom = 8.0
|
||||
grow_vertical = 2
|
||||
texture = SubResource("AtlasTexture_57m6r")
|
||||
expand_mode = 4
|
||||
stretch_mode = 5
|
||||
|
||||
[node name="EnemyHPLabel" type="Label" parent="UIRoot/ControlPanel/StatPanel/Other/MarginContainer/GridContainer/EnemyHPBar"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -0.5
|
||||
offset_top = -11.5
|
||||
offset_right = 0.5
|
||||
offset_bottom = 11.5
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 6
|
||||
text = "99/100 HP"
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="ButtonPanel" type="HBoxContainer" parent="UIRoot/ControlPanel"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
|
@ -13,7 +13,7 @@ var allSpawnedMonsters : Dictionary = {}
|
||||
var currentSpawnedMonsters : Array = []
|
||||
@onready var menuZone : Control = $Camera2D/CanvasLayer/PlayerUI/MenuZone
|
||||
@onready var playerUI : Control = $Camera2D/CanvasLayer/PlayerUI
|
||||
@onready var enemy : CharacterBody2D = $"../Enemy"
|
||||
@onready var enemy : Fabio = $"../Enemy"
|
||||
@onready var playableArea : Area2D = $"../PlayableArea"
|
||||
@onready var cursorState : Node2D = $CursorState
|
||||
|
||||
@ -23,6 +23,9 @@ func _ready():
|
||||
currentBludAmount = STARTING_Blud_AMOUNT
|
||||
currentBludGen = BASE_Blud_GEN
|
||||
|
||||
enemy.exp_gained.connect(playerUI.set_xp)
|
||||
enemy.hp_changed.connect(playerUI.set_hp)
|
||||
|
||||
playerUI.set_blud(currentBludGen, currentBludAmount)
|
||||
|
||||
playableArea.mouse_entered.connect(entered_playable_area)
|
||||
|
@ -10,12 +10,12 @@ region = Rect2(0, 0, 64, 64)
|
||||
|
||||
[node name="BatSpawnable" instance=ExtResource("1_verf7")]
|
||||
maxHp = 10
|
||||
attackSpeed = 20.0
|
||||
attackSpeed = 50.0
|
||||
speed = 4000.0
|
||||
damage = 1
|
||||
priority = 1
|
||||
expReward = 50
|
||||
cost = 50
|
||||
expReward = 25
|
||||
cost = 20
|
||||
minSpawnRange = 10.0
|
||||
monsterName = "Bat"
|
||||
monsterIcon = SubResource("AtlasTexture_bnd0j")
|
||||
|
@ -382,6 +382,7 @@ position = Vector2(10, 10)
|
||||
collision_layer = 5
|
||||
collision_mask = 5
|
||||
script = ExtResource("1_xj62t")
|
||||
maxhp = 50
|
||||
|
||||
[node name="LightOccluder2D" type="LightOccluder2D" parent="."]
|
||||
occluder = SubResource("OccluderPolygon2D_xq5nx")
|
||||
|
@ -1,3 +1,4 @@
|
||||
class_name Fabio
|
||||
extends CharacterBody2D
|
||||
|
||||
@onready var levelup = [300, 900, 2700, 6500, 14000, 23000, 34000, 48000, 64000]
|
||||
@ -36,6 +37,9 @@ extends CharacterBody2D
|
||||
|
||||
@onready var list: Array = []
|
||||
|
||||
signal exp_gained(current, min, max, level)
|
||||
signal hp_changed(current, max)
|
||||
|
||||
func add_foe(foe):
|
||||
list.append(foe)
|
||||
|
||||
@ -51,6 +55,8 @@ func _ready():
|
||||
atk1r.set_disabled(true)
|
||||
atk2l.set_disabled(true)
|
||||
atk2r.set_disabled(true)
|
||||
hp_changed.emit(hp, maxhp)
|
||||
exp_gained.emit(experience, 0 if level == 1 else levelup[level - 2] ,levelup[level - 1], level)
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
@ -153,12 +159,16 @@ func receive_damage(dmg):
|
||||
hitanim.restart()
|
||||
anim.modulate.a = 0.5
|
||||
|
||||
hp_changed.emit(hp, maxhp)
|
||||
|
||||
|
||||
func receive_exp(x):
|
||||
experience += x
|
||||
if experience > levelup[level - 1] && level <= 8:
|
||||
setLevel(level + 1)
|
||||
|
||||
exp_gained.emit(experience, 0 if level == 1 else levelup[level - 2] ,levelup[level - 1], level)
|
||||
|
||||
|
||||
func setLevel(lvl):
|
||||
level = lvl
|
||||
@ -182,11 +192,13 @@ func setLevel(lvl):
|
||||
maxAtks = 2
|
||||
|
||||
maxhp += 5
|
||||
hp += maxhp / 2
|
||||
hp += 10
|
||||
|
||||
if hp > maxhp:
|
||||
hp = maxhp
|
||||
|
||||
hp_changed.emit(hp, maxhp)
|
||||
|
||||
|
||||
func _on_atk_cooldown_timeout():
|
||||
currAtks = maxAtks
|
||||
|
Loading…
Reference in New Issue
Block a user