Implement all current work-in-progress features (#43)

* Add WIP vendors

* Add TimerExtensions

* chore: Update dialogue manager version

* Add Inventory.EquippedItem signal

* Move files to UI.Inventory namespace

* Modify Hotbar and InventorySlot organization

Made InventorySlot a bit more modular.

* Modify hotbar icons

* Implement request to display shop

* Add forsenLevel placeholder icon

* Add shop UI

* Update UI to use theme and click through

* Update item metadata

Added placeholder icons for items without an icon.

* Add Snus Dealer example vendor NPC

* Implement factions with bitflags instead

* Fix typo in Doc dialogue

* Hide and show shop menu

* Add shaders

* Add newline to console output

* Add modal interface

* wip: new sprites

* Add new tileset

* wip: Redesign Depths of the Arena

* Change tiles

* Implement igniting bow arrows

* Add bow alt-fire ability

* Update Arena redesign

* Add Doc summon sounds

* Add inventory menu

* Add glow to effects

* Add some props to ArenaExterior

* Add alt fire to RangedIdleState

* Add keybinds for inventory menu

* Make arrows remain on fire if bow was set on fire

* Redesign Arena

* Add Sword effects and self knockback

* Update lighting effects

* Add wait/delay for Doc to exit when attacking

* Modify UI
impl-save-inventory
HumanoidSandvichDispenser 2024-09-16 12:33:29 -07:00 committed by GitHub
parent 12767e3c70
commit b687b49e52
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
63 changed files with 1589 additions and 615 deletions

View File

@ -16,4 +16,10 @@ I can write english pretty good but since It is not my mothertounge I will make
The dark room was clouded with smoke as the 1st lieutenant entered the room. He walked slowly , trying to avoid the big clouds, towards the black desk where a man in black cape was sitting and enjoying his last cigar.
=> END
=> END
~ wall_writing
"Life's not fair. Get a grip." -- Doc, The Two Time
=> END

Binary file not shown.

View File

@ -0,0 +1,19 @@
[remap]
importer="mp3"
type="AudioStreamMP3"
uid="uid://bskrlh73x1sgp"
path="res://.godot/imported/doc-summon.mp3-ebe66881fc8469c2b9dc405db43209d0.mp3str"
[deps]
source_file="res://Assets/Sounds/doc-summon.mp3"
dest_files=["res://.godot/imported/doc-summon.mp3-ebe66881fc8469c2b9dc405db43209d0.mp3str"]
[params]
loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://xgy5gihyxgih"
path="res://.godot/imported/fire-32x32.png-6317a2b0efbef8c9d4ff90f6384746c6.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Assets/Sprites/Misc/fire-32x32.png"
dest_files=["res://.godot/imported/fire-32x32.png-6317a2b0efbef8c9d4ff90f6384746c6.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

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 743 B

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://c1garalf1clsp"
path="res://.godot/imported/flame-large.png-41b172a8bfc9c186ab97a98ae0c5a459.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Assets/Sprites/Misc/flame-large.png"
dest_files=["res://.godot/imported/flame-large.png-41b172a8bfc9c186ab97a98ae0c5a459.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

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 92 B

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bitpf645g0prl"
path="res://.godot/imported/torch-base.png-d14e78df3788bf6d3a9565b574d6c1a1.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Assets/Sprites/Misc/torch-base.png"
dest_files=["res://.godot/imported/torch-base.png-d14e78df3788bf6d3a9565b574d6c1a1.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

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 379 B

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://cyfyelyq3o15s"
path="res://.godot/imported/torch-fire.png-a9f51cf7273c726b68014cb26a31d54c.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Assets/Sprites/Misc/torch-fire.png"
dest_files=["res://.godot/imported/torch-fire.png-a9f51cf7273c726b68014cb26a31d54c.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

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 379 B

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://i5ksh8i0q48o"
path="res://.godot/imported/torch-lamp-base-back.png-a6c17eff02f04f493c4e495a2d662d5a.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Assets/Sprites/Misc/torch-lamp-base-back.png"
dest_files=["res://.godot/imported/torch-lamp-base-back.png-a6c17eff02f04f493c4e495a2d662d5a.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

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 416 B

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://ca0htndnsb38k"
path="res://.godot/imported/torch-lamp-base.png-03b38ecb41ff35cadec5aeaad2c98e38.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Assets/Sprites/Misc/torch-lamp-base.png"
dest_files=["res://.godot/imported/torch-lamp-base.png-03b38ecb41ff35cadec5aeaad2c98e38.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

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 783 B

After

Width:  |  Height:  |  Size: 810 B

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 152 B

After

Width:  |  Height:  |  Size: 148 B

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 4.8 KiB

View File

@ -0,0 +1,70 @@
using Godot;
using System.Linq;
using System.Collections.Generic;
namespace SupaLidlGame.BoundingBoxes;
public partial class OcclusionTrigger : Area2D
{
[Export]
public double FadeDuration { get; set; }
[Export]
public Godot.Collections.Array<string> Groups { get; set; }
private Tween _tween = null;
public override void _Ready()
{
Connect(SignalName.BodyEntered, new Callable(this, nameof(OnBodyEntered)));
Connect(SignalName.BodyExited, new Callable(this, nameof(OnBodyExited)));
}
private IEnumerable<CanvasItem> GetCanvasItems()
{
IEnumerable<IEnumerable<CanvasItem>> pack()
{
foreach (string group in Groups)
{
var nodes = GetTree().GetNodesInGroup(group)
.OfType<CanvasItem>();
yield return nodes;
}
}
return pack().SelectMany(e => e);
}
private void OnBodyEntered(Node2D _)
{
if (IsInstanceValid(_tween))
{
_tween.Kill();
}
_tween = GetTree().CreateTween();
_tween.SetParallel();
foreach (var node in GetCanvasItems())
{
_tween.TweenProperty(node, "modulate", Colors.Transparent, FadeDuration);
}
}
private void OnBodyExited(Node2D _)
{
if (IsInstanceValid(_tween))
{
_tween.Kill();
}
_tween = GetTree().CreateTween();
_tween.SetParallel();
foreach (var node in GetCanvasItems())
{
_tween.TweenProperty(node, "modulate", Colors.White, FadeDuration);
}
}
}

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=70 format=3 uid="uid://d2skjvvx6fal0"]
[gd_scene load_steps=71 format=3 uid="uid://d2skjvvx6fal0"]
[ext_resource type="Script" path="res://Characters/Doc.cs" id="2_3elet"]
[ext_resource type="Shader" path="res://Shaders/Flash.gdshader" id="2_5jxom"]
@ -38,6 +38,7 @@
[ext_resource type="PackedScene" uid="uid://p7oijq6dbvvk" path="res://Items/Weapons/DocLance.tscn" id="24_2es2r"]
[ext_resource type="AudioStream" uid="uid://cqj44je3mvk60" path="res://Assets/Sounds/rauuul.wav" id="26_js7p2"]
[ext_resource type="PackedScene" uid="uid://dldnp8eunxj3q" path="res://BoundingBoxes/InteractionTrigger.tscn" id="33_08dyq"]
[ext_resource type="AudioStream" uid="uid://bskrlh73x1sgp" path="res://Assets/Sounds/doc-summon.mp3" id="34_g57b0"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_7n7iy"]
resource_local_to_scene = true
@ -327,6 +328,21 @@ tracks/2/keys = {
"update": 0,
"values": [Vector2(1.5, 0.75), Vector2(1, 1)]
}
tracks/3/type = "audio"
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/path = NodePath("../Effects/SummonCry")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/keys = {
"clips": [{
"end_offset": 1.1,
"start_offset": 0.4,
"stream": ExtResource("34_g57b0")
}],
"times": PackedFloat32Array(0)
}
tracks/3/use_blend = true
[sub_resource type="AnimationLibrary" id="AnimationLibrary_rpply"]
_data = {
@ -760,6 +776,9 @@ attenuation = 0.5
[node name="HurtSound" type="AudioStreamPlayer2D" parent="Effects"]
stream = ExtResource("9_stm0e")
[node name="SummonCry" type="AudioStreamPlayer2D" parent="Effects"]
attenuation = 4.0
[node name="Sprite" type="Sprite2D" parent="."]
y_sort_enabled = true
use_parent_material = true
@ -785,14 +804,8 @@ script = ExtResource("8_r8ejq")
Hotbar = []
Items = []
[node name="DocLance" parent="Inventory" node_paths=PackedStringArray("Hitbox", "AnimationPlayer", "ParryParticles", "StateMachine", "Anchor", "HandAnchor") instance=ExtResource("24_2es2r")]
[node name="DocLance" parent="Inventory" instance=ExtResource("24_2es2r")]
unique_name_in_owner = true
Hitbox = NodePath("Hitbox")
AnimationPlayer = NodePath("AnimationPlayer")
ParryParticles = NodePath("Anchor/Node2D/Sprite2D/ParryParticles")
StateMachine = NodePath("State")
Anchor = NodePath("Anchor")
HandAnchor = NodePath("Anchor/Node2D/Sprite2D/Hand")
[node name="InteractionTrigger" parent="." instance=ExtResource("33_08dyq")]

View File

@ -27,7 +27,6 @@
[ext_resource type="Script" path="res://BoundingBoxes/InteractionRay.cs" id="13_hs3u1"]
[ext_resource type="Script" path="res://State/Character/PlayerHealState.cs" id="13_t103m"]
[ext_resource type="Script" path="res://State/Character/PlayerMaxLevelState.cs" id="14_1sn10"]
[ext_resource type="Texture2D" uid="uid://d1ukste16yq6v" path="res://Assets/Sprites/Particles/player-light.png" id="15_3hahh"]
[ext_resource type="Script" path="res://Utils/DamageTime.cs" id="15_4xl06"]
[ext_resource type="AudioStream" uid="uid://st8qgqiygy5a" path="res://Assets/Sounds/electricity.wav" id="15_61bua"]
[ext_resource type="PackedScene" uid="uid://ce0ph4wk0ylra" path="res://UI/TargetTracer.tscn" id="22_hxi53"]
@ -36,9 +35,10 @@
[ext_resource type="Script" path="res://addons/phantom_camera/scripts/phantom_camera/phantom_camera_2d.gd" id="27_mndpv"]
[ext_resource type="Script" path="res://addons/phantom_camera/scripts/resources/tween_resource.gd" id="28_6gq8l"]
[ext_resource type="Script" path="res://Items/PlayerInventory.cs" id="30_y2wmw"]
[ext_resource type="PackedScene" uid="uid://cgg0sfm2qeiwn" path="res://Items/Weapons/Bow.tscn" id="31_mofvy"]
[ext_resource type="PackedScene" uid="uid://dvqap2uhcah63" path="res://Items/Weapons/Sword.tscn" id="31_ql4as"]
[ext_resource type="PackedScene" uid="uid://5y1acxl4j4n7" path="res://Items/Weapons/Pugio.tscn" id="32_6ffmm"]
[ext_resource type="Resource" uid="uid://cl7jvdu2lnv2d" path="res://Items/Weapons/Sword.tres" id="33_3qyfl"]
[ext_resource type="Resource" uid="uid://cjsh0dcgbfn77" path="res://Items/Weapons/Bow.tres" id="34_70ron"]
[ext_resource type="Resource" uid="uid://iqe6rgnb3jur" path="res://Items/Weapons/Pugio.tres" id="35_4pap1"]
[ext_resource type="Texture2D" uid="uid://coarr28adgo1u" path="res://Assets/Sprites/Particles/point-light.png" id="38_6udj8"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_h78y7"]
shader = ExtResource("2_ngsgt")
@ -836,35 +836,14 @@ horizontal_alignment = 1
[node name="Inventory" type="Node2D" parent="." node_paths=PackedStringArray("Hotbar")]
y_sort_enabled = true
script = ExtResource("30_y2wmw")
Hotbar = [NodePath("Sword"), NodePath("Bow"), NodePath("Pugio")]
Hotbar = [null, null, null]
Items = Array[Object]([ExtResource("33_3qyfl"), ExtResource("34_70ron"), ExtResource("35_4pap1")])
InventoryMap = {
"equip_1": 0,
"equip_2": 1,
"equip_3": 2
}
[node name="Bow" parent="Inventory" node_paths=PackedStringArray("StateMachine") instance=ExtResource("31_mofvy")]
visible = false
StateMachine = NodePath("StateMachine")
[node name="Sword" parent="Inventory" node_paths=PackedStringArray("Hitbox", "AnimationPlayer", "ParryParticles", "StateMachine", "Anchor", "HandAnchor") instance=ExtResource("31_ql4as")]
visible = false
Hitbox = NodePath("Hitbox")
AnimationPlayer = NodePath("AnimationPlayer")
ParryParticles = NodePath("Anchor/Node2D/Sprite2D/ParryParticles")
StateMachine = NodePath("State")
Anchor = NodePath("Anchor")
HandAnchor = NodePath("Anchor/Node2D/Sprite2D/Hand")
[node name="Pugio" parent="Inventory" node_paths=PackedStringArray("Hitbox", "AnimationPlayer", "ParryParticles", "StateMachine", "Anchor", "HandAnchor") instance=ExtResource("32_6ffmm")]
visible = false
Hitbox = NodePath("Hitbox")
AnimationPlayer = NodePath("AnimationPlayer")
ParryParticles = NodePath("Anchor/Node2D/Sprite2D/ParryParticles")
StateMachine = NodePath("State")
Anchor = NodePath("Anchor")
HandAnchor = NodePath("Anchor/Node2D/Sprite2D/Hand")
[node name="Hurtbox" parent="." node_paths=PackedStringArray("InvincibilityTimer") instance=ExtResource("9_avyu4")]
visible = false
InvincibilityTimer = NodePath("Timer")
@ -892,12 +871,12 @@ script = ExtResource("13_hs3u1")
[node name="PointLight2D" type="PointLight2D" parent="."]
position = Vector2(0, -4)
blend_mode = 2
energy = 0.2
shadow_enabled = true
shadow_filter = 2
shadow_filter_smooth = 3.0
texture = ExtResource("15_3hahh")
height = 10.0
texture = ExtResource("38_6udj8")
texture_scale = 0.5
[node name="DamageTime" type="Node" parent="."]
script = ExtResource("15_4xl06")

View File

@ -17,11 +17,9 @@ gradient = SubResource("Gradient_uqfn8")
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_yg5po"]
particle_flag_disable_z = true
direction = Vector3(-1, 0, 0)
gravity = Vector3(0, 0, 0)
initial_velocity_min = 4.0
initial_velocity_max = 8.0
orbit_velocity_min = 0.0
orbit_velocity_max = 0.0
gravity = Vector3(0, 0, 0)
scale_min = 2.0
scale_max = 2.0
color_ramp = SubResource("GradientTexture1D_te0n4")
@ -41,6 +39,7 @@ texture = ExtResource("1_0im1r")
centered = false
[node name="Hitbox" parent="." instance=ExtResource("3_f4lib")]
priority = 5
[node name="CollisionShape2D" parent="Hitbox" index="0"]
position = Vector2(0, -0.5)

View File

@ -85,7 +85,7 @@ tracks/2/keys = {
"times": PackedFloat32Array(0, 0.7),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [0.5, 0.0]
"values": [1.0, 0.0]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_g3m4l"]
@ -105,6 +105,7 @@ ProjectileName = "Lightning"
Hitbox = NodePath("Hitbox")
[node name="Sprite2D" type="Sprite2D" parent="."]
modulate = Color(4, 4, 4, 1)
material = SubResource("CanvasItemMaterial_3bsa7")
position = Vector2(0, 8)
texture = ExtResource("1_bf8ae")
@ -119,6 +120,7 @@ libraries = {
[node name="Hitbox" parent="." instance=ExtResource("3_vlt1v")]
collision_layer = 0
priority = 5
Damage = 20.0
[node name="CollisionShape2D" parent="Hitbox" index="0"]

View File

@ -1,59 +1,60 @@
[gd_scene load_steps=12 format=3 uid="uid://c1w7t6irnohfx"]
[gd_scene load_steps=13 format=3 uid="uid://c1w7t6irnohfx"]
[ext_resource type="Texture2D" uid="uid://har1bd5u4dq3" path="res://Assets/Sprites/Misc/torch.png" id="1_14bgb"]
[ext_resource type="Texture2D" uid="uid://cyfyelyq3o15s" path="res://Assets/Sprites/Misc/torch-fire.png" id="1_gnoxc"]
[ext_resource type="Texture2D" uid="uid://bitpf645g0prl" path="res://Assets/Sprites/Misc/torch-base.png" id="2_cwgtj"]
[ext_resource type="Texture2D" uid="uid://coarr28adgo1u" path="res://Assets/Sprites/Particles/point-light.png" id="2_hotvd"]
[sub_resource type="AtlasTexture" id="AtlasTexture_js1l1"]
atlas = ExtResource("1_14bgb")
region = Rect2(0, 0, 8, 12)
[sub_resource type="AtlasTexture" id="AtlasTexture_vnjya"]
atlas = ExtResource("1_gnoxc")
region = Rect2(0, 0, 8, 8)
[sub_resource type="AtlasTexture" id="AtlasTexture_gdxtl"]
atlas = ExtResource("1_14bgb")
region = Rect2(8, 0, 8, 12)
[sub_resource type="AtlasTexture" id="AtlasTexture_l2emm"]
atlas = ExtResource("1_gnoxc")
region = Rect2(8, 0, 8, 8)
[sub_resource type="AtlasTexture" id="AtlasTexture_da7fw"]
atlas = ExtResource("1_14bgb")
region = Rect2(16, 0, 8, 12)
[sub_resource type="AtlasTexture" id="AtlasTexture_03weu"]
atlas = ExtResource("1_gnoxc")
region = Rect2(16, 0, 8, 8)
[sub_resource type="AtlasTexture" id="AtlasTexture_rpccx"]
atlas = ExtResource("1_14bgb")
region = Rect2(24, 0, 8, 12)
[sub_resource type="AtlasTexture" id="AtlasTexture_1fqw1"]
atlas = ExtResource("1_gnoxc")
region = Rect2(24, 0, 8, 8)
[sub_resource type="AtlasTexture" id="AtlasTexture_crwu1"]
atlas = ExtResource("1_14bgb")
region = Rect2(32, 0, 8, 12)
[sub_resource type="AtlasTexture" id="AtlasTexture_sj1bi"]
atlas = ExtResource("1_gnoxc")
region = Rect2(32, 0, 8, 8)
[sub_resource type="AtlasTexture" id="AtlasTexture_r3kxc"]
atlas = ExtResource("1_14bgb")
region = Rect2(40, 0, 8, 12)
[sub_resource type="AtlasTexture" id="AtlasTexture_1xpxx"]
atlas = ExtResource("1_gnoxc")
region = Rect2(40, 0, 8, 8)
[sub_resource type="AtlasTexture" id="AtlasTexture_225la"]
atlas = ExtResource("1_14bgb")
region = Rect2(48, 0, 8, 12)
[sub_resource type="AtlasTexture" id="AtlasTexture_dxfgw"]
atlas = ExtResource("1_gnoxc")
region = Rect2(48, 0, 8, 8)
[sub_resource type="SpriteFrames" id="SpriteFrames_gf7ku"]
animations = [{
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_js1l1")
"texture": SubResource("AtlasTexture_vnjya")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_gdxtl")
"texture": SubResource("AtlasTexture_l2emm")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_da7fw")
"texture": SubResource("AtlasTexture_03weu")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_rpccx")
"texture": SubResource("AtlasTexture_1fqw1")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_crwu1")
"texture": SubResource("AtlasTexture_sj1bi")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_r3kxc")
"texture": SubResource("AtlasTexture_1xpxx")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_225la")
"texture": SubResource("AtlasTexture_dxfgw")
}],
"loop": true,
"name": &"default",
@ -64,18 +65,25 @@ animations = [{
radius = 4.0
[node name="Torch" type="Node2D"]
y_sort_enabled = true
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
texture_filter = 1
position = Vector2(0, -10)
[node name="Sprites" type="Node2D" parent="."]
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="Sprites"]
modulate = Color(3.5, 3.5, 3, 1)
position = Vector2(0, -14)
sprite_frames = SubResource("SpriteFrames_gf7ku")
autoplay = "default"
frame_progress = 0.337799
[node name="Sprite2D" type="Sprite2D" parent="Sprites"]
position = Vector2(0, -8)
texture = ExtResource("2_cwgtj")
[node name="PointLight2D" type="PointLight2D" parent="."]
color = Color(1, 0.976471, 0.92549, 1)
color = Color(1, 0.811765, 0.537255, 1)
energy = 1.2
blend_mode = 2
shadow_enabled = true
shadow_filter_smooth = 3.0
texture = ExtResource("2_hotvd")
offset = Vector2(0, 2)

View File

@ -1,94 +1,96 @@
[gd_scene load_steps=16 format=3 uid="uid://ceadk7pam7vab"]
[gd_scene load_steps=18 format=3 uid="uid://ceadk7pam7vab"]
[ext_resource type="Texture2D" uid="uid://cyldr0ck3yfrp" path="res://Assets/Sprites/Misc/torch-lamp.png" id="1_dlkl0"]
[ext_resource type="Texture2D" uid="uid://coarr28adgo1u" path="res://Assets/Sprites/Particles/point-light.png" id="2_0xpf8"]
[ext_resource type="Texture2D" uid="uid://c1garalf1clsp" path="res://Assets/Sprites/Misc/flame-large.png" id="2_a6lwn"]
[ext_resource type="Texture2D" uid="uid://ca0htndnsb38k" path="res://Assets/Sprites/Misc/torch-lamp-base.png" id="2_bq1kw"]
[ext_resource type="Texture2D" uid="uid://i5ksh8i0q48o" path="res://Assets/Sprites/Misc/torch-lamp-base-back.png" id="3_vh465"]
[sub_resource type="AtlasTexture" id="AtlasTexture_ikvnd"]
atlas = ExtResource("1_dlkl0")
region = Rect2(0, 0, 12, 24)
[sub_resource type="AtlasTexture" id="AtlasTexture_dtmd3"]
atlas = ExtResource("2_a6lwn")
region = Rect2(0, 0, 12, 14)
[sub_resource type="AtlasTexture" id="AtlasTexture_b7wal"]
atlas = ExtResource("1_dlkl0")
region = Rect2(12, 0, 12, 24)
[sub_resource type="AtlasTexture" id="AtlasTexture_irtpk"]
atlas = ExtResource("2_a6lwn")
region = Rect2(12, 0, 12, 14)
[sub_resource type="AtlasTexture" id="AtlasTexture_68y2k"]
atlas = ExtResource("1_dlkl0")
region = Rect2(24, 0, 12, 24)
[sub_resource type="AtlasTexture" id="AtlasTexture_0gb20"]
atlas = ExtResource("2_a6lwn")
region = Rect2(24, 0, 12, 14)
[sub_resource type="AtlasTexture" id="AtlasTexture_eib4d"]
atlas = ExtResource("1_dlkl0")
region = Rect2(36, 0, 12, 24)
[sub_resource type="AtlasTexture" id="AtlasTexture_5uhdg"]
atlas = ExtResource("2_a6lwn")
region = Rect2(36, 0, 12, 14)
[sub_resource type="AtlasTexture" id="AtlasTexture_7q5cd"]
atlas = ExtResource("1_dlkl0")
region = Rect2(48, 0, 12, 24)
[sub_resource type="AtlasTexture" id="AtlasTexture_e4moo"]
atlas = ExtResource("2_a6lwn")
region = Rect2(48, 0, 12, 14)
[sub_resource type="AtlasTexture" id="AtlasTexture_k8jtr"]
atlas = ExtResource("1_dlkl0")
region = Rect2(60, 0, 12, 24)
[sub_resource type="AtlasTexture" id="AtlasTexture_soja6"]
atlas = ExtResource("2_a6lwn")
region = Rect2(60, 0, 12, 14)
[sub_resource type="AtlasTexture" id="AtlasTexture_egan1"]
atlas = ExtResource("1_dlkl0")
region = Rect2(72, 0, 12, 24)
[sub_resource type="AtlasTexture" id="AtlasTexture_sn741"]
atlas = ExtResource("2_a6lwn")
region = Rect2(72, 0, 12, 14)
[sub_resource type="AtlasTexture" id="AtlasTexture_eymjc"]
atlas = ExtResource("1_dlkl0")
region = Rect2(84, 0, 12, 24)
[sub_resource type="AtlasTexture" id="AtlasTexture_r825r"]
atlas = ExtResource("2_a6lwn")
region = Rect2(84, 0, 12, 14)
[sub_resource type="AtlasTexture" id="AtlasTexture_go3ky"]
atlas = ExtResource("1_dlkl0")
region = Rect2(96, 0, 12, 24)
[sub_resource type="AtlasTexture" id="AtlasTexture_75y5m"]
atlas = ExtResource("2_a6lwn")
region = Rect2(96, 0, 12, 14)
[sub_resource type="AtlasTexture" id="AtlasTexture_rvq52"]
atlas = ExtResource("1_dlkl0")
region = Rect2(108, 0, 12, 24)
[sub_resource type="AtlasTexture" id="AtlasTexture_l8r4c"]
atlas = ExtResource("2_a6lwn")
region = Rect2(108, 0, 12, 14)
[sub_resource type="AtlasTexture" id="AtlasTexture_cjdtb"]
atlas = ExtResource("1_dlkl0")
region = Rect2(120, 0, 12, 24)
[sub_resource type="AtlasTexture" id="AtlasTexture_7gxo8"]
atlas = ExtResource("2_a6lwn")
region = Rect2(120, 0, 12, 14)
[sub_resource type="AtlasTexture" id="AtlasTexture_vi5xh"]
atlas = ExtResource("1_dlkl0")
region = Rect2(132, 0, 12, 24)
[sub_resource type="AtlasTexture" id="AtlasTexture_60wov"]
atlas = ExtResource("2_a6lwn")
region = Rect2(132, 0, 12, 14)
[sub_resource type="SpriteFrames" id="SpriteFrames_gf7ku"]
animations = [{
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_ikvnd")
"texture": SubResource("AtlasTexture_dtmd3")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_b7wal")
"texture": SubResource("AtlasTexture_irtpk")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_68y2k")
"texture": SubResource("AtlasTexture_0gb20")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_eib4d")
"texture": SubResource("AtlasTexture_5uhdg")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_7q5cd")
"texture": SubResource("AtlasTexture_e4moo")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_k8jtr")
"texture": SubResource("AtlasTexture_soja6")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_egan1")
"texture": SubResource("AtlasTexture_sn741")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_eymjc")
"texture": SubResource("AtlasTexture_r825r")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_go3ky")
"texture": SubResource("AtlasTexture_75y5m")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_rvq52")
"texture": SubResource("AtlasTexture_l8r4c")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_cjdtb")
"texture": SubResource("AtlasTexture_7gxo8")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_vi5xh")
"texture": SubResource("AtlasTexture_60wov")
}],
"loop": true,
"name": &"default",
@ -97,15 +99,26 @@ animations = [{
[node name="TorchLamp" type="Node2D"]
[node name="Sprite2D2" type="Sprite2D" parent="."]
texture = ExtResource("3_vh465")
centered = false
offset = Vector2(-6, -16)
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
modulate = Color(2.5, 2, 2, 1)
y_sort_enabled = true
texture_filter = 1
position = Vector2(0, -6)
sprite_frames = SubResource("SpriteFrames_gf7ku")
autoplay = "default"
frame = 9
frame_progress = 0.966501
frame_progress = 0.557817
offset = Vector2(0, -12)
[node name="Sprite2D" type="Sprite2D" parent="."]
texture = ExtResource("2_bq1kw")
centered = false
offset = Vector2(-6, -16)
[node name="PointLight2D" type="PointLight2D" parent="."]
color = Color(1, 0.811765, 0.537255, 1)
energy = 1.2
@ -113,3 +126,13 @@ blend_mode = 2
shadow_filter_smooth = 3.0
texture = ExtResource("2_0xpf8")
texture_scale = 0.25
[node name="PointLight2D2" type="PointLight2D" parent="."]
visible = false
color = Color(1, 0.811765, 0.537255, 1)
energy = 1.2
blend_mode = 2
range_item_cull_mask = 8
shadow_filter_smooth = 3.0
texture = ExtResource("2_0xpf8")
texture_scale = 0.25

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=24 format=3 uid="uid://1y5r6sklwgrp"]
[gd_scene load_steps=25 format=3 uid="uid://1y5r6sklwgrp"]
[ext_resource type="Script" path="res://Entities/UnwantedFrequency.cs" id="1_6sbe0"]
[ext_resource type="PackedScene" uid="uid://du5vhccg75nrq" path="res://BoundingBoxes/Hitbox.tscn" id="2_gxtvd"]
@ -10,17 +10,20 @@
[sub_resource type="RectangleShape2D" id="RectangleShape2D_30y8q"]
size = Vector2(8, 8)
[sub_resource type="CanvasItemMaterial" id="CanvasItemMaterial_dhurx"]
light_mode = 1
[sub_resource type="Curve" id="Curve_eu273"]
_data = [Vector2(0.0618557, 0), 0.0, 0.0, 0, 0, Vector2(0.489691, 1), 0.0, 0.0, 0, 0]
point_count = 2
[sub_resource type="Gradient" id="Gradient_dyqhb"]
offsets = PackedFloat32Array(0.00662252, 0.715232, 1)
colors = PackedColorArray(0.996078, 0, 0.164706, 0, 0.996045, 0, 0.166638, 1, 1, 1, 1, 1)
colors = PackedColorArray(0.996078, 0, 0.164706, 0, 1.992, 0, 0.334, 1, 2, 2, 2, 1)
[sub_resource type="Gradient" id="Gradient_m1y6u"]
offsets = PackedFloat32Array(0.00662252, 0.715232, 1)
colors = PackedColorArray(0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1)
colors = PackedColorArray(0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 2, 1)
[sub_resource type="Gradient" id="Gradient_2q0ut"]
offsets = PackedFloat32Array(0.525926, 0.740741, 1)
@ -132,11 +135,14 @@ Knockback = 324.0
shape = SubResource("RectangleShape2D_30y8q")
[node name="TrailRotation" type="Node2D" parent="."]
material = SubResource("CanvasItemMaterial_dhurx")
[node name="TrailPosition" type="Node2D" parent="TrailRotation"]
use_parent_material = true
[node name="Trail" parent="TrailRotation/TrailPosition" instance=ExtResource("3_67uhs")]
self_modulate = Color(2, 2, 2, 1)
use_parent_material = true
width = 2.0
width_curve = SubResource("Curve_eu273")
default_color = Color(1, 0.0862745, 0.207843, 1)
@ -148,9 +154,11 @@ MaximumPoints = 64
Frequency = 30
[node name="TrailPosition2" type="Node2D" parent="TrailRotation"]
use_parent_material = true
[node name="Trail" parent="TrailRotation/TrailPosition2" instance=ExtResource("3_67uhs")]
self_modulate = Color(2, 2, 2, 1)
use_parent_material = true
width = 2.0
width_curve = SubResource("Curve_eu273")
gradient = SubResource("Gradient_m1y6u")

View File

@ -36,6 +36,9 @@ public partial class EventBus : Node
[Signal]
public delegate void PlayerStunEventHandler();
[Signal]
public delegate void PlayerOpenInventoryEventHandler(Items.Inventory inventory);
[Signal]
public delegate void RegisteredBossEventHandler(Characters.Boss boss);

View File

@ -69,6 +69,7 @@ public partial class Inventory : Node2D, IItemCollection<ItemMetadata>
// instantiating a new array will prevent characters from
// sharing inventories
Hotbar = new();
Hotbar.Resize(HotbarCapacity);
}
if (Items is null)
@ -154,6 +155,35 @@ public partial class Inventory : Node2D, IItemCollection<ItemMetadata>
return item;
}
public Item SetHotbarIndexToItem(int index, ItemMetadata metadata)
{
var oldItem = Hotbar[index];
Item newItem = null;
if (IsInstanceValid(oldItem))
{
oldItem?.QueueFree();
}
if (metadata is not null)
{
newItem = metadata.Instance.Instantiate<Item>();
AddChild(newItem);
Hotbar[index] = newItem;
}
if (SelectedIndex == index)
{
// equip item if the hotbar index we are setting is selected
EquipIndex(index);
}
var bus = Events.EventBus.Instance;
bus.EmitSignal(Events.EventBus.SignalName.PlayerInventoryUpdate, this);
return newItem;
}
public Item AddItem(Item item)
{
if (Hotbar.Count >= HotbarCapacity)

View File

@ -1,4 +1,5 @@
using Godot;
using SupaLidlGame.Extensions;
namespace SupaLidlGame.Items.Weapons;
@ -15,7 +16,14 @@ public partial class Bow : ProjectileSpawner
if (_isOnFire)
{
GetNode<AnimatedSprite2D>("%Flame").Visible = false;
var flame = GetNode<AnimatedSprite2D>("%Flame");
var newFlame = flame.Duplicate() as Node2D;
projectile.AddChild(newFlame);
newFlame.Position = Vector2.Zero;
flame.Visible = false;
// TODO: instead of doing 1.5x damage, create an "On Fire" debuff
projectile.Hitbox.Damage *= 1.5f;
_isOnFire = false;
@ -30,8 +38,15 @@ public partial class Bow : ProjectileSpawner
_ignitionArea = GetNode<Area2D>("IgnitionArea");
var onAreaEntered = (Area2D area) =>
{
GetNode<AnimatedSprite2D>("%Flame").Visible = true;
_isOnFire = true;
if (!_isOnFire)
{
var flame = GetNode<AnimatedSprite2D>("%Flame");
flame.Visible = true;
flame.GetNode<AudioStreamPlayer2D>("Ignite")
.OnWorld()
.PlayOneShot();
_isOnFire = true;
}
};
_ignitionArea.Connect(
Area2D.SignalName.AreaEntered,

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=28 format=3 uid="uid://cgg0sfm2qeiwn"]
[gd_scene load_steps=29 format=3 uid="uid://cgg0sfm2qeiwn"]
[ext_resource type="Texture2D" uid="uid://dam6aigkw8xs" path="res://Assets/Sprites/Items/bow-and-arrow.png" id="1_1ghvv"]
[ext_resource type="Script" path="res://Items/Weapons/Bow.cs" id="1_ikgu2"]
@ -12,6 +12,7 @@
[ext_resource type="Texture2D" uid="uid://coarr28adgo1u" path="res://Assets/Sprites/Particles/point-light.png" id="9_tk6lc"]
[ext_resource type="AudioStream" uid="uid://cwy4giq8eod5g" path="res://Assets/Sounds/bow-release.wav" id="9_v051g"]
[ext_resource type="Texture2D" uid="uid://dj1vsctgh1scr" path="res://Assets/Sprites/Misc/flame.png" id="9_xwcvy"]
[ext_resource type="AudioStream" uid="uid://braj74by0oowo" path="res://Assets/Sounds/fire-burst-flash.wav" id="11_65ega"]
[sub_resource type="AtlasTexture" id="AtlasTexture_5af70"]
atlas = ExtResource("9_xwcvy")
@ -94,7 +95,7 @@ tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Vector2(15, -8)]
"values": [Vector2(15, -4)]
}
tracks/2/type = "value"
tracks/2/imported = false
@ -165,7 +166,7 @@ tracks/2/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Vector2(15, -8)]
"values": [Vector2(15, -4)]
}
tracks/3/type = "value"
tracks/3/imported = false
@ -220,7 +221,7 @@ tracks/2/keys = {
"times": PackedFloat32Array(0, 0.1, 0.2, 0.3, 0.4, 0.5),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1),
"update": 1,
"values": [Vector2(15, -8), Vector2(14, -8), Vector2(13, -8), Vector2(12, -8), Vector2(11, -8), Vector2(9, -8)]
"values": [Vector2(15, -4), Vector2(14, -4), Vector2(13, -4), Vector2(12, -4), Vector2(11, -4), Vector2(9, -4)]
}
[sub_resource type="Animation" id="Animation_j5qtq"]
@ -262,7 +263,7 @@ tracks/2/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Vector2(15, -8)]
"values": [Vector2(15, -4)]
}
tracks/3/type = "value"
tracks/3/imported = false
@ -370,15 +371,22 @@ hframes = 8
[node name="Flame" type="AnimatedSprite2D" parent="Anchor"]
unique_name_in_owner = true
visible = false
position = Vector2(15, -8)
modulate = Color(3, 3, 3, 1)
position = Vector2(15, -4)
sprite_frames = SubResource("SpriteFrames_b2khh")
autoplay = "default"
frame_progress = 0.1652
offset = Vector2(0, -4)
[node name="PointLight2D" type="PointLight2D" parent="Anchor/Flame"]
color = Color(1, 0.8, 0.701961, 1)
energy = 0.5
texture = ExtResource("9_tk6lc")
texture_scale = 0.13
[node name="Ignite" type="AudioStreamPlayer2D" parent="Anchor/Flame"]
stream = ExtResource("11_65ega")
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
libraries = {
"": SubResource("AnimationLibrary_5vx8d")

View File

@ -206,6 +206,11 @@ public partial class Sword : Weapon, IParryable
this);
}
}
if (Hitbox.Hits.Count > 0)
{
Character.ApplyImpulse(-Character.Target.Normalized() * Knockback);
}
}
public void AttemptParry(Weapon otherWeapon)

View File

@ -103,6 +103,18 @@ tracks/5/keys = {
"update": 1,
"values": [true]
}
tracks/6/type = "value"
tracks/6/imported = false
tracks/6/enabled = true
tracks/6/path = NodePath("SwingSprite:position")
tracks/6/interp = 1
tracks/6/loop_wrap = true
tracks/6/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Vector2(0, 0)]
}
[sub_resource type="Animation" id="Animation_ameas"]
resource_name = "anticipate"
@ -173,7 +185,7 @@ tracks/0/path = NodePath("Anchor:rotation")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.15, 0.35),
"times": PackedFloat32Array(0, 0.1, 0.35),
"transitions": PackedFloat32Array(1, 1, 1),
"update": 1,
"values": [-1.5708, 1.5708, 1.5708]
@ -209,10 +221,10 @@ tracks/3/path = NodePath("Anchor/Node2D:rotation")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/keys = {
"times": PackedFloat32Array(0, 0.15),
"transitions": PackedFloat32Array(1, 1),
"times": PackedFloat32Array(0.1),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [0.0, 2.35619]
"values": [2.35619]
}
tracks/4/type = "method"
tracks/4/imported = false
@ -235,10 +247,34 @@ tracks/5/path = NodePath("Anchor/Node2D/Sprite2D:visible")
tracks/5/interp = 1
tracks/5/loop_wrap = true
tracks/5/keys = {
"times": PackedFloat32Array(0, 0.35),
"transitions": PackedFloat32Array(1, 1),
"times": PackedFloat32Array(0, 0.1, 0.35),
"transitions": PackedFloat32Array(1, 1, 1),
"update": 1,
"values": [true, false]
"values": [false, true, false]
}
tracks/6/type = "value"
tracks/6/imported = false
tracks/6/enabled = true
tracks/6/path = NodePath("SwingSprite:modulate")
tracks/6/interp = 1
tracks/6/loop_wrap = true
tracks/6/keys = {
"times": PackedFloat32Array(0, 0.2, 0.35),
"transitions": PackedFloat32Array(1, 1, 1),
"update": 0,
"values": [Color(2, 2, 2, 1), Color(2, 2, 2, 1), Color(2, 2, 2, 0)]
}
tracks/7/type = "value"
tracks/7/imported = false
tracks/7/enabled = true
tracks/7/path = NodePath("SwingSprite:position")
tracks/7/interp = 1
tracks/7/loop_wrap = true
tracks/7/keys = {
"times": PackedFloat32Array(0, 0.2, 0.35),
"transitions": PackedFloat32Array(1, 1, 1),
"update": 0,
"values": [Vector2(0, 0), Vector2(0, 0), Vector2(2, 0)]
}
[sub_resource type="Animation" id="Animation_pclfs"]

View File

@ -111,6 +111,7 @@ offset_bottom = -8.0
text = "Activate"
[node name="Sprite2D" type="Sprite2D" parent="."]
position = Vector2(0, -4)
texture = ExtResource("3_pgkt4")
centered = false
offset = Vector2(-2, -8)

View File

@ -10,7 +10,7 @@ physics_layer_1/collision_mask = 0
[sub_resource type="Environment" id="Environment_pxx66"]
background_mode = 3
glow_enabled = true
glow_hdr_threshold = 1.4
glow_hdr_threshold = 1.2
[node name="TileMap" type="Node2D" node_paths=PackedStringArray("Entities", "Areas", "Spawners", "Markers")]
process_mode = 1

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -525,11 +525,11 @@ texture = ExtResource("4_n70qi")
10:2/0 = 0
11:2/0 = 0
0:3/0 = 0
0:3/0/y_sort_origin = 8
0:3/0/y_sort_origin = 12
1:3/0 = 0
1:3/0/y_sort_origin = 8
1:3/0/y_sort_origin = 12
2:3/0 = 0
2:3/0/y_sort_origin = 8
2:3/0/y_sort_origin = 12
3:3/0 = 0
3:3/0/y_sort_origin = 8
3:3/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
@ -544,10 +544,10 @@ texture = ExtResource("4_n70qi")
2:4/0/y_sort_origin = 8
2:4/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
3:4/0 = 0
3:4/0/y_sort_origin = 8
3:4/0/y_sort_origin = 12
3:4/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
4:4/0 = 0
4:4/0/y_sort_origin = 8
4:4/0/y_sort_origin = 12
4:4/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
5:4/0 = 0
5:4/0/y_sort_origin = 8
@ -555,7 +555,6 @@ texture = ExtResource("4_n70qi")
6:4/0 = 0
6:4/0/y_sort_origin = 8
6:4/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
9:4/0 = 0
0:5/0 = 0
0:5/0/y_sort_origin = 8
0:5/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
@ -568,9 +567,9 @@ texture = ExtResource("4_n70qi")
3:5/0 = 0
4:5/0 = 0
5:3/0 = 0
5:3/0/y_sort_origin = 8
5:3/0/y_sort_origin = 12
6:3/0 = 0
6:3/0/y_sort_origin = 8
6:3/0/y_sort_origin = 12
0:6/0 = 0
0:7/0 = 0
1:7/0 = 0
@ -591,7 +590,9 @@ texture = ExtResource("4_n70qi")
12:4/0/texture_origin = Vector2i(0, 16)
12:4/0/y_sort_origin = -2
10:3/0 = 0
10:3/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
11:3/0 = 0
11:3/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
12:2/0 = 0
12:3/0 = 0
13:3/0 = 0
@ -599,6 +600,30 @@ texture = ExtResource("4_n70qi")
12:1/0 = 0
13:1/0 = 0
14:2/0 = 0
8:5/0 = 0
7:5/0 = 0
9:4/size_in_atlas = Vector2i(1, 2)
9:4/0 = 0
9:4/0/texture_origin = Vector2i(0, -8)
10:4/size_in_atlas = Vector2i(1, 2)
10:4/0 = 0
10:4/0/texture_origin = Vector2i(0, -8)
8:4/0 = 0
11:4/0 = 0
14:4/size_in_atlas = Vector2i(1, 3)
14:4/0 = 0
14:4/0/texture_origin = Vector2i(0, 16)
14:4/0/y_sort_origin = 8
14:4/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
3:6/0 = 0
3:7/0 = 0
4:6/0 = 0
7:4/0 = 0
15:4/size_in_atlas = Vector2i(1, 3)
15:4/0 = 0
15:4/0/texture_origin = Vector2i(0, 16)
15:4/0/y_sort_origin = 8
15:4/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
[resource]
occlusion_layer_0/light_mask = 1

View File

@ -23,17 +23,14 @@ public abstract partial class PlayerState : CharacterState
{
if (@event.IsActionPressed("equip_1"))
{
//inventory.SelectedItem = inventory.GetItemByMap("equip_1");
inventory.SelectedIndex = 0;
}
else if (@event.IsActionPressed("equip_2"))
{
//inventory.SelectedItem = inventory.GetItemByMap("equip_2");
inventory.SelectedIndex = 1;
}
else if (@event.IsActionPressed("equip_3"))
{
//inventory.SelectedItem = inventory.GetItemByMap("equip_3");
inventory.SelectedIndex = 2;
}
else if (@event.IsActionPressed("next_item"))
@ -58,6 +55,13 @@ public abstract partial class PlayerState : CharacterState
return MaxLevelState;
}
}
if (@event.IsActionPressed("inventory"))
{
var bus = Events.EventBus.Instance;
bus.EmitSignal(Events.EventBus.SignalName.PlayerOpenInventory,
player.Inventory);
}
}
return base.UnhandledInput(@event);

View File

@ -15,24 +15,39 @@ public partial class DocExitState : NPCState
private double _currentDuration = 0;
private bool _hasPlayedExitAnim = false;
private bool _previouslyCouldAttack = false;
public override NPCState Enter(IState<NPCState> previousState)
{
_currentDuration = Duration;
TelegraphAnimationPlayer.Play("exit_out");
NPC.ShouldMove = false;
_hasPlayedExitAnim = false;
return null;
}
public override void Exit(IState<NPCState> nextState)
{
NPC.CanAttack = _previouslyCouldAttack;
}
public override NPCState Process(double delta)
{
if ((_currentDuration -= delta) <= 0)
if (!NPC.Inventory.IsUsingItem)
{
return TelegraphState;
if (!_hasPlayedExitAnim)
{
_hasPlayedExitAnim = true;
_previouslyCouldAttack = NPC.CanAttack;
NPC.CanAttack = false;
TelegraphAnimationPlayer.Play("exit_out");
}
if ((_currentDuration -= delta) <= 0)
{
return TelegraphState;
}
}
return null;
}

View File

@ -33,8 +33,19 @@ public partial class DocTelegraphState : NPCState
do
{
float randX = GD.RandRange(-112, 112);
float randY = GD.RandRange(-112, 112);
float randX = GD.RandRange(32, 112);
float randY = GD.RandRange(32, 112);
if (GD.Randi() % 2 == 0)
{
randX = -randX;
}
if (GD.Randi() % 2 == 0)
{
randY = -randY;
}
randVec = new Vector2(randX, randY);
}
while (randVec.DistanceSquaredTo(player.GlobalPosition) < 9216);

View File

@ -8,6 +8,9 @@ public partial class RangedIdleState : WeaponState
[Export]
public WeaponState FireState { get; set; }
[Export]
public WeaponState AltFireState { get; set; }
[Export]
public Items.Weapons.Ranged Weapon { get; set; }
@ -30,6 +33,12 @@ public partial class RangedIdleState : WeaponState
return FireState;
}
public override WeaponState UseAlt()
{
GD.Print("Alt fire");
return AltFireState;
}
public override void Exit(IState<WeaponState> nextState)
{
Weapon.Visible = true;

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=14 format=3 uid="uid://c271rdjhd1gfo"]
[gd_scene load_steps=15 format=3 uid="uid://c271rdjhd1gfo"]
[ext_resource type="Script" path="res://UI/UIController.cs" id="2_b4b6l"]
[ext_resource type="PackedScene" uid="uid://bxo553hblp6nf" path="res://UI/HealthBar.tscn" id="3_j1j6h"]
@ -9,6 +9,7 @@
[ext_resource type="PackedScene" uid="uid://d3q1yu3n7cqfj" path="res://UI/SceneTransition.tscn" id="6_j0nhv"]
[ext_resource type="PackedScene" uid="uid://cyggkyqosjk36" path="res://UI/Inventory/ShopMenu.tscn" id="8_ep3ae"]
[ext_resource type="PackedScene" uid="uid://2afbrf8asy2a" path="res://UI/PostProcessing/Vignette.tscn" id="9_p1ubd"]
[ext_resource type="PackedScene" uid="uid://bg51duwdtyl8w" path="res://UI/Inventory/InventoryMenu.tscn" id="10_5m8qa"]
[ext_resource type="PackedScene" uid="uid://b1wsryv4bn0cn" path="res://UI/PostProcessing/StunEffect.tscn" id="10_646ma"]
[ext_resource type="Shader" path="res://Shaders/Grayscale.gdshader" id="11_w4gn1"]
[ext_resource type="Texture2D" uid="uid://bw052v8ikfget" path="res://icon.svg" id="12_tyv35"]
@ -22,11 +23,17 @@ process_mode = 3
[node name="PostProcessing" type="CanvasLayer" parent="."]
[node name="Vignette" parent="PostProcessing" instance=ExtResource("9_p1ubd")]
[node name="CanvasLayer" type="CanvasLayer" parent="PostProcessing"]
[node name="StunEffect" parent="PostProcessing" instance=ExtResource("10_646ma")]
[node name="Vignette" parent="PostProcessing/CanvasLayer" instance=ExtResource("9_p1ubd")]
[node name="Sprite2D" type="TextureRect" parent="PostProcessing"]
[node name="CanvasLayer2" type="CanvasLayer" parent="PostProcessing"]
[node name="StunEffect" parent="PostProcessing/CanvasLayer2" instance=ExtResource("10_646ma")]
[node name="CanvasLayer3" type="CanvasLayer" parent="PostProcessing"]
[node name="Sprite2D" type="TextureRect" parent="PostProcessing/CanvasLayer3"]
visible = false
material = SubResource("ShaderMaterial_kbd61")
anchors_preset = 3
@ -53,6 +60,7 @@ stretch_shrink = 3
disable_3d = true
transparent_bg = true
handle_input_locally = false
snap_2d_transforms_to_pixel = true
size = Vector2i(640, 360)
render_target_update_mode = 4
@ -105,9 +113,8 @@ layout_mode = 2
theme_override_constants/margin_top = 16
theme_override_constants/margin_right = 16
[node name="Hotbar" parent="SubViewportContainer/UIViewport/MainUILayer/Main/Top/Right" node_paths=PackedStringArray("_slots") instance=ExtResource("5_mmp18")]
[node name="Hotbar" parent="SubViewportContainer/UIViewport/MainUILayer/Main/Top/Right" instance=ExtResource("5_mmp18")]
layout_mode = 2
_slots = [NodePath("InventorySlot"), NodePath("InventorySlot2"), NodePath("InventorySlot3")]
[node name="BoxContainer" type="HBoxContainer" parent="SubViewportContainer/UIViewport/MainUILayer/Main"]
layout_mode = 1
@ -120,11 +127,15 @@ grow_horizontal = 0
grow_vertical = 2
alignment = 2
[node name="ShopMenu" parent="SubViewportContainer/UIViewport/MainUILayer/Main/BoxContainer" node_paths=PackedStringArray("_inventoryGrid") instance=ExtResource("8_ep3ae")]
[node name="ShopMenu" parent="SubViewportContainer/UIViewport/MainUILayer/Main/BoxContainer" instance=ExtResource("8_ep3ae")]
unique_name_in_owner = true
visible = false
layout_mode = 2
[node name="InventoryMenu" parent="SubViewportContainer/UIViewport/MainUILayer/Main/BoxContainer" instance=ExtResource("10_5m8qa")]
unique_name_in_owner = true
visible = false
layout_mode = 2
_inventoryGrid = NodePath("PanelContainer/VBoxContainer/ScrollContainer/InventoryGrid")
[node name="Bottom" type="HBoxContainer" parent="SubViewportContainer/UIViewport/MainUILayer/Main"]
layout_mode = 1

View File

@ -0,0 +1,74 @@
using Godot;
namespace SupaLidlGame.UI.Inventory;
public abstract partial class BaseMenu : Control, IModal
{
[Export]
protected InventoryGrid _inventoryGrid;
protected Button _focusButtonOnSelect { get; set; }
protected InventorySlot _selected;
public abstract void ShowModal();
public abstract void HideModal();
public bool IsPlayingAnimation => GetNode<AnimationPlayer>("%AnimationPlayer").IsPlaying();
public async void Close()
{
var animPlayer = GetNode<AnimationPlayer>("%AnimationPlayer");
animPlayer.Play("close");
await ToSignal(animPlayer, AnimationPlayer.SignalName.AnimationFinished);
HideModal();
}
public override void _Ready()
{
var onSlotFocused = (InventorySlot slot) =>
{
if (slot.Item is not null)
{
SetTooltipItem(slot);
}
};
var onSlotUnfocused = (InventorySlot slot) =>
{
SetTooltipItem(_selected);
};
var onSlotSelected = (InventorySlot slot) =>
{
_selected = slot;
SetTooltipItem(slot);
//GetNode<ItemTooltip>("%ActionButton").GrabFocus();
_focusButtonOnSelect.GrabFocus();
};
_inventoryGrid.Connect(InventoryGrid.SignalName.SlotFocused,
Callable.From(onSlotFocused));
_inventoryGrid.Connect(InventoryGrid.SignalName.SlotUnfocused,
Callable.From(onSlotUnfocused));
_inventoryGrid.Connect(InventoryGrid.SignalName.SlotSelected,
Callable.From(onSlotSelected));
}
protected virtual void SetTooltipItem(InventorySlot slot)
{
GetNode<ItemTooltip>("%ItemTooltip").Item = slot?.Item;
}
public abstract void OnButtonPress(Button button);
public override void _UnhandledInput(InputEvent @event)
{
if (@event.IsActionPressed("ui_cancel"))
{
AcceptEvent();
Close();
}
}
}

View File

@ -0,0 +1,206 @@
[gd_scene load_steps=13 format=3 uid="uid://7blvai53i2a0"]
[ext_resource type="Shader" path="res://Shaders/WipeXY.gdshader" id="2_y0ues"]
[ext_resource type="StyleBox" path="res://UI/Themes/Panel.tres" id="3_6elnp"]
[ext_resource type="FontFile" uid="uid://cgwa8bjiyv534" path="res://Assets/Fonts/alagard.ttf" id="4_68gcu"]
[ext_resource type="PackedScene" uid="uid://chmokkxsy5vas" path="res://UI/Inventory/InventoryGrid.tscn" id="5_u7ajr"]
[ext_resource type="PackedScene" uid="uid://baawkwo8aiwbu" path="res://UI/Inventory/ShopSlot.tscn" id="6_onxvb"]
[ext_resource type="PackedScene" uid="uid://bsheehtfcdwhh" path="res://UI/Inventory/ItemTooltip.tscn" id="7_nphc3"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_gm1xk"]
bg_color = Color(0, 0, 0, 0.784314)
border_width_left = 16
border_width_top = 16
border_width_right = 16
border_width_bottom = 16
border_color = Color(0.145098, 0.145098, 0.145098, 0)
border_blend = true
corner_radius_top_left = 16
corner_radius_top_right = 16
corner_radius_bottom_right = 16
corner_radius_bottom_left = 16
[sub_resource type="ShaderMaterial" id="ShaderMaterial_2hdh3"]
shader = ExtResource("2_y0ues")
shader_parameter/x_amount = 1.0
shader_parameter/y_amount = 0.5
[sub_resource type="Animation" id="Animation_yj24f"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:modulate")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Color(1, 1, 1, 1)]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("PanelContainer:material:shader_parameter/y_amount")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [0.5]
}
tracks/2/type = "value"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath("PanelContainer:material:shader_parameter/x_amount")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [1.0]
}
[sub_resource type="Animation" id="Animation_tm2as"]
resource_name = "close"
length = 0.5
step = 0.05
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:modulate")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.4),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [Color(1, 1, 1, 1), Color(1, 1, 1, 0)]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("PanelContainer:material:shader_parameter/y_amount")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0, 0.1),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [0.5, 1.0]
}
tracks/2/type = "value"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath("PanelContainer:material:shader_parameter/x_amount")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0.05, 0.15),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [1.0, 0.5]
}
[sub_resource type="Animation" id="Animation_fgj27"]
resource_name = "open"
length = 0.5
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:modulate")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.3),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [Color(1, 1, 1, 0), Color(1, 1, 1, 1)]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("PanelContainer:material:shader_parameter/y_amount")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0, 0.5),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [1.0, 0.5]
}
tracks/2/type = "value"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath("PanelContainer:material:shader_parameter/x_amount")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0, 0.3),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [0.5, 1.0]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_0glcp"]
_data = {
"RESET": SubResource("Animation_yj24f"),
"close": SubResource("Animation_tm2as"),
"open": SubResource("Animation_fgj27")
}
[node name="Panel" type="PanelContainer"]
anchors_preset = 6
anchor_left = 1.0
anchor_top = 0.5
anchor_right = 1.0
anchor_bottom = 0.5
offset_left = -236.0
offset_top = -175.5
offset_bottom = 175.5
grow_horizontal = 0
grow_vertical = 2
theme_override_styles/panel = SubResource("StyleBoxFlat_gm1xk")
[node name="PanelContainer" type="PanelContainer" parent="."]
material = SubResource("ShaderMaterial_2hdh3")
layout_mode = 2
theme_override_styles/panel = ExtResource("3_6elnp")
[node name="VBoxContainer" type="VBoxContainer" parent="PanelContainer"]
layout_mode = 2
[node name="HBoxContainer" type="HBoxContainer" parent="PanelContainer/VBoxContainer"]
layout_mode = 2
[node name="Label" type="Label" parent="PanelContainer/VBoxContainer/HBoxContainer"]
layout_mode = 2
theme_override_fonts/font = ExtResource("4_68gcu")
text = "Snus Dealer"
[node name="ScrollContainer" type="ScrollContainer" parent="PanelContainer/VBoxContainer"]
layout_mode = 2
size_flags_vertical = 3
follow_focus = true
horizontal_scroll_mode = 0
[node name="InventoryGrid" parent="PanelContainer/VBoxContainer/ScrollContainer" instance=ExtResource("5_u7ajr")]
layout_mode = 2
size_flags_vertical = 3
_slotScene = ExtResource("6_onxvb")
[node name="ItemTooltip" parent="PanelContainer/VBoxContainer" instance=ExtResource("7_nphc3")]
unique_name_in_owner = true
layout_mode = 2
[node name="HBoxContainer2" type="HBoxContainer" parent="PanelContainer/VBoxContainer"]
layout_mode = 2
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
unique_name_in_owner = true
libraries = {
"": SubResource("AnimationLibrary_0glcp")
}

View File

@ -1,10 +1,8 @@
[gd_scene load_steps=4 format=3 uid="uid://sfs8dpfitpdu"]
[gd_scene load_steps=3 format=3 uid="uid://sfs8dpfitpdu"]
[ext_resource type="Script" path="res://UI/Inventory/Hotbar.cs" id="1_2sak2"]
[ext_resource type="PackedScene" uid="uid://dmvu2hjyrwc1y" path="res://UI/Inventory/HotbarSlot.tscn" id="2_3axfe"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_6jbma"]
[node name="Hotbar" type="GridContainer" node_paths=PackedStringArray("_slots")]
anchors_preset = 1
anchor_left = 1.0
@ -19,12 +17,9 @@ _slots = [NodePath("InventorySlot"), NodePath("InventorySlot2"), NodePath("Inven
[node name="InventorySlot" parent="." instance=ExtResource("2_3axfe")]
layout_mode = 2
theme_override_styles/panel = SubResource("StyleBoxEmpty_6jbma")
[node name="InventorySlot2" parent="." instance=ExtResource("2_3axfe")]
layout_mode = 2
theme_override_styles/panel = SubResource("StyleBoxEmpty_6jbma")
[node name="InventorySlot3" parent="." instance=ExtResource("2_3axfe")]
layout_mode = 2
theme_override_styles/panel = SubResource("StyleBoxEmpty_6jbma")

View File

@ -6,14 +6,14 @@ namespace SupaLidlGame.UI.Inventory;
public partial class InventoryGrid : GridContainer
{
private SupaLidlGame.Items.IItemCollection _source;
private Items.IItemCollection _source;
[Export]
private PackedScene _slotScene;
public ButtonGroup ButtonGroup { get; private set; }
public SupaLidlGame.Items.IItemCollection Source
public Items.IItemCollection Source
{
get => _source;
set

View File

@ -0,0 +1,81 @@
using Godot;
using System.Collections.Generic;
namespace SupaLidlGame.UI.Inventory;
public partial class InventoryMenu : BaseMenu, IModal
{
private Items.Inventory _source;
public Items.Inventory Source
{
get => _source;
set
{
_source = value;
_inventoryGrid.Source = value;
}
}
public override void ShowModal()
{
Show();
var animPlayer = GetNode<AnimationPlayer>("%AnimationPlayer");
animPlayer.Play("open");
}
public override void HideModal()
{
Hide();
_source = null;
}
public override void _Ready()
{
base._Ready();
_focusButtonOnSelect = GetNode<Button>("%SlotButton1");
foreach (Node node in GetTree().GetNodesInGroup("SlotButtons"))
{
var button = node as Button;
var onButtonPress = () =>
{
OnButtonPress(button);
};
var onButtonInput = (InputEvent @event) =>
{
if (@event.IsActionPressed("ui_cancel"))
{
GetViewport().SetInputAsHandled();
_selected?.GrabFocus();
}
};
button.Connect(Button.SignalName.Pressed, Callable.From(onButtonPress));
}
}
protected override void SetTooltipItem(InventorySlot slot)
{
base.SetTooltipItem(slot);
if (slot == _selected)
{
GetTree().SetGroup("SlotButtons", "disabled", false);
}
else
{
GetTree().SetGroup("SlotButtons", "disabled", true);
}
}
public override void OnButtonPress(Button button)
{
int slot = button.GetMeta("slot").AsInt32();
GD.Print("Equipping item at slot " + slot);
Source.SetHotbarIndexToItem(slot, _selected.Item);
}
}

View File

@ -0,0 +1,38 @@
[gd_scene load_steps=4 format=3 uid="uid://bg51duwdtyl8w"]
[ext_resource type="PackedScene" uid="uid://7blvai53i2a0" path="res://UI/Inventory/BaseMenu.tscn" id="1_55ohh"]
[ext_resource type="Script" path="res://UI/Inventory/InventoryMenu.cs" id="2_25pbk"]
[ext_resource type="Theme" uid="uid://cksjbu3vrup5" path="res://UI/Themes/supalidl.tres" id="2_jvsju"]
[node name="Panel" node_paths=PackedStringArray("_inventoryGrid") instance=ExtResource("1_55ohh")]
script = ExtResource("2_25pbk")
_inventoryGrid = NodePath("PanelContainer/VBoxContainer/ScrollContainer/InventoryGrid")
[node name="HBoxContainer" parent="PanelContainer/VBoxContainer" index="0"]
visible = false
[node name="SlotButton1" type="Button" parent="PanelContainer/VBoxContainer/HBoxContainer2" index="0" groups=["SlotButtons"]]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
theme = ExtResource("2_jvsju")
text = "Slot 1"
metadata/slot = 0
[node name="SlotButton2" type="Button" parent="PanelContainer/VBoxContainer/HBoxContainer2" index="1" groups=["SlotButtons"]]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
theme = ExtResource("2_jvsju")
text = "Slot 2
"
metadata/slot = 1
[node name="SlotButton3" type="Button" parent="PanelContainer/VBoxContainer/HBoxContainer2" index="2" groups=["SlotButtons"]]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
theme = ExtResource("2_jvsju")
text = "Slot 3
"
metadata/slot = 2

View File

@ -5,6 +5,9 @@ namespace SupaLidlGame.UI.Inventory;
public partial class ItemTooltip : Control
{
[Export]
public Button ActionButton { get; set; }
private ItemMetadata _item;
public ItemMetadata Item

View File

@ -3,7 +3,7 @@ using System.Collections.Generic;
namespace SupaLidlGame.UI.Inventory;
public partial class ShopMenu : Control, IModal
public partial class ShopMenu : BaseMenu, IModal
{
private Items.IItemCollection<Items.ShopEntry> _source;
@ -17,53 +17,24 @@ public partial class ShopMenu : Control, IModal
}
}
[Export]
private InventoryGrid _inventoryGrid;
private InventorySlot _selected;
public void ShowModal()
public override void ShowModal()
{
Show();
var animPlayer = GetNode<AnimationPlayer>("%AnimationPlayer");
animPlayer.Play("open");
}
public void HideModal()
public override void HideModal()
{
Hide();
_source = null;
}
public async void Close()
{
var animPlayer = GetNode<AnimationPlayer>("%AnimationPlayer");
animPlayer.Play("close");
await ToSignal(animPlayer, AnimationPlayer.SignalName.AnimationFinished);
HideModal();
}
public override void _Ready()
{
_inventoryGrid.SlotFocused += (InventorySlot slot) =>
{
if (slot.Item is not null)
{
SetTooltipItem(slot);
}
};
base._Ready();
_inventoryGrid.SlotUnfocused += (InventorySlot slot) =>
{
SetTooltipItem(_selected);
};
_inventoryGrid.SlotSelected += (InventorySlot slot) =>
{
_selected = slot;
SetTooltipItem(slot);
GetNode<Button>("%BuyButton").GrabFocus();
};
_focusButtonOnSelect = GetNode<Button>("%BuyButton");
GetNode<Button>("%BuyButton").GuiInput += (InputEvent @event) =>
{
@ -75,9 +46,9 @@ public partial class ShopMenu : Control, IModal
};
}
private void SetTooltipItem(InventorySlot slot)
protected override void SetTooltipItem(InventorySlot slot)
{
GetNode<ItemTooltip>("%ItemTooltip").Item = slot?.Item;
base.SetTooltipItem(slot);
if (slot == _selected)
{
@ -89,6 +60,11 @@ public partial class ShopMenu : Control, IModal
}
}
public override void OnButtonPress(Button button)
{
throw new System.NotImplementedException("Not yet implemented.");
}
public override void _UnhandledInput(InputEvent @event)
{
if (@event.IsActionPressed("ui_cancel"))

View File

@ -1,6 +1,6 @@
[gd_scene load_steps=15 format=3 uid="uid://cyggkyqosjk36"]
[ext_resource type="StyleBox" path="res://UI/Themes/Panel.tres" id="1_2ffty"]
[ext_resource type="StyleBox" uid="uid://bqhotx2ogucye" path="res://UI/Themes/Panel.tres" id="1_2ffty"]
[ext_resource type="Script" path="res://UI/Inventory/ShopMenu.cs" id="1_8c1y7"]
[ext_resource type="Shader" path="res://Shaders/WipeXY.gdshader" id="2_jqery"]
[ext_resource type="FontFile" uid="uid://cgwa8bjiyv534" path="res://Assets/Fonts/alagard.ttf" id="3_aj4jx"]

View File

@ -1,11 +1,11 @@
[gd_resource type="Theme" load_steps=11 format=3 uid="uid://cksjbu3vrup5"]
[ext_resource type="FontFile" uid="uid://6bvgjbmqovau" path="res://Assets/Fonts/calamity/calamity.ttf" id="1_334fe"]
[ext_resource type="StyleBox" path="res://UI/Themes/InventorySlotButtonFocus.tres" id="2_3w5h1"]
[ext_resource type="StyleBox" uid="uid://nvb4etac7ee2" path="res://UI/Themes/InventorySlotButtonFocus.tres" id="2_3w5h1"]
[ext_resource type="Texture2D" uid="uid://b16461tjso0j7" path="res://Assets/Sprites/UI/hotbar-inactive.png" id="2_6sv27"]
[ext_resource type="StyleBox" path="res://UI/Themes/Panel.tres" id="2_jlgx8"]
[ext_resource type="StyleBox" path="res://UI/Themes/InventorySlotButtonNormal.tres" id="3_nuiio"]
[ext_resource type="StyleBox" path="res://UI/Themes/InventorySlotButtonPressed.tres" id="4_mllnb"]
[ext_resource type="StyleBox" uid="uid://bqhotx2ogucye" path="res://UI/Themes/Panel.tres" id="2_jlgx8"]
[ext_resource type="StyleBox" uid="uid://cfqp0ycwvwx7c" path="res://UI/Themes/InventorySlotButtonNormal.tres" id="3_nuiio"]
[ext_resource type="StyleBox" uid="uid://pqtn0115bqtp" path="res://UI/Themes/InventorySlotButtonPressed.tres" id="4_mllnb"]
[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_wk5ww"]
content_margin_left = 4.0

View File

@ -22,5 +22,23 @@ public partial class UIController : Control
shopMenu.Source = shop;
shopMenu.ShowModal();
};
Events.EventBus.Instance.PlayerOpenInventory += (Items.Inventory inventory) =>
{
var inventoryMenu = GetNode<Inventory.InventoryMenu>("%InventoryMenu");
if (!inventoryMenu.IsPlayingAnimation)
{
inventoryMenu.Source = inventory;
if (inventoryMenu.Visible)
{
inventoryMenu.Close();
}
else
{
inventoryMenu.ShowModal();
}
}
};
}
}

View File

@ -61,6 +61,14 @@ ui_accept={
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":0,"pressure":0.0,"pressed":false,"script":null)
]
}
ui_focus_next={
"deadzone": 0.5,
"events": []
}
ui_focus_prev={
"deadzone": 0.5,
"events": []
}
ui_left={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194319,"physical_keycode":0,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
@ -198,6 +206,12 @@ cast={
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":67,"key_label":0,"unicode":99,"location":0,"echo":false,"script":null)
]
}
inventory={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194306,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":4,"pressure":0.0,"pressed":true,"script":null)
]
}
[internationalization]