Update FloatingTextManager colors and integrate floating text display in LeverComponent; replace enemy sprite in basic_enemy scene

This commit is contained in:
2025-09-11 04:42:59 +02:00
parent 6e2bdcdf95
commit 98b3202361
5 changed files with 46 additions and 6 deletions

View File

@@ -9,9 +9,9 @@ public partial class FloatingTextManager : Node
[Export] public PackedScene FloatingTextScene { get; set; } [Export] public PackedScene FloatingTextScene { get; set; }
[ExportGroup("Colors")] [ExportGroup("Colors")]
[Export] public Color DamageColor { get; set; } = new Color("#ff4b4b"); // Red [Export] public Color DamageColor { get; set; } = new Color("#b21030"); // Red
[Export] public Color HealColor { get; set; } = new Color("#4bff65"); // Green [Export] public Color HealColor { get; set; } = new Color("#71f341"); // Green
[Export] public Color CoinColor { get; set; } = new Color("#ffd700"); // Gold [Export] public Color CoinColor { get; set; } = new Color("#ebd320"); // Gold
[Export] public Color MessageColor { get; set; } = new Color("#ffffff"); // White [Export] public Color MessageColor { get; set; } = new Color("#ffffff"); // White
public void ShowDamage(float amount, Vector2 position) public void ShowDamage(float amount, Vector2 position)

View File

@@ -1,7 +1,7 @@
[gd_scene load_steps=25 format=3 uid="uid://bockkmyn8il4c"] [gd_scene load_steps=25 format=3 uid="uid://bockkmyn8il4c"]
[ext_resource type="Shader" uid="uid://bs4xvm4qkurpr" path="res://shaders/hit_flash.tres" id="1_hh6y0"] [ext_resource type="Shader" uid="uid://bs4xvm4qkurpr" path="res://shaders/hit_flash.tres" id="1_hh6y0"]
[ext_resource type="Texture2D" uid="uid://cu72810eyk4dx" path="res://sprites/enemy-robot.png" id="2_os2h8"] [ext_resource type="Texture2D" uid="uid://duxx56wxmjoxd" path="res://sprites/basic_enemy.png" id="2_laaj3"]
[ext_resource type="Script" uid="uid://dgb8bqcri7nsj" path="res://scripts/components/HealthComponent.cs" id="3_n6phc"] [ext_resource type="Script" uid="uid://dgb8bqcri7nsj" path="res://scripts/components/HealthComponent.cs" id="3_n6phc"]
[ext_resource type="Script" uid="uid://2i7p7v135u7c" path="res://scripts/components/DamageComponent.cs" id="4_t0yic"] [ext_resource type="Script" uid="uid://2i7p7v135u7c" path="res://scripts/components/DamageComponent.cs" id="4_t0yic"]
[ext_resource type="Script" uid="uid://d2hrr8fruho1d" path="res://scripts/components/SideToSideMovementComponent.cs" id="5_h333r"] [ext_resource type="Script" uid="uid://d2hrr8fruho1d" path="res://scripts/components/SideToSideMovementComponent.cs" id="5_h333r"]
@@ -68,7 +68,7 @@ shape = SubResource("RectangleShape2D_pwwji")
[node name="Sprite2D" type="Sprite2D" parent="."] [node name="Sprite2D" type="Sprite2D" parent="."]
material = SubResource("ShaderMaterial_j18j0") material = SubResource("ShaderMaterial_j18j0")
texture = ExtResource("2_os2h8") texture = ExtResource("2_laaj3")
[node name="right bullet spawn" type="Node2D" parent="Sprite2D"] [node name="right bullet spawn" type="Node2D" parent="Sprite2D"]
position = Vector2(16, 7) position = Vector2(16, 7)
@@ -149,7 +149,7 @@ FireFX = NodePath("../FireFX")
[node name="IceEffectComponent" type="Node" parent="." node_paths=PackedStringArray("ComponentsToDisable", "StatusEffectComponent", "IceFx")] [node name="IceEffectComponent" type="Node" parent="." node_paths=PackedStringArray("ComponentsToDisable", "StatusEffectComponent", "IceFx")]
script = ExtResource("13_kga14") script = ExtResource("13_kga14")
ComponentsToDisable = [NodePath("../SideToSideMovement"), NodePath(""), NodePath("../DamageComponent")] ComponentsToDisable = [NodePath("../SideToSideMovement"), null, NodePath("../DamageComponent")]
StatusEffectComponent = NodePath("../StatusEffectComponent") StatusEffectComponent = NodePath("../StatusEffectComponent")
IceFx = NodePath("../Ice FX") IceFx = NodePath("../Ice FX")

View File

@@ -1,5 +1,6 @@
using System.Threading.Tasks; using System.Threading.Tasks;
using Godot; using Godot;
using Mr.BrickAdventures.Autoloads;
namespace Mr.BrickAdventures.scripts.components; namespace Mr.BrickAdventures.scripts.components;
@@ -14,9 +15,13 @@ public partial class LeverComponent : Node
[Signal] [Signal]
public delegate void ActivatedEventHandler(); public delegate void ActivatedEventHandler();
private FloatingTextManager _floatingTextManager;
public override void _Ready() public override void _Ready()
{ {
_floatingTextManager = GetNode<FloatingTextManager>("/root/FloatingTextManager");
if (Area == null) if (Area == null)
{ {
GD.PushError("LeverComponent: Area is not set."); GD.PushError("LeverComponent: Area is not set.");
@@ -46,6 +51,7 @@ public partial class LeverComponent : Node
private async Task Activate() private async Task Activate()
{ {
EmitSignalActivated(); EmitSignalActivated();
_floatingTextManager?.ShowMessage("Activated!", ((Node2D)Owner).GlobalPosition);
Sfx?.Play(); Sfx?.Play();
Sprite.Frame = StartAnimationIndex + 1; Sprite.Frame = StartAnimationIndex + 1;
var timer = GetTree().CreateTimer(AnimationDuration); var timer = GetTree().CreateTimer(AnimationDuration);

BIN
sprites/basic_enemy.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 489 B

View File

@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://duxx56wxmjoxd"
path="res://.godot/imported/basic_enemy.png-32481431dc8a0eb348a787c386b68288.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://sprites/basic_enemy.png"
dest_files=["res://.godot/imported/basic_enemy.png-32481431dc8a0eb348a787c386b68288.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1