mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-01 10:15:45 +00:00
Fix drops on enemies and treasure rooms
This commit is contained in:
parent
2c72f36108
commit
8d71a59d84
25 changed files with 81 additions and 40 deletions
|
|
@ -14,6 +14,7 @@ ShortName = &""
|
|||
ItemDescription = &"Activates Blue KeyPads"
|
||||
ItemKey = &"BLUE_KEY"
|
||||
Item = 1
|
||||
Tier = 0
|
||||
Price = 0
|
||||
Amount = 1
|
||||
Max = 1
|
||||
|
|
@ -23,4 +24,4 @@ UiType = 1
|
|||
Selectable = false
|
||||
AutoPickup = false
|
||||
InventorySprite = SubResource("AtlasTexture_ebbst")
|
||||
DropScenePath = &"res://Scenes/Items/Blue_Keycard.tscn"
|
||||
DropScenePath = &"res://Scenes/Items/GenericItem.tscn"
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ ShortName = &"CHAET"
|
|||
ItemDescription = &"Does massive damage"
|
||||
ItemKey = &"CHEAT_GUN"
|
||||
Item = 9
|
||||
Tier = 0
|
||||
Price = 0
|
||||
WeaponData = ExtResource("2_0na1t")
|
||||
Amount = 1
|
||||
|
|
@ -21,4 +22,4 @@ UiType = 1
|
|||
Selectable = true
|
||||
AutoPickup = false
|
||||
InventorySprite = ExtResource("2_0vddk")
|
||||
DropScenePath = &"res://Scenes/Items/Cheat_Gun_Pickup.tscn"
|
||||
DropScenePath = &"res://Scenes/Items/GenericItem.tscn"
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ ShortName = &""
|
|||
ItemDescription = &"Activates Gray KeyPads"
|
||||
ItemKey = &"GRAY_KEY"
|
||||
Item = 1
|
||||
Tier = 0
|
||||
Price = 0
|
||||
Amount = 1
|
||||
Max = 99
|
||||
|
|
@ -23,4 +24,4 @@ UiType = 1
|
|||
Selectable = false
|
||||
AutoPickup = false
|
||||
InventorySprite = SubResource("AtlasTexture_munhl")
|
||||
DropScenePath = &"res://Scenes/Items/Blue_Keycard.tscn"
|
||||
DropScenePath = &"res://Scenes/Items/GenericItem.tscn"
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ ShortName = &""
|
|||
ItemDescription = &"Activates Green KeyPads"
|
||||
ItemKey = &"GREEN_KEY"
|
||||
Item = 2
|
||||
Tier = 0
|
||||
Price = 0
|
||||
Amount = 1
|
||||
Max = 1
|
||||
|
|
@ -23,4 +24,4 @@ UiType = 1
|
|||
Selectable = false
|
||||
AutoPickup = false
|
||||
InventorySprite = SubResource("AtlasTexture_iasoh")
|
||||
DropScenePath = &"res://Scenes/Items/Green_Keycard.tscn"
|
||||
DropScenePath = &"res://Scenes/Items/GenericItem.tscn"
|
||||
|
|
|
|||
|
|
@ -6,10 +6,12 @@
|
|||
[resource]
|
||||
script = ExtResource("2_fg25e")
|
||||
ItemName = &"Green Points"
|
||||
ShortName = null
|
||||
ShortName = &""
|
||||
ItemDescription = &"Used for upgrades"
|
||||
ItemKey = &"GREEN_POINTS"
|
||||
Item = 11
|
||||
Tier = 0
|
||||
Price = 0
|
||||
Amount = 1
|
||||
Max = 100
|
||||
PickupIfMaxed = false
|
||||
|
|
@ -18,5 +20,5 @@ UiType = 0
|
|||
Selectable = false
|
||||
AutoPickup = true
|
||||
InventorySprite = ExtResource("1_b4fj2")
|
||||
DropScenePath = &"res://Scenes/Items/Green_Points_Pickup.tscn"
|
||||
DropScenePath = &"res://Scenes/Items/GenericItem.tscn"
|
||||
metadata/_custom_type_script = "uid://epnwjptvks3t"
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ ShortName = &""
|
|||
ItemDescription = &"Extends the max health"
|
||||
ItemKey = &"HEALTH_EXTEND"
|
||||
Item = 13
|
||||
Tier = 0
|
||||
Price = 0
|
||||
ItemEffect = SubResource("Resource_bltl4")
|
||||
Amount = 1
|
||||
|
|
@ -27,5 +28,5 @@ UiType = 0
|
|||
Selectable = false
|
||||
AutoPickup = false
|
||||
InventorySprite = ExtResource("1_00obu")
|
||||
DropScenePath = &"res://Scenes/Items/Heart_Extend_Pickup.tscn"
|
||||
DropScenePath = &"res://Scenes/Items/GenericItem.tscn"
|
||||
metadata/_custom_type_script = "uid://epnwjptvks3t"
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ ShortName = &"Health"
|
|||
ItemDescription = &"Gives back 25% of Max Health on use"
|
||||
ItemKey = &"HEALTH"
|
||||
Item = 4
|
||||
Tier = 0
|
||||
Price = 3
|
||||
ItemEffect = SubResource("Resource_vsvqq")
|
||||
Amount = 1
|
||||
|
|
@ -27,5 +28,5 @@ UiType = 0
|
|||
Selectable = true
|
||||
AutoPickup = true
|
||||
InventorySprite = ExtResource("1_xg75n")
|
||||
DropScenePath = &"res://Scenes/Items/Heart_Pickup.tscn"
|
||||
DropScenePath = &"res://Scenes/Items/GenericItem.tscn"
|
||||
metadata/_custom_type_script = "uid://epnwjptvks3t"
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ ShortName = &"IC-9"
|
|||
ItemDescription = &"Cirno\'s custom gun, shoots ice pellets and never runs out of ammo"
|
||||
ItemKey = &"ICICLE_GUN"
|
||||
Item = 9
|
||||
Tier = 0
|
||||
Price = 0
|
||||
WeaponData = ExtResource("1_itajb")
|
||||
Amount = 1
|
||||
|
|
@ -21,4 +22,4 @@ UiType = 1
|
|||
Selectable = true
|
||||
AutoPickup = false
|
||||
InventorySprite = ExtResource("2_eaoas")
|
||||
DropScenePath = &""
|
||||
DropScenePath = &"res://Scenes/Items/GenericItem.tscn"
|
||||
|
|
|
|||
|
|
@ -6,10 +6,12 @@
|
|||
[resource]
|
||||
script = ExtResource("2_swcup")
|
||||
ItemName = &"Credits"
|
||||
ShortName = null
|
||||
ShortName = &""
|
||||
ItemDescription = &"Can be used to buy things"
|
||||
ItemKey = &"CREDITS"
|
||||
Item = 12
|
||||
Tier = 0
|
||||
Price = 0
|
||||
Amount = 1
|
||||
Max = 10
|
||||
PickupIfMaxed = false
|
||||
|
|
@ -18,5 +20,5 @@ UiType = 0
|
|||
Selectable = true
|
||||
AutoPickup = true
|
||||
InventorySprite = ExtResource("1_woor7")
|
||||
DropScenePath = &"res://Scenes/Items/Credits_Pickup.tscn"
|
||||
DropScenePath = &"res://Scenes/Items/GenericItem.tscn"
|
||||
metadata/_custom_type_script = "uid://epnwjptvks3t"
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ ShortName = &"MP-42"
|
|||
ItemDescription = &"Shoots micro suns"
|
||||
ItemKey = &"NUCLEAR_GUN"
|
||||
Item = 9
|
||||
Tier = 0
|
||||
Price = 0
|
||||
WeaponData = ExtResource("3_5kq8e")
|
||||
Amount = 1
|
||||
|
|
@ -21,4 +22,4 @@ UiType = 1
|
|||
Selectable = true
|
||||
AutoPickup = false
|
||||
InventorySprite = ExtResource("1_qxsuv")
|
||||
DropScenePath = &"res://Scenes/Items/Nuclear_Gun_Pickup.tscn"
|
||||
DropScenePath = &"res://Scenes/Items/GenericItem.tscn"
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ ShortName = &""
|
|||
ItemDescription = &"Ammo for Nuclear weapons"
|
||||
ItemKey = &"NUCLEAR_AMMO"
|
||||
Item = 3
|
||||
Tier = 0
|
||||
Price = 0
|
||||
Amount = 5
|
||||
Max = 50
|
||||
|
|
@ -19,4 +20,4 @@ UiType = 2
|
|||
Selectable = false
|
||||
AutoPickup = true
|
||||
InventorySprite = ExtResource("1_nas3h")
|
||||
DropScenePath = &"uid://c1va8s6p050kx"
|
||||
DropScenePath = &"res://Scenes/Items/GenericItem.tscn"
|
||||
|
|
|
|||
|
|
@ -6,10 +6,12 @@
|
|||
[resource]
|
||||
script = ExtResource("2_rxsju")
|
||||
ItemName = &"Points"
|
||||
ShortName = null
|
||||
ShortName = &""
|
||||
ItemDescription = &"Necessari for upgrades"
|
||||
ItemKey = &"POINTS"
|
||||
Item = 11
|
||||
Tier = 0
|
||||
Price = 0
|
||||
Amount = 1
|
||||
Max = 100
|
||||
PickupIfMaxed = false
|
||||
|
|
@ -18,5 +20,5 @@ UiType = 0
|
|||
Selectable = false
|
||||
AutoPickup = true
|
||||
InventorySprite = ExtResource("1_nsfmo")
|
||||
DropScenePath = &"res://Scenes/Items/Points_Pickup.tscn"
|
||||
DropScenePath = &"res://Scenes/Items/GenericItem.tscn"
|
||||
metadata/_custom_type_script = "uid://epnwjptvks3t"
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ ShortName = &"Power"
|
|||
ItemDescription = &"Necessary for upgrades"
|
||||
ItemKey = &"POWER"
|
||||
Item = 10
|
||||
Tier = 0
|
||||
Price = 1
|
||||
Amount = 1
|
||||
Max = 100
|
||||
|
|
@ -19,4 +20,4 @@ UiType = 2
|
|||
Selectable = false
|
||||
AutoPickup = true
|
||||
InventorySprite = ExtResource("1_cang8")
|
||||
DropScenePath = &"res://Scenes/Items/Power_Pickup.tscn"
|
||||
DropScenePath = &"res://Scenes/Items/GenericItem.tscn"
|
||||
|
|
|
|||
|
|
@ -1,23 +1,23 @@
|
|||
[gd_resource type="Resource" script_class="LootItem" load_steps=5 format=3 uid="uid://dibquna7fww7t"]
|
||||
[gd_resource type="Resource" script_class="LootItem" load_steps=3 format=3 uid="uid://dibquna7fww7t"]
|
||||
|
||||
[ext_resource type="SpriteFrames" uid="uid://cikw4v6n0folb" path="res://Resources/Sprites/Red_Keycard_Overworld_Sprite.tres" id="1_1j6xs"]
|
||||
[ext_resource type="PackedScene" uid="uid://xvgx3vda1a5o" path="res://Scenes/HUD/Items/red_keycard.tscn" id="1_30txj"]
|
||||
[ext_resource type="Texture2D" uid="uid://bao53hesxreoh" path="res://Resources/Sprites/Red_Keycard_Inventory_Texture.tres" id="1_glhfu"]
|
||||
[ext_resource type="Script" uid="uid://epnwjptvks3t" path="res://Scripts/Resources/LootItem.cs" id="1_istlt"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_istlt")
|
||||
ItemName = &"Red Keycard"
|
||||
ShortName = &""
|
||||
ItemDescription = &"Opens Red KeyPads"
|
||||
ItemKey = &"RED_KEY"
|
||||
Item = 0
|
||||
Tier = 0
|
||||
Price = 0
|
||||
Amount = 1
|
||||
Max = 1
|
||||
PickupIfMaxed = false
|
||||
ConsumeOnUse = false
|
||||
UiType = 1
|
||||
Selectable = false
|
||||
AutoPickup = false
|
||||
InventorySprite = ExtResource("1_glhfu")
|
||||
WorldSprite = ExtResource("1_1j6xs")
|
||||
HudItemScene = ExtResource("1_30txj")
|
||||
DropScenePath = &"res://Scenes/Items/Red_Keycard.tscn"
|
||||
DropScenePath = &"res://Scenes/Items/GenericItem.tscn"
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ ShortName = &""
|
|||
ItemDescription = &"Extends the max shield"
|
||||
ItemKey = &"SHIELD_EXTEND"
|
||||
Item = 13
|
||||
Tier = 0
|
||||
Price = 0
|
||||
ItemEffect = SubResource("Resource_7h0ch")
|
||||
Amount = 1
|
||||
|
|
@ -27,5 +28,5 @@ UiType = 0
|
|||
Selectable = false
|
||||
AutoPickup = false
|
||||
InventorySprite = ExtResource("1_e61f8")
|
||||
DropScenePath = &"res://Scenes/Items/Shield_Extend_Pickup.tscn"
|
||||
DropScenePath = &"res://Scenes/Items/GenericItem.tscn"
|
||||
metadata/_custom_type_script = "uid://epnwjptvks3t"
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ ShortName = &"Shield"
|
|||
ItemDescription = &"Recharges the shield by 25%"
|
||||
ItemKey = &"SHIELD"
|
||||
Item = 8
|
||||
Tier = 0
|
||||
Price = 3
|
||||
ItemEffect = SubResource("Resource_qh6j2")
|
||||
Amount = 1
|
||||
|
|
@ -27,5 +28,5 @@ UiType = 0
|
|||
Selectable = true
|
||||
AutoPickup = true
|
||||
InventorySprite = ExtResource("1_0hq6q")
|
||||
DropScenePath = &"res://Scenes/Items/Shield_Pickup.tscn"
|
||||
DropScenePath = &"res://Scenes/Items/GenericItem.tscn"
|
||||
metadata/_custom_type_script = "uid://epnwjptvks3t"
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ metadata/_custom_type_script = "uid://cyipg3seetrxd"
|
|||
script = ExtResource("1_qd764")
|
||||
Name = &""
|
||||
BulletData = ExtResource("2_gpot4")
|
||||
Priority = 0
|
||||
RateOfFire = 1.0
|
||||
BulletCapacity = 10
|
||||
ReloadTime = 1.0
|
||||
|
|
@ -38,6 +39,7 @@ ShortName = &""
|
|||
ItemDescription = &"A snowball packed of explosive, explodes on contact"
|
||||
ItemKey = &"SPIDER_BOMB"
|
||||
Item = 5
|
||||
Tier = 0
|
||||
Price = 0
|
||||
ItemEffect = SubResource("Resource_2pgyg")
|
||||
WeaponData = SubResource("Resource_v5a4k")
|
||||
|
|
@ -49,5 +51,5 @@ UiType = 0
|
|||
Selectable = true
|
||||
AutoPickup = true
|
||||
InventorySprite = SubResource("AtlasTexture_gpot4")
|
||||
DropScenePath = &"res://Scenes/Items/SpiderBomb_Pickup.tscn"
|
||||
DropScenePath = &"res://Scenes/Items/GenericItem.tscn"
|
||||
metadata/_custom_type_script = "uid://epnwjptvks3t"
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ ShortName = &""
|
|||
ItemDescription = &"Opens Yellow KeyPads"
|
||||
ItemKey = &"YELLOW_KEY"
|
||||
Item = 0
|
||||
Tier = 0
|
||||
Price = 0
|
||||
Amount = 1
|
||||
Max = 1
|
||||
|
|
@ -23,4 +24,4 @@ UiType = 1
|
|||
Selectable = false
|
||||
AutoPickup = false
|
||||
InventorySprite = SubResource("AtlasTexture_ew85h")
|
||||
DropScenePath = &"res://Scenes/Items/Yellow_Keycard.tscn"
|
||||
DropScenePath = &"res://Scenes/Items/GenericItem.tscn"
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ ShortName = &""
|
|||
ItemDescription = &"Ammo for Ying-Yang based weapons"
|
||||
ItemKey = &"YINYANG_AMMO"
|
||||
Item = 3
|
||||
Tier = 0
|
||||
Price = 0
|
||||
Amount = 5
|
||||
Max = 50
|
||||
|
|
@ -19,4 +20,4 @@ UiType = 2
|
|||
Selectable = false
|
||||
AutoPickup = true
|
||||
InventorySprite = ExtResource("1_jt7l8")
|
||||
DropScenePath = &"uid://sjxkj5jdndxb"
|
||||
DropScenePath = &"res://Scenes/Items/GenericItem.tscn"
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ ShortName = &"SM-3"
|
|||
ItemDescription = &"A weapon that shoots explosive Yin-Yang Orbs"
|
||||
ItemKey = &"YINYANG_GUN"
|
||||
Item = 9
|
||||
Tier = 0
|
||||
Price = 0
|
||||
WeaponData = ExtResource("1_cuxft")
|
||||
Amount = 1
|
||||
|
|
@ -21,5 +22,5 @@ UiType = 1
|
|||
Selectable = true
|
||||
AutoPickup = false
|
||||
InventorySprite = ExtResource("1_2w24o")
|
||||
DropScenePath = &"res://Scenes/Items/Yin_Yang_Gun_Pickup.tscn"
|
||||
DropScenePath = &"res://Scenes/Items/GenericItem.tscn"
|
||||
metadata/_custom_type_script = "uid://epnwjptvks3t"
|
||||
|
|
|
|||
|
|
@ -6,15 +6,19 @@
|
|||
[resource]
|
||||
script = ExtResource("2_8wjtq")
|
||||
ItemName = &"Ying-Yang Orb"
|
||||
ShortName = &""
|
||||
ItemDescription = &"A mysterious orb emitting magical energy"
|
||||
ItemKey = &"YINYANG_ORB"
|
||||
Item = 13
|
||||
Tier = 0
|
||||
Price = 0
|
||||
Amount = 1
|
||||
Max = 1
|
||||
PickupIfMaxed = true
|
||||
ConsumeOnUse = true
|
||||
UiType = 0
|
||||
Selectable = false
|
||||
AutoPickup = false
|
||||
InventorySprite = ExtResource("1_pival")
|
||||
DropScenePath = &"res://Scenes/Items/Yin_Yang_Orb.tscn"
|
||||
DropScenePath = &"res://Scenes/Items/GenericItem.tscn"
|
||||
metadata/_custom_type_script = "uid://epnwjptvks3t"
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
[gd_resource type="Resource" script_class="RogueliteMapTheme" load_steps=65 format=3 uid="uid://cw6868vuvuynh"]
|
||||
[gd_resource type="Resource" script_class="RogueliteMapTheme" load_steps=72 format=3 uid="uid://cw6868vuvuynh"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://bwtif3if3ea0u" path="res://Scripts/Resources/RogueliteMapTheme.cs" id="1_2rtdw"]
|
||||
[ext_resource type="Resource" uid="uid://cltxhkrqp055v" path="res://Resources/Items/Money_Pickup.tres" id="1_ae3bb"]
|
||||
|
|
@ -56,6 +56,13 @@
|
|||
[ext_resource type="Resource" uid="uid://do1ly1s5etbt5" path="res://Resources/RogueliteMaps/Corridor_1x3.tres" id="46_mvnxq"]
|
||||
[ext_resource type="Resource" uid="uid://brsukcuyoq364" path="res://Resources/Items/NuclearGunPickup.tres" id="47_to7mi"]
|
||||
[ext_resource type="Resource" uid="uid://ccmuffmnevrt4" path="res://Resources/Items/Yin_Yang_Gun_Pickup.tres" id="48_w335g"]
|
||||
[ext_resource type="Resource" uid="uid://bhllj7r3oxipf" path="res://Resources/Items/IceShotgun_T2.tres" id="56_hvkru"]
|
||||
[ext_resource type="Resource" uid="uid://c01jixi7b2s7v" path="res://Resources/Items/IceShotgun_T1.tres" id="57_vgue3"]
|
||||
[ext_resource type="Resource" uid="uid://c57od7cpn5kwf" path="res://Resources/Items/IceShotgun_Sawed_T2.tres" id="58_akf4h"]
|
||||
[ext_resource type="Resource" uid="uid://btk4kojtepwv" path="res://Resources/Items/IceShotgun_Sawed_T1.tres" id="59_i20or"]
|
||||
[ext_resource type="Resource" uid="uid://dv0cdlx8d6evm" path="res://Resources/Items/IceShotgun_Sawed_T0.tres" id="60_vqfa4"]
|
||||
[ext_resource type="Resource" uid="uid://dwwbyyy3fo4bt" path="res://Resources/Items/IcicleRepeater_Advanced.tres" id="61_58120"]
|
||||
[ext_resource type="Resource" uid="uid://cajqlnyvlmybe" path="res://Resources/Items/IcicleRepeater_Improved.tres" id="62_j31dq"]
|
||||
|
||||
[sub_resource type="Resource" id="Resource_nnvxo"]
|
||||
script = ExtResource("11_eegnh")
|
||||
|
|
@ -138,7 +145,7 @@ metadata/_custom_type_script = "uid://rgx0g5iqksnn"
|
|||
|
||||
[sub_resource type="Resource" id="Resource_eegnh"]
|
||||
script = ExtResource("11_eegnh")
|
||||
Items = Array[Object]([ExtResource("45_f7mru"), ExtResource("46_3kwn2"), ExtResource("47_to7mi"), ExtResource("48_w335g")])
|
||||
Items = Array[Object]([ExtResource("45_f7mru"), ExtResource("46_3kwn2"), ExtResource("47_to7mi"), ExtResource("48_w335g"), ExtResource("56_hvkru"), ExtResource("57_vgue3"), ExtResource("58_akf4h"), ExtResource("59_i20or"), ExtResource("60_vqfa4"), ExtResource("61_58120"), ExtResource("62_j31dq")])
|
||||
metadata/_custom_type_script = "uid://rgx0g5iqksnn"
|
||||
|
||||
[resource]
|
||||
|
|
|
|||
|
|
@ -308,9 +308,11 @@ public partial class RogueliteRoom : Node2D
|
|||
|
||||
GD.Print($"Spawning {item.ItemKey} in treasure spot");
|
||||
|
||||
var dropInstance = item.Spawn(marker);
|
||||
|
||||
// Spawn
|
||||
var dropScene = GD.Load<PackedScene>(item.DropScenePath);
|
||||
var dropInstance = marker.CreateChild<Node2D>(dropScene);
|
||||
// var dropScene = GD.Load<PackedScene>(item.DropScenePath);
|
||||
// var dropInstance = marker.CreateChild<Node2D>(dropScene);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -12,11 +12,11 @@ public partial class ItemDrop : RigidBody2D
|
|||
private RandomNumberGenerator _rng = new();
|
||||
public override void _Ready()
|
||||
{
|
||||
PackedScene dropScene = GD.Load<PackedScene>(ItemToDrop.DropScenePath);
|
||||
Node dropInstance = dropScene.Instantiate();
|
||||
AddChild(dropInstance);
|
||||
var dropInstance = ItemToDrop.Spawn(this, true);
|
||||
|
||||
dropInstance.Owner = this;
|
||||
//Node dropInstance = dropScene.Instantiate();
|
||||
//AddChild(dropInstance);
|
||||
CallDeferred(MethodName.DelayedAddOwner, dropInstance);
|
||||
|
||||
float angle = _rng.RandfRange(0, Mathf.Tau); // 0 to 2π
|
||||
Vector2 direction = new Vector2(Mathf.Cos(angle), Mathf.Sin(angle)).Normalized();
|
||||
|
|
@ -24,4 +24,9 @@ public partial class ItemDrop : RigidBody2D
|
|||
// Apply impulse in that direction
|
||||
ApplyImpulse(direction * StartingSpeed);
|
||||
}
|
||||
|
||||
private void DelayedAddOwner(Node2D node)
|
||||
{
|
||||
node.Owner = this;
|
||||
}
|
||||
}
|
||||
|
|
@ -29,11 +29,11 @@ public partial class LootItem : Resource
|
|||
//[Export] public PackedScene HudItemScene;
|
||||
[Export(PropertyHint.File)] public StringName DropScenePath { get; private set; } // Has to be a string path to avoid recursion issues
|
||||
|
||||
public ItemPickup Spawn(Node2D parent)
|
||||
public ItemPickup Spawn(Node2D sibling, bool dropAsChild = false)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(DropScenePath)) return null;
|
||||
var itemScene = GD.Load<PackedScene>(DropScenePath);
|
||||
var spawnedItem = parent.CreateSibling<ItemPickup>(itemScene);
|
||||
var spawnedItem = dropAsChild ? sibling.CreateChild<ItemPickup>(itemScene) : sibling.CreateSibling<ItemPickup>(itemScene);
|
||||
|
||||
spawnedItem.Name = this.ItemKey;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue