more work on the ui theme and changing the hud
This commit is contained in:
30
UI/DamageParticle/damage_particle.gd
Normal file
30
UI/DamageParticle/damage_particle.gd
Normal file
@@ -0,0 +1,30 @@
|
||||
class_name DamageParticle
|
||||
extends Sprite3D
|
||||
|
||||
@onready var label: Label = $SubViewport/Label
|
||||
var time_alive: float = 0.0
|
||||
var movement_speed: float = 1.0
|
||||
var movement_vector: Vector3
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
var theta: float = deg_to_rad(40)
|
||||
var z: float = randf_range(cos(theta), 1)
|
||||
var phi: float = randf_range(0, 2 * PI)
|
||||
var vector: Vector3 = Vector3(sqrt(1 - pow(z, 2)) * cos(phi), z, sqrt(1 - pow(z, 2)) * sin(phi))
|
||||
movement_vector = vector.normalized()
|
||||
|
||||
|
||||
func set_number(num: int) -> void:
|
||||
label.text = str(num)
|
||||
|
||||
|
||||
func set_color(color: Color) -> void:
|
||||
label.modulate = color
|
||||
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
time_alive += delta
|
||||
position += movement_vector * movement_speed * delta
|
||||
if time_alive >= 1.0:
|
||||
queue_free()
|
||||
1
UI/DamageParticle/damage_particle.gd.uid
Normal file
1
UI/DamageParticle/damage_particle.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://blt7umrgo3tfh
|
||||
32
UI/DamageParticle/damage_particle.tscn
Normal file
32
UI/DamageParticle/damage_particle.tscn
Normal file
@@ -0,0 +1,32 @@
|
||||
[gd_scene load_steps=3 format=3 uid="uid://cqtew0t8sttpm"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://blt7umrgo3tfh" path="res://UI/DamageParticle/damage_particle.gd" id="1_lgvaq"]
|
||||
|
||||
[sub_resource type="ViewportTexture" id="ViewportTexture_ppqlh"]
|
||||
viewport_path = NodePath("SubViewport")
|
||||
|
||||
[node name="Node3D" type="Sprite3D"]
|
||||
pixel_size = 0.005
|
||||
billboard = 1
|
||||
no_depth_test = true
|
||||
fixed_size = true
|
||||
texture_filter = 2
|
||||
render_priority = 1
|
||||
texture = SubResource("ViewportTexture_ppqlh")
|
||||
script = ExtResource("1_lgvaq")
|
||||
|
||||
[node name="SubViewport" type="SubViewport" parent="."]
|
||||
transparent_bg = true
|
||||
size = Vector2i(172, 57)
|
||||
render_target_update_mode = 4
|
||||
|
||||
[node name="Label" type="Label" parent="SubViewport"]
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
theme_type_variation = &"DamageNumLabel"
|
||||
text = "12345"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
Reference in New Issue
Block a user