mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-09 16:35:53 +00:00
Changed UI sprites to use sprite in resource
This commit is contained in:
parent
9717ca8a55
commit
f2482e4e38
10 changed files with 47 additions and 13 deletions
|
|
@ -1,6 +1,11 @@
|
|||
[gd_resource type="Resource" script_class="LootItem" load_steps=2 format=3 uid="uid://cj5aa7btaw6q0"]
|
||||
[gd_resource type="Resource" script_class="LootItem" load_steps=4 format=3 uid="uid://cj5aa7btaw6q0"]
|
||||
|
||||
[ext_resource type="Script" path="res://Scripts/Resources/LootItem.cs" id="1_k8cnp"]
|
||||
[ext_resource type="Texture2D" uid="uid://bvybqletsvqgk" path="res://Sprites/Items/BlueKeycard_Small.png" id="1_sgsjd"]
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_ebbst"]
|
||||
atlas = ExtResource("1_sgsjd")
|
||||
region = Rect2(0, 0, 16, 16)
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_k8cnp")
|
||||
|
|
@ -12,3 +17,4 @@ Max = 1
|
|||
PickupIfMaxed = false
|
||||
ConsumeOnUse = false
|
||||
UiType = 1
|
||||
InventorySprite = SubResource("AtlasTexture_ebbst")
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
[gd_resource type="Resource" script_class="LootItem" load_steps=4 format=3 uid="uid://cfq121rs3bsu8"]
|
||||
[gd_resource type="Resource" script_class="LootItem" load_steps=5 format=3 uid="uid://cfq121rs3bsu8"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://pemr2lrv3ylk" path="res://Scenes/HUD/Items/ying_yang_gun_huditem.tscn" id="1_i6xgq"]
|
||||
[ext_resource type="Resource" uid="uid://ckppo2seg313h" path="res://Resources/Weapons/Cheat_Gun.tres" id="2_0na1t"]
|
||||
[ext_resource type="Texture2D" uid="uid://61kfxc7k3do" path="res://Sprites/Items/Ying_Yang_Gun.png" id="2_5g5j1"]
|
||||
[ext_resource type="Script" path="res://Scripts/Resources/LootItem.cs" id="3_i0e51"]
|
||||
|
||||
[resource]
|
||||
|
|
@ -15,4 +16,5 @@ Max = 1
|
|||
PickupIfMaxed = true
|
||||
ConsumeOnUse = false
|
||||
UiType = 1
|
||||
InventorySprite = ExtResource("2_5g5j1")
|
||||
HudItemScene = ExtResource("1_i6xgq")
|
||||
|
|
|
|||
|
|
@ -1,7 +1,12 @@
|
|||
[gd_resource type="Resource" script_class="LootItem" load_steps=2 format=3 uid="uid://cspcgkr0tane2"]
|
||||
[gd_resource type="Resource" script_class="LootItem" load_steps=4 format=3 uid="uid://cspcgkr0tane2"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://bvkjnc3ggp7ba" path="res://Sprites/Items/GreenKeycard_Small.png" id="1_eyk8n"]
|
||||
[ext_resource type="Script" path="res://Scripts/Resources/LootItem.cs" id="1_t0s5w"]
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_iasoh"]
|
||||
atlas = ExtResource("1_eyk8n")
|
||||
region = Rect2(0, 0, 16, 16)
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_t0s5w")
|
||||
ItemName = "Green Keycard"
|
||||
|
|
@ -12,3 +17,4 @@ Max = 1
|
|||
PickupIfMaxed = false
|
||||
ConsumeOnUse = false
|
||||
UiType = 1
|
||||
InventorySprite = SubResource("AtlasTexture_iasoh")
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
[gd_resource type="Resource" script_class="LootItem" load_steps=4 format=3 uid="uid://dau0s8ob7qnpc"]
|
||||
[gd_resource type="Resource" script_class="LootItem" load_steps=5 format=3 uid="uid://dau0s8ob7qnpc"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://bqb3gbnrkqewt" path="res://Scenes/HUD/Items/ice_shotgun_huditem.tscn" id="1_13ven"]
|
||||
[ext_resource type="Resource" uid="uid://cyntngidhcbkc" path="res://Resources/Weapons/Ice_Shotgun_Weapon.tres" id="2_3le6e"]
|
||||
[ext_resource type="Texture2D" uid="uid://b46usr10jhmev" path="res://Sprites/Items/Ice_Shotgun.png" id="2_4ibag"]
|
||||
[ext_resource type="Script" path="res://Scripts/Resources/LootItem.cs" id="3_cjfxs"]
|
||||
|
||||
[resource]
|
||||
|
|
@ -15,4 +16,5 @@ Max = 1
|
|||
PickupIfMaxed = false
|
||||
ConsumeOnUse = false
|
||||
UiType = 1
|
||||
InventorySprite = ExtResource("2_4ibag")
|
||||
HudItemScene = ExtResource("1_13ven")
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
[gd_resource type="Resource" script_class="LootItem" load_steps=4 format=3 uid="uid://cs3ihltcn2166"]
|
||||
[gd_resource type="Resource" script_class="LootItem" load_steps=5 format=3 uid="uid://cs3ihltcn2166"]
|
||||
|
||||
[ext_resource type="Resource" uid="uid://b8apu0l5fm4k" path="res://Resources/Weapons/IcicleGun.tres" id="1_itajb"]
|
||||
[ext_resource type="PackedScene" uid="uid://cicthr1v5v4s2" path="res://Scenes/HUD/Items/icicle_gun.tscn" id="1_lfbsh"]
|
||||
[ext_resource type="Texture2D" uid="uid://duwiasewxvcb5" path="res://Sprites/Items/Icicle_Gun.png" id="2_eaoas"]
|
||||
[ext_resource type="Script" path="res://Scripts/Resources/LootItem.cs" id="2_hy2hk"]
|
||||
|
||||
[resource]
|
||||
|
|
@ -15,4 +16,5 @@ Max = 1
|
|||
PickupIfMaxed = false
|
||||
ConsumeOnUse = false
|
||||
UiType = 1
|
||||
InventorySprite = ExtResource("2_eaoas")
|
||||
HudItemScene = ExtResource("1_lfbsh")
|
||||
|
|
|
|||
|
|
@ -3,5 +3,7 @@
|
|||
[ext_resource type="Texture2D" uid="uid://duwiasewxvcb5" path="res://Sprites/Items/Icicle_Gun.png" id="1_ebd3h"]
|
||||
|
||||
[node name="IcicleGun" type="TextureRect"]
|
||||
offset_right = 16.0
|
||||
offset_bottom = 16.0
|
||||
texture = ExtResource("1_ebd3h")
|
||||
stretch_mode = 2
|
||||
|
|
|
|||
|
|
@ -92,7 +92,12 @@ public partial class Hud : CanvasLayer
|
|||
var hbox = new HBoxContainer();
|
||||
_itemsContainer.AddChild(hbox);
|
||||
|
||||
var instance = item.HudItemScene.Instantiate<TextureRect>();
|
||||
var instance = new TextureRect();
|
||||
instance.Texture = item.InventorySprite;
|
||||
instance.StretchMode = TextureRect.StretchModeEnum.Keep;
|
||||
// change transform size?
|
||||
|
||||
//var instance = item.HudItemScene.Instantiate<TextureRect>();
|
||||
//_in.CallDeferred("add_child", instance);
|
||||
hbox.AddChild(instance);
|
||||
|
||||
|
|
|
|||
|
|
@ -348,11 +348,11 @@ public partial class PlayerMovement : CharacterBody2D, IDestructible
|
|||
EmitSignal(nameof(InteractableAreaEntered), interactable);
|
||||
|
||||
if (_selector == null) return;
|
||||
//_selector.Position = interactable.Position;
|
||||
_selector.SelectedInteractable = interactable;
|
||||
//_selector.AddInteractable(interactable);
|
||||
//_selector.Visible = true;
|
||||
//_lastInteractable = interactable;
|
||||
|
||||
_selector.AddInteractable(interactable);
|
||||
|
||||
//_selector.SelectedInteractable = interactable;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ public partial class LootItem : Resource
|
|||
[Export] public bool ConsumeOnUse;
|
||||
[Export] public UiItemType UiType;
|
||||
|
||||
[Export] public AtlasTexture InventorySprite;
|
||||
[Export] public Texture2D InventorySprite;
|
||||
[Export] public SpriteFrames WorldSprite;
|
||||
[Export] public PackedScene HudItemScene;
|
||||
|
||||
|
|
|
|||
|
|
@ -47,7 +47,15 @@ public partial class Selector : Node2D
|
|||
if (Input.IsActionJustPressed("scan"))
|
||||
{
|
||||
SelectNext();
|
||||
|
||||
}
|
||||
|
||||
if (SelectedInteractable != null) {
|
||||
this.Visible = true;
|
||||
this.GlobalPosition = SelectedInteractable.GlobalPosition;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.Visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -107,6 +115,7 @@ public partial class Selector : Node2D
|
|||
|
||||
public void UpdatePosition()
|
||||
{
|
||||
return;
|
||||
if (SelectedInteractable != null)
|
||||
{
|
||||
this.Position = SelectedInteractable.Position;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue