More work on combat

This commit is contained in:
2025-10-09 14:52:47 -04:00
parent 7563e99059
commit 9a216d3285
44 changed files with 547 additions and 103 deletions

View File

@@ -73,6 +73,7 @@ class Event:
enemy_list.append(enemy_types[enemy_name].instantiate())
quest.questview.set_questor_animation("idle")
for enemy in enemy_list:
enemy.flip_h()
quest.questview.pause_setting()
quest.questview.place_enemy(enemy, true)
quest.questview.set_enemy_animation(enemy, "idle")
@@ -82,10 +83,12 @@ class Event:
participants = []
participants.append_array(adventurers)
participants.append_array(enemies)
time = 1.25
time_elapsed = 0
var c_order : Array = []
var dex_speed = 0
for p in participants:
p.show_lifebar(true)
c_order.append([p, p.stats.DEX])
if p.stats.DEX > dex_speed:
dex_speed = p.stats.DEX
@@ -150,7 +153,8 @@ class Event:
for p : QuestorSprite in participants:
p.check_levelup()
#TODO: Notify player if level up occurs
time = 5
time = 3
time_elapsed = 0
func defeat():
print("Questor lost!")
@@ -194,12 +198,21 @@ class Event:
return lst
func resolve_combat() -> void:
for p in participants:
p.show_lifebar(false)
pass
func process(delta : float) -> void:
#TODO: Make quest combat work
match(type):
Type.COMBAT:
if time != 0:
time_elapsed += delta
if time_elapsed >= time:
time = 0
time_elapsed = 0
else:
return
match(combat_state):
CombatState.FIGHTING:
if len(busy_list) < 1:
@@ -214,8 +227,7 @@ class Event:
else:
resolve_combat()
CombatState.VICTORY:
time_elapsed += delta
if time_elapsed >= time:
resolve_combat()
complete = true
completed.emit()
Type.WAIT:

View File

@@ -3,15 +3,15 @@
importer="texture"
type="CompressedTexture2D"
uid="uid://crrd8mpcuync2"
path="res://.godot/imported/body.png-5a897720f599ec630383f1f3dd8e9e9e.ctex"
path="res://.godot/imported/body.png-efd5e53b6f03adc4a57de5ce8dc4d3cd.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://external/Test Portrait/Farmer_F/body.png"
dest_files=["res://.godot/imported/body.png-5a897720f599ec630383f1f3dd8e9e9e.ctex"]
source_file="res://external/test portrait/farmer_f/body.png"
dest_files=["res://.godot/imported/body.png-efd5e53b6f03adc4a57de5ce8dc4d3cd.ctex"]
[params]

View File

@@ -3,15 +3,15 @@
importer="texture"
type="CompressedTexture2D"
uid="uid://pp5ssn5m2n3i"
path="res://.godot/imported/brow_shadow-1.png-94d923d93f9bc0db18f7b963da1021dd.ctex"
path="res://.godot/imported/brow_shadow-1.png-8dff8c187d59ecaaefbb84e877b32e20.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://external/Test Portrait/Farmer_F/brow_shadow-1.png"
dest_files=["res://.godot/imported/brow_shadow-1.png-94d923d93f9bc0db18f7b963da1021dd.ctex"]
source_file="res://external/test portrait/farmer_f/brow_shadow-1.png"
dest_files=["res://.godot/imported/brow_shadow-1.png-8dff8c187d59ecaaefbb84e877b32e20.ctex"]
[params]

View File

@@ -3,15 +3,15 @@
importer="texture"
type="CompressedTexture2D"
uid="uid://x4e86o28672u"
path="res://.godot/imported/brow_shadow-2.png-85a8d07465b9b109e67ad99a37d690d1.ctex"
path="res://.godot/imported/brow_shadow-2.png-b5d8d416acf1ddb95fd785200da8d3ce.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://external/Test Portrait/Farmer_F/brow_shadow-2.png"
dest_files=["res://.godot/imported/brow_shadow-2.png-85a8d07465b9b109e67ad99a37d690d1.ctex"]
source_file="res://external/test portrait/farmer_f/brow_shadow-2.png"
dest_files=["res://.godot/imported/brow_shadow-2.png-b5d8d416acf1ddb95fd785200da8d3ce.ctex"]
[params]

View File

@@ -3,15 +3,15 @@
importer="texture"
type="CompressedTexture2D"
uid="uid://sv7bxo8a12i6"
path="res://.godot/imported/brow_shadow.png-e4497bbbff21d0b56dc81b07de4f06bc.ctex"
path="res://.godot/imported/brow_shadow.png-f653be07b461bc5d7a18192996ffb73a.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://external/Test Portrait/Farmer_F/brow_shadow.png"
dest_files=["res://.godot/imported/brow_shadow.png-e4497bbbff21d0b56dc81b07de4f06bc.ctex"]
source_file="res://external/test portrait/farmer_f/brow_shadow.png"
dest_files=["res://.godot/imported/brow_shadow.png-f653be07b461bc5d7a18192996ffb73a.ctex"]
[params]

View File

@@ -3,15 +3,15 @@
importer="texture"
type="CompressedTexture2D"
uid="uid://tpg08bgn2on7"
path="res://.godot/imported/brows-1.png-70092c4bb56529f3cdeb7b51925eb071.ctex"
path="res://.godot/imported/brows-1.png-86a51529282fffa26d497e35e4cc9367.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://external/Test Portrait/Farmer_F/brows-1.png"
dest_files=["res://.godot/imported/brows-1.png-70092c4bb56529f3cdeb7b51925eb071.ctex"]
source_file="res://external/test portrait/farmer_f/brows-1.png"
dest_files=["res://.godot/imported/brows-1.png-86a51529282fffa26d497e35e4cc9367.ctex"]
[params]

View File

@@ -3,15 +3,15 @@
importer="texture"
type="CompressedTexture2D"
uid="uid://brmta1rtiau4a"
path="res://.godot/imported/brows-2.png-227c9708d0b7fde57b1ef42021508fcf.ctex"
path="res://.godot/imported/brows-2.png-01beea1c4e9cadf04c529dc849682c8a.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://external/Test Portrait/Farmer_F/brows-2.png"
dest_files=["res://.godot/imported/brows-2.png-227c9708d0b7fde57b1ef42021508fcf.ctex"]
source_file="res://external/test portrait/farmer_f/brows-2.png"
dest_files=["res://.godot/imported/brows-2.png-01beea1c4e9cadf04c529dc849682c8a.ctex"]
[params]

View File

@@ -3,15 +3,15 @@
importer="texture"
type="CompressedTexture2D"
uid="uid://c3wwe6r000gpq"
path="res://.godot/imported/composite.png-b2c2e474fe243b72bd3471af031774d6.ctex"
path="res://.godot/imported/composite.png-a68e5c4a777094ce447b89a2ab45b35b.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://external/Test Portrait/Farmer_F/composite.png"
dest_files=["res://.godot/imported/composite.png-b2c2e474fe243b72bd3471af031774d6.ctex"]
source_file="res://external/test portrait/farmer_f/composite.png"
dest_files=["res://.godot/imported/composite.png-a68e5c4a777094ce447b89a2ab45b35b.ctex"]
[params]

View File

@@ -3,15 +3,15 @@
importer="texture"
type="CompressedTexture2D"
uid="uid://caow8dqiog7j4"
path="res://.godot/imported/ear.png-a1b457892f7236464123f2229af36695.ctex"
path="res://.godot/imported/ear.png-74df11e092bb05fcc54c7e7478ed4d95.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://external/Test Portrait/Farmer_F/ear.png"
dest_files=["res://.godot/imported/ear.png-a1b457892f7236464123f2229af36695.ctex"]
source_file="res://external/test portrait/farmer_f/ear.png"
dest_files=["res://.godot/imported/ear.png-74df11e092bb05fcc54c7e7478ed4d95.ctex"]
[params]

View File

@@ -3,15 +3,15 @@
importer="texture"
type="CompressedTexture2D"
uid="uid://csp7xbtu0tpn7"
path="res://.godot/imported/eye-white-1.png-fb75b817d294c00ebeee3e6996a2c02e.ctex"
path="res://.godot/imported/eye-white-1.png-a31a2b044ab6206c129b0739fd4c0c80.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://external/Test Portrait/Farmer_F/eye-white-1.png"
dest_files=["res://.godot/imported/eye-white-1.png-fb75b817d294c00ebeee3e6996a2c02e.ctex"]
source_file="res://external/test portrait/farmer_f/eye-white-1.png"
dest_files=["res://.godot/imported/eye-white-1.png-a31a2b044ab6206c129b0739fd4c0c80.ctex"]
[params]

View File

@@ -3,15 +3,15 @@
importer="texture"
type="CompressedTexture2D"
uid="uid://mygmunn3voie"
path="res://.godot/imported/eyes-iris-1.png-3c96067ab402ea99f8e1b1b7db594f4c.ctex"
path="res://.godot/imported/eyes-iris-1.png-d2077e2e658acf3840075cfe98f86f4e.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://external/Test Portrait/Farmer_F/eyes-iris-1.png"
dest_files=["res://.godot/imported/eyes-iris-1.png-3c96067ab402ea99f8e1b1b7db594f4c.ctex"]
source_file="res://external/test portrait/farmer_f/eyes-iris-1.png"
dest_files=["res://.godot/imported/eyes-iris-1.png-d2077e2e658acf3840075cfe98f86f4e.ctex"]
[params]

View File

@@ -3,15 +3,15 @@
importer="texture"
type="CompressedTexture2D"
uid="uid://wnkr20dtf734"
path="res://.godot/imported/eyes-lashes-1.png-8a4535f7647af11ff99b165ee021e8cc.ctex"
path="res://.godot/imported/eyes-lashes-1.png-1460ddc60d7a087da2d517ce8f1a5faa.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://external/Test Portrait/Farmer_F/eyes-lashes-1.png"
dest_files=["res://.godot/imported/eyes-lashes-1.png-8a4535f7647af11ff99b165ee021e8cc.ctex"]
source_file="res://external/test portrait/farmer_f/eyes-lashes-1.png"
dest_files=["res://.godot/imported/eyes-lashes-1.png-1460ddc60d7a087da2d517ce8f1a5faa.ctex"]
[params]

View File

@@ -3,15 +3,15 @@
importer="texture"
type="CompressedTexture2D"
uid="uid://dd063tm4qo5nc"
path="res://.godot/imported/eyes.png-1384a95ac331738bfe48af30a8953f10.ctex"
path="res://.godot/imported/eyes.png-da6eb5fdf7f113844fe8e5414a1f2331.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://external/Test Portrait/Farmer_F/eyes.png"
dest_files=["res://.godot/imported/eyes.png-1384a95ac331738bfe48af30a8953f10.ctex"]
source_file="res://external/test portrait/farmer_f/eyes.png"
dest_files=["res://.godot/imported/eyes.png-da6eb5fdf7f113844fe8e5414a1f2331.ctex"]
[params]

View File

@@ -3,15 +3,15 @@
importer="texture"
type="CompressedTexture2D"
uid="uid://li44lgsa0ky"
path="res://.godot/imported/eyes_shadow.png-639516c9b7d6a71a22fcd4597236a89e.ctex"
path="res://.godot/imported/eyes_shadow.png-c0450e5470a67b3e212b544dfeadc885.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://external/Test Portrait/Farmer_F/eyes_shadow.png"
dest_files=["res://.godot/imported/eyes_shadow.png-639516c9b7d6a71a22fcd4597236a89e.ctex"]
source_file="res://external/test portrait/farmer_f/eyes_shadow.png"
dest_files=["res://.godot/imported/eyes_shadow.png-c0450e5470a67b3e212b544dfeadc885.ctex"]
[params]

View File

@@ -3,15 +3,15 @@
importer="texture"
type="CompressedTexture2D"
uid="uid://can8npg0ufr3f"
path="res://.godot/imported/hair_bg.png-07f942d8008a0d2581909922002bbbe2.ctex"
path="res://.godot/imported/hair_bg.png-71bd584ff51ea6c704ba2eb2b8124703.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://external/Test Portrait/Farmer_F/hair_bg.png"
dest_files=["res://.godot/imported/hair_bg.png-07f942d8008a0d2581909922002bbbe2.ctex"]
source_file="res://external/test portrait/farmer_f/hair_bg.png"
dest_files=["res://.godot/imported/hair_bg.png-71bd584ff51ea6c704ba2eb2b8124703.ctex"]
[params]

View File

@@ -3,15 +3,15 @@
importer="texture"
type="CompressedTexture2D"
uid="uid://vt17lekvchdg"
path="res://.godot/imported/hair_fg.png-9f5c6bb27fb0349d9ddfba99f87aa5c6.ctex"
path="res://.godot/imported/hair_fg.png-9dfae38fbf9812dad9b45d15a1cbd791.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://external/Test Portrait/Farmer_F/hair_fg.png"
dest_files=["res://.godot/imported/hair_fg.png-9f5c6bb27fb0349d9ddfba99f87aa5c6.ctex"]
source_file="res://external/test portrait/farmer_f/hair_fg.png"
dest_files=["res://.godot/imported/hair_fg.png-9dfae38fbf9812dad9b45d15a1cbd791.ctex"]
[params]

View File

@@ -3,15 +3,15 @@
importer="texture"
type="CompressedTexture2D"
uid="uid://cru775pghpate"
path="res://.godot/imported/hair_fg_shadow.png-41de10e26ae2147aace92ba197b28075.ctex"
path="res://.godot/imported/hair_fg_shadow.png-609d7f961008e48f548f0e05277dafb4.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://external/Test Portrait/Farmer_F/hair_fg_shadow.png"
dest_files=["res://.godot/imported/hair_fg_shadow.png-41de10e26ae2147aace92ba197b28075.ctex"]
source_file="res://external/test portrait/farmer_f/hair_fg_shadow.png"
dest_files=["res://.godot/imported/hair_fg_shadow.png-609d7f961008e48f548f0e05277dafb4.ctex"]
[params]

View File

@@ -3,15 +3,15 @@
importer="texture"
type="CompressedTexture2D"
uid="uid://dj6fagfp2sbrx"
path="res://.godot/imported/hat-bg.png-00e20fcd79ddb550d12459624be7d9b1.ctex"
path="res://.godot/imported/hat-bg.png-972a86d8449c11d1a72a4f21b15efd0a.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://external/Test Portrait/Farmer_F/hat-bg.png"
dest_files=["res://.godot/imported/hat-bg.png-00e20fcd79ddb550d12459624be7d9b1.ctex"]
source_file="res://external/test portrait/farmer_f/hat-bg.png"
dest_files=["res://.godot/imported/hat-bg.png-972a86d8449c11d1a72a4f21b15efd0a.ctex"]
[params]

View File

@@ -3,15 +3,15 @@
importer="texture"
type="CompressedTexture2D"
uid="uid://b303qa76o5r1m"
path="res://.godot/imported/hat.png-9bb6fa9d1f7f7503ee26b1749cdf7c0a.ctex"
path="res://.godot/imported/hat.png-21e48868d0218210b390afa680a1202d.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://external/Test Portrait/Farmer_F/hat.png"
dest_files=["res://.godot/imported/hat.png-9bb6fa9d1f7f7503ee26b1749cdf7c0a.ctex"]
source_file="res://external/test portrait/farmer_f/hat.png"
dest_files=["res://.godot/imported/hat.png-21e48868d0218210b390afa680a1202d.ctex"]
[params]

View File

@@ -3,15 +3,15 @@
importer="texture"
type="CompressedTexture2D"
uid="uid://dyeu4kwwnxjn5"
path="res://.godot/imported/hat_fg.png-e2cae14f649780ea2aba38b34358b587.ctex"
path="res://.godot/imported/hat_fg.png-2dddd61ae84da22b32d123d3533338c5.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://external/Test Portrait/Farmer_F/hat_fg.png"
dest_files=["res://.godot/imported/hat_fg.png-e2cae14f649780ea2aba38b34358b587.ctex"]
source_file="res://external/test portrait/farmer_f/hat_fg.png"
dest_files=["res://.godot/imported/hat_fg.png-2dddd61ae84da22b32d123d3533338c5.ctex"]
[params]

View File

@@ -3,15 +3,15 @@
importer="texture"
type="CompressedTexture2D"
uid="uid://dbdjaye6srxhx"
path="res://.godot/imported/head.png-df46fa0b8e2741bbf0fad9b3a03fedea.ctex"
path="res://.godot/imported/head.png-47039f8abc285b87bb176b5b43ee9a5f.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://external/Test Portrait/Farmer_F/head.png"
dest_files=["res://.godot/imported/head.png-df46fa0b8e2741bbf0fad9b3a03fedea.ctex"]
source_file="res://external/test portrait/farmer_f/head.png"
dest_files=["res://.godot/imported/head.png-47039f8abc285b87bb176b5b43ee9a5f.ctex"]
[params]

View File

@@ -3,15 +3,15 @@
importer="texture"
type="CompressedTexture2D"
uid="uid://dy01kbn6oq774"
path="res://.godot/imported/Penny.png-389d42de4b6272cc7190b03341f8ba23.ctex"
path="res://.godot/imported/Penny.png-eed612fd907e6c9792369a6b6c727880.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://external/Test Portrait/Penny.png"
dest_files=["res://.godot/imported/Penny.png-389d42de4b6272cc7190b03341f8ba23.ctex"]
source_file="res://external/test portrait/Penny.png"
dest_files=["res://.godot/imported/Penny.png-eed612fd907e6c9792369a6b6c727880.ctex"]
[params]

View File

@@ -3,15 +3,15 @@
importer="texture"
type="CompressedTexture2D"
uid="uid://cygn0xfsayykd"
path="res://.godot/imported/eye-a.png-734a4fd0bcb4bbf98a974b4b70824d99.ctex"
path="res://.godot/imported/eye-a.png-4ae928c135fabbb6dbe591d1f658a054.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://external/Test Portrait/player/eye-a.png"
dest_files=["res://.godot/imported/eye-a.png-734a4fd0bcb4bbf98a974b4b70824d99.ctex"]
source_file="res://external/test portrait/player/eye-a.png"
dest_files=["res://.godot/imported/eye-a.png-4ae928c135fabbb6dbe591d1f658a054.ctex"]
[params]

View File

@@ -3,15 +3,15 @@
importer="texture"
type="CompressedTexture2D"
uid="uid://bg6lac6nl5k84"
path="res://.godot/imported/eye-b.png-14ca96eb629f87ea602431771407786a.ctex"
path="res://.godot/imported/eye-b.png-8a340a04655f91a439de6b55293f607d.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://external/Test Portrait/player/eye-b.png"
dest_files=["res://.godot/imported/eye-b.png-14ca96eb629f87ea602431771407786a.ctex"]
source_file="res://external/test portrait/player/eye-b.png"
dest_files=["res://.godot/imported/eye-b.png-8a340a04655f91a439de6b55293f607d.ctex"]
[params]

View File

@@ -3,15 +3,15 @@
importer="texture"
type="CompressedTexture2D"
uid="uid://bxdclvopvj75q"
path="res://.godot/imported/eye-c.png-4530d56f6c9ba13b8148544326f1dcc2.ctex"
path="res://.godot/imported/eye-c.png-b34d6d5c940d727416bc135e5e88a9ca.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://external/Test Portrait/player/eye-c.png"
dest_files=["res://.godot/imported/eye-c.png-4530d56f6c9ba13b8148544326f1dcc2.ctex"]
source_file="res://external/test portrait/player/eye-c.png"
dest_files=["res://.godot/imported/eye-c.png-b34d6d5c940d727416bc135e5e88a9ca.ctex"]
[params]

BIN
external/goo.ase vendored Normal file

Binary file not shown.

BIN
external/pitchfork.ase vendored Normal file

Binary file not shown.

BIN
external/test-qsvchar2.gif vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

BIN
external/testchar.ase vendored Normal file

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

View File

@@ -0,0 +1,40 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://cf31h0xgcc2yi"
path="res://.godot/imported/goo shadow.png-057ddb147ff0a4a9e5096bf2180bbfe3.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://graphics/questview/goo shadow.png"
dest_files=["res://.godot/imported/goo shadow.png-057ddb147ff0a4a9e5096bf2180bbfe3.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
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/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
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.

After

Width:  |  Height:  |  Size: 19 KiB

View File

@@ -0,0 +1,40 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bmkpn7sex6buo"
path="res://.godot/imported/goo-sheet.png-3413534c7125baa65560b5c4b71379b2.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://graphics/questview/goo-sheet.png"
dest_files=["res://.godot/imported/goo-sheet.png-3413534c7125baa65560b5c4b71379b2.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
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/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
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.

Before

Width:  |  Height:  |  Size: 54 KiB

After

Width:  |  Height:  |  Size: 101 KiB

View File

@@ -1,5 +1,7 @@
extends Sprite2D
@onready var label : Label = $Label
func _ready():
var move_tween = create_tween()
move_tween.tween_property(self, "position:y", -40, 1.25)
@@ -10,3 +12,6 @@ func _ready():
fade_tween.tween_property(self, "modulate:a", 0, .25)
fade_tween.tween_callback(queue_free)
func set_label(string : String) -> void:
if label != null:
label.text = string

View File

@@ -1,32 +1,47 @@
class_name QuestSprite extends Control
@onready var damage_banner_template = preload("res://templates/damage_banner.tscn")
@onready var lifebar : TextureProgressBar = $LifeBar
var life : int = 1
var max_life : int = 1
var energy : int = 1
var max_energy : int = 1
@export var life : int = 1
@export var max_life : int = 1
@export var energy : int = 1
@export var max_energy : int = 1
var level : int = 1
var exp : int = 0
@export var exp : int = 0
var reset_position : Vector2
var melee_range : float = 100
var highlight_color : Color = Color(1,1,1,0)
var knockback_tween : Tween
@export var stats : StatBlock
var gold : int = 0
@onready var anim_player : AnimationPlayer = $AnimationPlayer
@onready var sprite_material : ShaderMaterial = $Sprite.material
@onready var banner_offset : Node2D = $BannerOffset
signal hitting()
signal died(killer :QuestSprite)
signal action_complete(requeue : bool)
signal busy()
signal arrived()
func _ready() -> void:
lifebar.value = life
lifebar.max_value = max_life
lifebar.visible = false
func _process(delta: float) -> void:
sprite_material.set_shader_parameter("highlight", highlight_color)
func position_reset() -> void:
var tween = create_tween()
#TODO: Vary movement animations?
tween.tween_callback(anim_player.play.bind("running"))
tween.tween_property(self, "position", reset_position,.75)
tween.tween_property(self, "position", reset_position,.5)
if reset_position.x < position.x:
$Sprite.flip_h = true
tween.tween_property($Sprite, "flip_h", false, 0)
@@ -41,7 +56,7 @@ func approach(target, offset) -> void:
#TODO: Vary movement animations?
tween.tween_callback(anim_player.play.bind("running"))
var target_position = target.position + Vector2(offset, 0)
tween.tween_property(self, "position", target_position,.75)
tween.tween_property(self, "position", target_position,.5)
if target_position.x < position.x:
$Sprite.flip_h = true
tween.tween_property($Sprite, "flip_h", false, 0)
@@ -50,13 +65,24 @@ func approach(target, offset) -> void:
func attack(target : QuestSprite) -> void:
print("Attack by %s to %s" % [name, target.name])
target.take_damage(self, 10)
action_complete.emit(true)
hitting.connect(spear_hit.bind(target), CONNECT_ONE_SHOT)
anim_player.play("spear attack")
func spear_hit(target : QuestSprite) -> void:
target.take_damage(self, 5)
func take_damage(source : QuestSprite, amount : int) -> void:
busy.emit()
var damage_banner = damage_banner_template.instantiate()
damage_banner.position = Vector2.ZERO
banner_offset.add_child(damage_banner)
damage_banner.set_label(str(-amount))
if amount > 0:
anim_player.play("hurt")
life = clampi(life - amount, 0, max_life)
lifebar.value = life * 100 / max_life
lifebar.value = life
lifebar.max_value = max_life
if life == 0:
print("%s killed %s!" % [source.name, name])
die(source)
@@ -68,3 +94,26 @@ func take_damage(source : QuestSprite, amount : int) -> void:
func die(killer : QuestSprite) -> void:
died.emit(killer)
queue_free()
func trigger_hit() -> void:
hitting.emit()
func complete_action(requeue : bool, reset_animation : String) -> void:
anim_player.play(reset_animation)
action_complete.emit(requeue)
func show_lifebar(showing : bool) -> void:
lifebar.visible = showing
func flip_h() -> void:
$Sprite.flip_h = true
func knockback(time : float) -> void:
knockback_tween = create_tween()
var offset : Vector2 = Vector2(-20, 0)
if $Sprite.flip_h:
offset.x *= -1
var knockback_pos = reset_position + offset
knockback_tween.tween_property(self, "position", knockback_pos, lerp(0.0, time, (knockback_pos.x - position.x) / offset.x ))
knockback_tween.tween_property(self, "position", reset_position, time)

View File

@@ -1,6 +1,7 @@
class_name QuestorSprite extends QuestSprite
@onready var levelup_banner_template = preload("res://templates/levelup_banner.tscn")
var data : Adventurer = null
var banner_lag : float
@@ -15,6 +16,7 @@ func _ready() -> void:
stats = StatBlock.copy(data.stats)
gold = data.gold
data.changed.connect(_on_questor_changed)
super._ready()
func _process(delta) -> void:
if banner_lag > 0:
@@ -45,13 +47,15 @@ func show_levelup_banner(lagged : bool = false) -> void:
return
var banner = levelup_banner_template.instantiate()
banner.position = Vector2.ZERO
$BannerOffset.add_child(banner)
banner_offset.add_child(banner)
banner_lag = .75
func check_levelup() -> void:
data.gain_exp(exp)
func _on_level_up() -> void:
show_levelup_banner()

View File

@@ -0,0 +1,26 @@
shader_type canvas_item;
render_mode blend_mix;
uniform bool flash;
uniform float flash_strength = 0.4;
uniform vec4 highlight : source_color = vec4(1,1,1,0);
void vertex() {
}
void fragment() {
vec4 col = texture(TEXTURE, UV);
vec4 h = highlight;
if(flash){
h.a = flash_strength * (sin(TIME * 10.0) + 1.0)/2.0;
}
//COLOR.r *= col.r;
//COLOR.g *= col.g;
//COLOR.b *= col.b;
COLOR.rgb = mix(COLOR.rgb, h.rgb, h.a);
COLOR.a = col.a * COLOR.a;
}

View File

@@ -0,0 +1 @@
uid://ctod7r3yre02d

View File

@@ -8,7 +8,7 @@ uniform sampler2D screen_texture : hint_screen_texture, repeat_disable, filter_n
void fragment() {
vec2 size = SCREEN_PIXEL_SIZE * float(line_thickness*2.0);
vec2 size = SCREEN_PIXEL_SIZE * float(line_thickness*4.0);
float line_alpha = 0.0;
for (float i = -size.x; i <= size.x; i += SCREEN_PIXEL_SIZE.x) {
for (float j = -size.y; j <= size.y; j += SCREEN_PIXEL_SIZE.y) {
@@ -16,7 +16,7 @@ void fragment() {
}
}
float div = size.x*2.0/SCREEN_PIXEL_SIZE.x + size.y*2.0/SCREEN_PIXEL_SIZE.y;
line_alpha = .2 * (line_alpha / div) + 0.0 * sign(line_alpha);
line_alpha = .1 * (line_alpha / div);
vec4 colour = texture(screen_texture, SCREEN_UV);
vec4 outline = vec4(line_color.rgb, min(line_alpha, 1.0));
COLOR *= mix(outline, colour, colour.a);

View File

@@ -0,0 +1,16 @@
[gd_scene load_steps=2 format=3 uid="uid://4wbwscvayw8c"]
[ext_resource type="Script" uid="uid://cv7wuquahc53c" path="res://scripts/quest_notice_banner.gd" id="1_5gikw"]
[node name="Damage Banner" type="Sprite2D"]
script = ExtResource("1_5gikw")
[node name="Label" type="Label" parent="."]
offset_left = -32.0
offset_top = -26.0
offset_right = 37.0
offset_bottom = 8.0
theme_override_font_sizes/font_size = 24
text = "99999"
horizontal_alignment = 1
vertical_alignment = 1

View File

@@ -1,13 +1,192 @@
[gd_scene load_steps=9 format=3 uid="uid://c31w28fcqw4ra"]
[gd_scene load_steps=18 format=3 uid="uid://c31w28fcqw4ra"]
[ext_resource type="Script" uid="uid://fxixa11vqdrn" path="res://scripts/enemy.gd" id="1_82j8k"]
[ext_resource type="Texture2D" uid="uid://1mkagt2y0jah" path="res://graphics/questview/goo.png" id="2_87tms"]
[ext_resource type="Script" uid="uid://727tgvtmq4nb" path="res://data/statblock.gd" id="2_fehp8"]
[ext_resource type="Texture2D" uid="uid://cf31h0xgcc2yi" path="res://graphics/questview/goo shadow.png" id="3_bfuvr"]
[ext_resource type="Shader" uid="uid://ctod7r3yre02d" path="res://shaders/nonvariant_sprite.gdshader" id="4_h6sl2"]
[ext_resource type="Texture2D" uid="uid://bmkpn7sex6buo" path="res://graphics/questview/goo-sheet.png" id="4_rigyd"]
[sub_resource type="Resource" id="Resource_bfuvr"]
script = ExtResource("2_fehp8")
metadata/_custom_type_script = "uid://727tgvtmq4nb"
[sub_resource type="ShaderMaterial" id="ShaderMaterial_h6sl2"]
resource_local_to_scene = true
shader = ExtResource("4_h6sl2")
shader_parameter/flash = false
shader_parameter/flash_strength = 0.4
shader_parameter/highlight = Color(1, 1, 1, 0)
[sub_resource type="Animation" id="Animation_fnqwt"]
resource_name = "idle"
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Sprite:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [0]
}
[sub_resource type="Animation" id="Animation_q2yeo"]
resource_name = "attack"
length = 0.80000335
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Sprite:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.16666667, 0.33333334, 0.36666667, 0.43333334, 0.49999997),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1),
"update": 1,
"values": [8, 9, 10, 11, 12, 13]
}
tracks/1/type = "method"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath(".")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0.33333334, 0.5),
"transitions": PackedFloat32Array(1, 1),
"values": [{
"args": [],
"method": &"trigger_hit"
}, {
"args": [true, "idle"],
"method": &"complete_action"
}]
}
[sub_resource type="Animation" id="Animation_rfgh2"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Sprite:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [9]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("Sprite:position")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Vector2(0, -48)]
}
tracks/2/type = "value"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath("Sprite:material:shader_parameter/highlight")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Color(1, 1, 1, 0)]
}
[sub_resource type="Animation" id="Animation_t5s0y"]
resource_name = "running"
length = 0.46667004
loop_mode = 1
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Sprite:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.06666667, 0.13333333, 0.20000002, 0.26666668, 0.33333334, 0.40000004),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1),
"update": 1,
"values": [2, 3, 4, 5, 6, 7, 1]
}
[sub_resource type="Animation" id="Animation_in6p1"]
resource_name = "hurt"
length = 0.23333667
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Sprite:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.099999994, 0.13333333, 0.16666667, 0.2),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1),
"update": 1,
"values": [14, 15, 16, 17, 18]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("Sprite:position")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0, 0.06666667, 0.16666667, 0.23333335),
"transitions": PackedFloat32Array(1, 1, 1, 1),
"update": 0,
"values": [Vector2(0, -48), Vector2(0, -60), Vector2(0, -48), Vector2(0, -48)]
}
tracks/2/type = "value"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath("Sprite:material:shader_parameter/highlight")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0, 0.1, 0.16666667),
"transitions": PackedFloat32Array(1, 1, 1),
"update": 0,
"values": [Color(1, 1, 1, 0), Color(1, 1, 1, 1), Color(1, 1, 1, 0)]
}
tracks/3/type = "method"
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/path = NodePath(".")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/keys = {
"times": PackedFloat32Array(0, 0.23333333),
"transitions": PackedFloat32Array(1, 1),
"values": [{
"args": [0.2],
"method": &"knockback"
}, {
"args": [false, "idle"],
"method": &"complete_action"
}]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_45clm"]
_data = {
&"RESET": SubResource("Animation_rfgh2"),
&"attack": SubResource("Animation_q2yeo"),
&"hurt": SubResource("Animation_in6p1"),
&"idle": SubResource("Animation_fnqwt"),
&"running": SubResource("Animation_t5s0y")
}
[sub_resource type="Gradient" id="Gradient_nqdtq"]
offsets = PackedFloat32Array(0)
colors = PackedColorArray(0, 0, 0, 1)
@@ -28,13 +207,27 @@ width = 1
layout_mode = 3
anchors_preset = 0
script = ExtResource("1_82j8k")
life = 10
max_life = 10
stats = SubResource("Resource_bfuvr")
[node name="Sprite2D" type="Sprite2D" parent="."]
[node name="Shadow" type="Sprite2D" parent="."]
modulate = Color(0, 0, 0, 0.57254905)
position = Vector2(0, -48)
texture = ExtResource("2_87tms")
texture = ExtResource("3_bfuvr")
[node name="Sprite" type="Sprite2D" parent="."]
material = SubResource("ShaderMaterial_h6sl2")
position = Vector2(0, -48)
texture = ExtResource("4_rigyd")
hframes = 8
vframes = 3
frame = 9
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
libraries = {
&"": SubResource("AnimationLibrary_45clm")
}
[node name="LifeBar" type="TextureProgressBar" parent="."]
layout_mode = 0
@@ -47,3 +240,6 @@ texture_under = SubResource("GradientTexture1D_fehp8")
texture_progress = SubResource("GradientTexture1D_bfuvr")
tint_over = Color(1, 0, 0, 1)
tint_progress = Color(1, 0, 0, 1)
[node name="BannerOffset" type="Node2D" parent="."]
position = Vector2(0, -57)

View File

@@ -34,7 +34,7 @@ point_count = 2
[sub_resource type="ShaderMaterial" id="ShaderMaterial_nfvtf"]
shader = ExtResource("2_ggqxp")
shader_parameter/line_thickness = 3.8570001832075
shader_parameter/line_thickness = 3.0000001425
shader_parameter/line_color = Color(0.7666664, 0, 1, 1)
[sub_resource type="Gradient" id="Gradient_ggqxp"]
@@ -97,7 +97,7 @@ scale = Vector2(2, 2)
transform = Transform2D(2, 0, 0, 2, 0, 0)
[node name="ColorRect" type="ColorRect" parent="CanvasLayer"]
anchors_preset = -1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
offset_left = -801.5
@@ -131,13 +131,13 @@ scale_amount_max = 4.2
scale_amount_curve = SubResource("Curve_0aygh")
[node name="CanvasGroup" type="CanvasGroup" parent="."]
texture_filter = 4
material = SubResource("ShaderMaterial_nfvtf")
position = Vector2(509, 176)
scale = Vector2(5, 5)
[node name="CPUParticles2D" type="CPUParticles2D" parent="CanvasGroup"]
material = SubResource("ShaderMaterial_28dkg")
scale = Vector2(0.99999994, 0.99999994)
scale = Vector2(5, 5)
amount = 1000
texture = ExtResource("13_0xaku")
preprocess = 5.0
@@ -276,7 +276,7 @@ avoidance_enabled = true
position = Vector2(654, -2)
[node name="SubViewport" type="SubViewport" parent="."]
size = Vector2i(1920, 1080)
size = Vector2i(3840, 2160)
[node name="ColorRect" type="ColorRect" parent="SubViewport"]
anchors_preset = 15
@@ -294,7 +294,7 @@ follow_viewport = false
ignore_camera_scroll = true
[node name="TextureRect2" type="TextureRect" parent="SubViewport/Parallax2D"]
anchors_preset = -1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
offset_right = 1920.0

View File

@@ -1,4 +1,4 @@
[gd_scene load_steps=13 format=3 uid="uid://cdtpyg5ohniax"]
[gd_scene load_steps=15 format=3 uid="uid://cdtpyg5ohniax"]
[ext_resource type="Script" uid="uid://ce0vugvrwvppb" path="res://scripts/questor_sprite.gd" id="1_0ev5i"]
[ext_resource type="Texture2D" uid="uid://bu0e077vc8qo1" path="res://graphics/questview/lvlup-circle.png" id="2_nqdtq"]
@@ -124,11 +124,60 @@ tracks/3/keys = {
"values": [Vector2(0, -45), Vector2(0, -40), Vector2(0, -45), Vector2(0, -40), Vector2(0, -45)]
}
[sub_resource type="Animation" id="Animation_cr46e"]
resource_name = "spear attack"
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Sprite:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.033333335, 0.06666667, 0.10000001, 0.13333334, 0.16666667, 0.20000002, 0.23333335, 0.26666668),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1, 1, 1),
"update": 1,
"values": [11, 11, 12, 13, 14, 15, 16, 17, 18]
}
tracks/1/type = "method"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath(".")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0.16666667, 0.5),
"transitions": PackedFloat32Array(1, 1),
"values": [{
"args": [],
"method": &"trigger_hit"
}, {
"args": [true, "spear idle"],
"method": &"complete_action"
}]
}
[sub_resource type="Animation" id="Animation_nqdtq"]
resource_name = "spear idle"
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Sprite:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [18]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_pylgq"]
_data = {
&"RESET": SubResource("Animation_7jhts"),
&"idle": SubResource("Animation_gy3gd"),
&"running": SubResource("Animation_5om5g")
&"running": SubResource("Animation_5om5g"),
&"spear attack": SubResource("Animation_cr46e"),
&"spear idle": SubResource("Animation_nqdtq")
}
[sub_resource type="Gradient" id="Gradient_nqdtq"]
@@ -155,6 +204,11 @@ offset_top = 274.0
offset_right = 89.0
offset_bottom = 274.0
script = ExtResource("1_0ev5i")
life = null
max_life = null
energy = null
max_energy = null
exp = null
[node name="GroundFX" type="Node2D" parent="."]
position = Vector2(0, -30)
@@ -175,7 +229,7 @@ texture = ExtResource("3_cr46e")
position = Vector2(0, -53)
texture = ExtResource("2_w1b7t")
hframes = 4
vframes = 3
vframes = 5
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
libraries = {
@@ -187,6 +241,7 @@ autoplay = "running"
position = Vector2(0, -94)
[node name="LifeBar" type="TextureProgressBar" parent="."]
visible = false
layout_mode = 0
offset_left = -37.0
offset_top = 16.0