diff --git a/game/autoload/WorldNumbers.gd b/game/autoload/WorldNumbers.gd index 71e199a..53d7710 100644 --- a/game/autoload/WorldNumbers.gd +++ b/game/autoload/WorldNumbers.gd @@ -12,7 +12,8 @@ func damage(entity_position : Vector2, entity_height : float, value : int, crit add_child(scene) scene.owner = self - entity_position.y += entity_height + (0.2 * randf()) + randomize() + entity_position.y -= entity_height + (0.2 * randf()) entity_position.x += entity_height * 0.4 - entity_height * 0.8 * randf() scene.damage(entity_position, value, crit) @@ -25,8 +26,8 @@ func heal(entity_position : Vector2, entity_height : float, value : int, crit : randomize() - entity_position.y += entity_height + (0.3 * randf()) - entity_position.x += entity_height * 0.4 - entity_height * 0.8 * randf() + #entity_position.y += entity_height + (0.3 * randf()) + #entity_position.x += entity_height * 0.4 - entity_height * 0.8 * randf() scene.heal(entity_position, value, crit) diff --git a/game/player/Mob.gd b/game/player/Mob.gd index 7e24b10..f7d8154 100644 --- a/game/player/Mob.gd +++ b/game/player/Mob.gd @@ -244,10 +244,10 @@ func _son_damage_dealt(data): func _con_damage_dealt(info : SpellDamageInfo) -> void: # if info.dealer == - WorldNumbers.damage(position, 1.6, info.damage, info.crit) + WorldNumbers.damage(position, 90, info.damage, info.crit) func _con_heal_dealt(info : SpellHealInfo) -> void: - WorldNumbers.heal(position, 1.6, info.heal, info.crit) + WorldNumbers.heal(position, 90, info.heal, info.crit) func _moved() -> void: if sis_casting(): diff --git a/game/player/NamePlate.gd b/game/player/NamePlate.gd index 814a25f..aaf6578 100644 --- a/game/player/NamePlate.gd +++ b/game/player/NamePlate.gd @@ -64,34 +64,19 @@ func _process(delta): set_scale(d) - if (get_scale() - target_scale).length() < 0.01: + if (get_scale() - target_scale).length() < 0.04: interpolating = false var position : Vector2 = entity.position - -# if dst > max_distance_squared: -# if visible: -# hide() -# return -# -# -# if d > 0: -# if visible: -# hide() -# return -# else: -# if not visible: -# show() -# - - position.y += 1.9 -# var screen_position : Vector2 = camera.unproject_position(position) -# var new_pos : Vector2 = Vector2(screen_position.x - (rect_size.x / 2.0) * rect_scale.x, screen_position.y - (rect_size.y) * rect_scale.y) + position = get_global_transform().xform_inv(position) + + position.x -= (rect_size.x / 2.0 + 24) * rect_scale.x + position.y -= 130 * rect_scale.y set_position(position) - + func set_max_distance(var value : float) -> void: max_distance_squared = value * value @@ -99,10 +84,15 @@ func set_max_distance(var value : float) -> void: max_distance = value func c_health_changed(stat : Stat) -> void: + if health.cmax == 0: + health_bar.max_value = 1 + health_bar.value = 0 + + return + health_bar.max_value = stat.cmax health_bar.value = stat.ccurrent - # if stat.cmax != 0: # health_bar_label.text = str(int(stat.ccurrent / stat.cmax * 100)) diff --git a/game/player/Player.tscn b/game/player/Player.tscn index 911173e..1609fe6 100644 --- a/game/player/Player.tscn +++ b/game/player/Player.tscn @@ -18,7 +18,7 @@ script = ExtResource( 2 ) [node name="CollisionShape2D" type="CollisionShape2D" parent="."] shape = SubResource( 1 ) -[node name="Camera2D" type="Camera2D" parent="."] +[node name="Camera" type="Camera2D" parent="."] current = true [node name="GUILayer" parent="." instance=ExtResource( 3 )] diff --git a/game/scripts/ai/EntityAIGD.gd b/game/scripts/ai/EntityAIGD.gd index a7b5e51..fbb9abf 100644 --- a/game/scripts/ai/EntityAIGD.gd +++ b/game/scripts/ai/EntityAIGD.gd @@ -117,9 +117,9 @@ func attack(delta): owner.target_movement_direction = Vector2() return - var dir : Vector3 = target.translation - owner.translation + var dir : Vector2 = target.position - owner.position - owner.target_movement_direction = Vector2(dir.x, dir.z) + owner.target_movement_direction = dir func sort_spells_by_rank(a, b): if a == null or b == null: diff --git a/game/scripts/spells/gd_spell_script.gd b/game/scripts/spells/gd_spell_script.gd index 4b28076..aad8fa1 100644 --- a/game/scripts/spells/gd_spell_script.gd +++ b/game/scripts/spells/gd_spell_script.gd @@ -139,22 +139,22 @@ func handle_gcd(info : SpellCastInfo) -> void: func add_spell_cast_effect(info : SpellCastInfo) -> void: var basic_spell_effect : SpellEffectVisualBasic = visual_spell_effects as SpellEffectVisualBasic - if basic_spell_effect != null: - if basic_spell_effect.spell_cast_effect_left_hand != null: - info.caster.get_character_skeleton().left_hand_attach_point.add_effect(basic_spell_effect.spell_cast_effect_left_hand) - - if basic_spell_effect.spell_cast_effect_right_hand != null: - info.caster.get_character_skeleton().right_hand_attach_point.add_effect(basic_spell_effect.spell_cast_effect_right_hand) +# if basic_spell_effect != null: +# if basic_spell_effect.spell_cast_effect_left_hand != null: +# info.caster.get_character_skeleton().left_hand_attach_point.add_effect(basic_spell_effect.spell_cast_effect_left_hand) +# +# if basic_spell_effect.spell_cast_effect_right_hand != null: +# info.caster.get_character_skeleton().right_hand_attach_point.add_effect(basic_spell_effect.spell_cast_effect_right_hand) func remove_spell_cast_effect(info : SpellCastInfo) -> void: var basic_spell_effect : SpellEffectVisualBasic = visual_spell_effects as SpellEffectVisualBasic - if basic_spell_effect != null: - if basic_spell_effect.spell_cast_effect_left_hand != null: - info.caster.get_character_skeleton().left_hand_attach_point.remove_effect(basic_spell_effect.spell_cast_effect_left_hand) - - if basic_spell_effect.spell_cast_effect_right_hand != null: - info.caster.get_character_skeleton().right_hand_attach_point.remove_effect(basic_spell_effect.spell_cast_effect_right_hand) +# if basic_spell_effect != null: +# if basic_spell_effect.spell_cast_effect_left_hand != null: +# info.caster.get_character_skeleton().left_hand_attach_point.remove_effect(basic_spell_effect.spell_cast_effect_left_hand) +# +# if basic_spell_effect.spell_cast_effect_right_hand != null: +# info.caster.get_character_skeleton().right_hand_attach_point.remove_effect(basic_spell_effect.spell_cast_effect_right_hand) func _con_spell_cast_started(info): add_spell_cast_effect(info) diff --git a/game/ui/numbers/Number.gd b/game/ui/numbers/Number.gd index 66a3688..5eb852d 100644 --- a/game/ui/numbers/Number.gd +++ b/game/ui/numbers/Number.gd @@ -9,9 +9,8 @@ export(NodePath) var animation_player_path : NodePath = "AnimationPlayer" export(Color) var damage_color : Color = Color.yellow export(Color) var heal_color : Color = Color.green -var world_position : Vector3 = Vector3() +var world_position : Vector2 = Vector2() var animation_player : AnimationPlayer = null -var camera : Camera = null func _ready() -> void: animation_player = get_node(animation_player_path) as AnimationPlayer @@ -21,42 +20,21 @@ func _ready() -> void: set_process(false) func _process(delta): - if camera == null: - return - - var cam_pos : Vector3 = camera.global_transform.xform(Vector3()) - var dstv : Vector3 = cam_pos - world_position - dstv.y = 0 -# var dst : float = dstv.length_squared() - - var cam_facing : Vector3 = -camera.global_transform.basis.z - var d : float = cam_facing.dot(dstv) - - if d > 0: - if visible: - hide() - return - else: - if not visible: - show() - - var screen_position : Vector2 = camera.unproject_position(world_position) - var new_pos : Vector2 = Vector2(screen_position.x + rect_position.x, screen_position.y + rect_position.y - 60) + + var new_pos : Vector2 = Vector2(world_position.x + rect_position.x / 2.0 - 8, world_position.y + rect_position.y) set_position(new_pos) -func damage(pos : Vector3, value : int, crit : bool) -> void: +func damage(pos : Vector2, value : int, crit : bool) -> void: setup(pos, damage_color, value, crit) -func heal(pos : Vector3, value : int, crit : bool) -> void: +func heal(pos : Vector2, value : int, crit : bool) -> void: setup(pos, heal_color, value, crit) -func setup(pos : Vector3, color : Color, value : int, crit : bool) -> void: +func setup(pos : Vector2, color : Color, value : int, crit : bool) -> void: world_position = pos - camera = get_tree().get_root().get_camera() as Camera - text = str(value) add_color_override("font_color", color) diff --git a/game/ui/numbers/Number.tscn b/game/ui/numbers/Number.tscn index c9dc9dd..8031639 100644 --- a/game/ui/numbers/Number.tscn +++ b/game/ui/numbers/Number.tscn @@ -74,8 +74,9 @@ tracks/1/keys = { [node name="Number" type="Label"] modulate = Color( 1, 1, 1, 0 ) margin_left = -50.0 +margin_top = 10.0 margin_right = 50.0 -margin_bottom = 40.0006 +margin_bottom = 50.0006 rect_scale = Vector2( 1.3, 1.3 ) rect_pivot_offset = Vector2( 50, 20 ) custom_fonts/font = ExtResource( 2 ) diff --git a/game/ui/windows/TalentWindow.gd b/game/ui/windows/TalentWindow.gd index 7707b6d..d870779 100644 --- a/game/ui/windows/TalentWindow.gd +++ b/game/ui/windows/TalentWindow.gd @@ -74,7 +74,9 @@ func centity_data_changed(data: EntityData) -> void: var s : Node = spec_scene.instance() _spec_container.add_child(s) s.owner = _spec_container - s.name = spec.text_name + + if spec.text_name != "": + s.name = spec.text_name s.set_spec(_player, spec, i)