Compare commits

...

2 Commits

5 changed files with 44 additions and 9 deletions

View File

@@ -0,0 +1,24 @@
shader_type canvas_item;
uniform vec4 orb_color : source_color = vec4(0.2, 1.0, 0.5, 1.0); // base orb color
uniform float glow_strength : hint_range(0.0, 2.0) = 1.2;
uniform float pulse_speed : hint_range(0.0, 10.0) = 2.0;
void fragment() {
// Centered UV (0,0 in middle, -1..1 range)
vec2 uv = (UV - vec2(0.5)) * 2.0;
float dist = length(uv);
// Soft circular mask
float circle = smoothstep(0.8, 0.0, dist);
// Glow falloff
float glow = smoothstep(0.5, 0.0, dist) * glow_strength;
// Pulsing
float pulse = 0.5 + 0.5 * sin(TIME * pulse_speed);
vec3 color = orb_color.rgb * (circle + glow * pulse);
COLOR = vec4(color, circle); // alpha fades at edges
}

View File

@@ -0,0 +1 @@
uid://ckjyt0mt0ngk

View File

@@ -26,7 +26,6 @@ func _process(delta: float) -> void:
func _on_player_hp_change(hp: float, max_hp: float): func _on_player_hp_change(hp: float, max_hp: float):
print_debug("got sig")
var percent_hp = hp / max_hp * 100 var percent_hp = hp / max_hp * 100
if percent_hp < 40: if percent_hp < 40:
low_hp_indicator.visible = true low_hp_indicator.visible = true

View File

@@ -90,15 +90,12 @@ func death_animation(delta: float):
func get_taunted(): func get_taunted():
var taunting_enemies: Array[EnemyBase] = [] var taunting_enemies: Array[EnemyBase] = []
for body in get_tree().get_nodes_in_group(GlobalConst.GROUP_ENEMY): for body in get_tree().get_nodes_in_group(GlobalConst.GROUP_ENEMY):
print_debug("starting taunt: %s" % global_position.distance_to(body.global_position))
if global_position.distance_to(body.global_position) < 1000.0: if global_position.distance_to(body.global_position) < 1000.0:
taunting_enemies.append(body) taunting_enemies.append(body)
print_debug("getting taunted by %s enemies" % len(taunting_enemies))
for i in range(taunting_enemies.size()): for i in range(taunting_enemies.size()):
var angle = (TAU / taunting_enemies.size()) * i var angle = (TAU / taunting_enemies.size()) * i
var target_pos = Vector2(cos(angle), sin(angle)) * 50 var target_pos = Vector2(cos(angle), sin(angle)) * 50
var new_target = Marker2D.new() var new_target = Marker2D.new()
print_debug("getting taunted by %s" % taunting_enemies[i])
new_target.position = target_pos new_target.position = target_pos
add_child(new_target) add_child(new_target)
taunting_enemies[i].target = new_target taunting_enemies[i].target = new_target

View File

@@ -1,17 +1,31 @@
[gd_scene load_steps=4 format=3 uid="uid://du4dqne3o0d5b"] [gd_scene load_steps=7 format=3 uid="uid://du4dqne3o0d5b"]
[ext_resource type="Script" uid="uid://bx43us4qd2vpf" path="res://scenes/xp_orb.gd" id="1_me6n8"] [ext_resource type="Script" uid="uid://bx43us4qd2vpf" path="res://scenes/xp_orb.gd" id="1_me6n8"]
[ext_resource type="Texture2D" uid="uid://c0g255217x10l" path="res://assets/sprites/xp_orb_small.png" id="2_me6n8"] [ext_resource type="Shader" uid="uid://ckjyt0mt0ngk" path="res://assets/shaders/xp_orb.gdshader" id="2_me6n8"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_pkphv"]
shader = ExtResource("2_me6n8")
shader_parameter/orb_color = Color(0.2, 1, 0.5, 1)
shader_parameter/glow_strength = 1.0
shader_parameter/pulse_speed = 2.0
[sub_resource type="Gradient" id="Gradient_me6n8"]
colors = PackedColorArray(1, 1, 1, 1, 1, 1, 1, 1)
[sub_resource type="GradientTexture2D" id="GradientTexture2D_hluwh"]
gradient = SubResource("Gradient_me6n8")
width = 12
height = 12
[sub_resource type="CircleShape2D" id="CircleShape2D_me6n8"] [sub_resource type="CircleShape2D" id="CircleShape2D_me6n8"]
radius = 5.0 radius = 4.0
[node name="XPOrb" type="Node2D" groups=["pickup", "xp_orb"]] [node name="XPOrb" type="Node2D" groups=["pickup", "xp_orb"]]
script = ExtResource("1_me6n8") script = ExtResource("1_me6n8")
[node name="Sprite2D" type="Sprite2D" parent="."] [node name="Sprite2D" type="Sprite2D" parent="."]
position = Vector2(-1, 1) material = SubResource("ShaderMaterial_pkphv")
texture = ExtResource("2_me6n8") texture = SubResource("GradientTexture2D_hluwh")
[node name="Area2D" type="Area2D" parent="."] [node name="Area2D" type="Area2D" parent="."]
collision_layer = 9 collision_layer = 9