Fixed world numbers, Nameplates, and a few smaller errors.

This commit is contained in:
Relintai 2019-12-21 00:43:03 +01:00
parent 5a1460df0e
commit 04eb2378ee
9 changed files with 44 additions and 72 deletions

View File

@ -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)

View File

@ -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():

View File

@ -64,31 +64,16 @@ 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 = get_global_transform().xform_inv(position)
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.x -= (rect_size.x / 2.0 + 24) * rect_scale.x
position.y -= 130 * rect_scale.y
set_position(position)
@ -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))

View File

@ -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 )]

View File

@ -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:

View File

@ -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)

View File

@ -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)

View File

@ -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 )

View File

@ -74,6 +74,8 @@ func centity_data_changed(data: EntityData) -> void:
var s : Node = spec_scene.instance()
_spec_container.add_child(s)
s.owner = _spec_container
if spec.text_name != "":
s.name = spec.text_name
s.set_spec(_player, spec, i)