Compare commits

..

2 Commits

17 changed files with 189 additions and 40 deletions

BIN
assets/quick_health.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 566 B

View File

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/quick_health.png-ab4d63b30abc1b0088589c308b6afa54.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/quick_health.png"
dest_files=[ "res://.import/quick_health.png-ab4d63b30abc1b0088589c308b6afa54.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

View File

@ -24,15 +24,20 @@ _global_script_classes=[ {
"language": "GDScript", "language": "GDScript",
"path": "res://src/components/Health_Component.gd" "path": "res://src/components/Health_Component.gd"
}, { }, {
"base": "Interactable",
"class": "HealthPickup",
"language": "GDScript",
"path": "res://src/Interactables/HealthPickup.gd"
}, {
"base": "Area2D", "base": "Area2D",
"class": "Interactable", "class": "Interactable",
"language": "GDScript", "language": "GDScript",
"path": "res://src/components/Interactable_Component.gd" "path": "res://src/templates/Interactable/Interactable_Component.gd"
}, { }, {
"base": "Node2D", "base": "Node2D",
"class": "Interactable_Receiver", "class": "Interactable_Receiver",
"language": "GDScript", "language": "GDScript",
"path": "res://src/components/Interactable_Receiver.gd" "path": "res://src/templates/Interactable/Interactable_Receiver.gd"
}, { }, {
"base": "Node", "base": "Node",
"class": "MovementComponent", "class": "MovementComponent",
@ -73,6 +78,7 @@ _global_script_class_icons={
"Actor": "", "Actor": "",
"FrameSoundEffects": "", "FrameSoundEffects": "",
"HealthComponent": "", "HealthComponent": "",
"HealthPickup": "",
"Interactable": "", "Interactable": "",
"Interactable_Receiver": "", "Interactable_Receiver": "",
"MovementComponent": "", "MovementComponent": "",

View File

@ -0,0 +1,14 @@
extends Interactable
# Declare member variables here. Examples:
# var a = 2
# var b = "text"
onready var sprite: Sprite = $Sprite
func trigger_interaction():
# This is something that should maybe be extended for every differant interactible.
# They could inherit from this base class and implement this function.
sprite.frame = 1

View File

@ -0,0 +1,21 @@
[gd_scene load_steps=5 format=2]
[ext_resource path="res://src/templates/Interactable/Interactable_Component.tscn" type="PackedScene" id=1]
[ext_resource path="res://src/Interactables/Chest.gd" type="Script" id=2]
[ext_resource path="res://assets/High Forest/Assets/Interior-01.png" type="Texture" id=3]
[sub_resource type="RectangleShape2D" id=1]
[node name="Chest" instance=ExtResource( 1 )]
script = ExtResource( 2 )
[node name="Sprite" type="Sprite" parent="." index="0"]
texture = ExtResource( 3 )
vframes = 2
region_enabled = true
region_rect = Rect2( 49, 80, 30, 64 )
[node name="CollisionShape2D" type="CollisionShape2D" parent="." index="1"]
modulate = Color( 0.0313726, 1, 0, 1 )
position = Vector2( 0, 3 )
shape = SubResource( 1 )

View File

@ -0,0 +1,12 @@
class_name HealthPickup
extends Interactable
onready var health_icon: AnimatedSprite = $AnimatedSprite
func trigger_interaction():
# This is something that should maybe be extended for every differant interactible.
# They could inherit from this base class and implement this function.
# sprite.frame = 1
queue_free()

View File

@ -0,0 +1,19 @@
[gd_scene load_steps=5 format=2]
[ext_resource path="res://src/Interactables/HealthPickup.gd" type="Script" id=1]
[ext_resource path="res://src/templates/Interactable/Interactable_Component.tscn" type="PackedScene" id=2]
[ext_resource path="res://src/Interactables/QuickHealthPickup.tres" type="SpriteFrames" id=3]
[sub_resource type="CircleShape2D" id=1]
radius = 6.0
[node name="HealthPickup" instance=ExtResource( 2 )]
script = ExtResource( 1 )
[node name="AnimatedSprite" type="AnimatedSprite" parent="." index="0"]
frames = ExtResource( 3 )
frame = 1
playing = true
[node name="CollisionShape2D" type="CollisionShape2D" parent="." index="1"]
shape = SubResource( 1 )

View File

@ -0,0 +1,27 @@
[gd_resource type="SpriteFrames" load_steps=6 format=2]
[ext_resource path="res://assets/quick_health.png" type="Texture" id=1]
[sub_resource type="AtlasTexture" id=1]
atlas = ExtResource( 1 )
region = Rect2( 0, 0, 15, 13 )
[sub_resource type="AtlasTexture" id=2]
atlas = ExtResource( 1 )
region = Rect2( 15, 0, 15, 13 )
[sub_resource type="AtlasTexture" id=3]
atlas = ExtResource( 1 )
region = Rect2( 30, 0, 15, 13 )
[sub_resource type="AtlasTexture" id=4]
atlas = ExtResource( 1 )
region = Rect2( 45, 0, 15, 13 )
[resource]
animations = [ {
"frames": [ SubResource( 1 ), SubResource( 2 ), SubResource( 3 ), SubResource( 4 ) ],
"loop": true,
"name": "default",
"speed": 5.0
} ]

View File

@ -1,9 +1,10 @@
[gd_scene load_steps=7 format=2] [gd_scene load_steps=8 format=2]
[ext_resource path="res://src/templates/Actor/ActorTemplate.tscn" type="PackedScene" id=1] [ext_resource path="res://src/templates/Actor/ActorTemplate.tscn" type="PackedScene" id=1]
[ext_resource path="res://assets/Tiles/Assets/Demo TileSet.tres" type="TileSet" id=2] [ext_resource path="res://assets/Tiles/Assets/Demo TileSet.tres" type="TileSet" id=2]
[ext_resource path="res://assets/Backgrounds/bgmuck.png" type="Texture" id=3] [ext_resource path="res://assets/Backgrounds/bgmuck.png" type="Texture" id=3]
[ext_resource path="res://src/components/Interactable_Component.tscn" type="PackedScene" id=4] [ext_resource path="res://src/Interactables/Chest.tscn" type="PackedScene" id=4]
[ext_resource path="res://src/Interactables/HealthPickup.tscn" type="PackedScene" id=5]
[ext_resource path="res://assets/Music/platformer_level03_loop.ogg" type="AudioStream" id=6] [ext_resource path="res://assets/Music/platformer_level03_loop.ogg" type="AudioStream" id=6]
[ext_resource path="res://src/enemyC/EnemyC.tscn" type="PackedScene" id=7] [ext_resource path="res://src/enemyC/EnemyC.tscn" type="PackedScene" id=7]
@ -73,5 +74,11 @@ __meta__ = {
} }
actor_type = "NPC" actor_type = "NPC"
[node name="Interactable_Component" parent="." instance=ExtResource( 4 )] [node name="HealthPickup" parent="." instance=ExtResource( 5 )]
position = Vector2( 186, 144 ) position = Vector2( 226, 153 )
[node name="Chest2" parent="." instance=ExtResource( 4 )]
position = Vector2( 319, 112 )
[node name="Chest" parent="." instance=ExtResource( 4 )]
position = Vector2( 187, 144 )

View File

@ -253,7 +253,7 @@ tile_set = SubResource( 11 )
cell_size = Vector2( 16, 16 ) cell_size = Vector2( 16, 16 )
show_collision = true show_collision = true
format = 1 format = 1
tile_data = PoolIntArray( 196636, 4, 131072, 196637, 4, 131073, 196638, 4, 131073, 196639, 4, 131073, 196640, 4, 131073, 196641, 4, 131073, 196642, 4, 131073, 196643, 4, 131074, 262172, 4, 196608, 262173, 4, 196609, 262174, 4, 196609, 262175, 4, 196609, 262176, 4, 196609, 262177, 4, 196609, 262178, 4, 196609, 262179, 4, 196610, 458770, 2, 1, 458771, 0, 1, 458772, 0, 2, 458773, 0, 3, 458774, 0, 1, 458775, 0, 2, 458776, 0, 3, 458777, 4, 2, 458778, 0, 1, 458779, 0, 2, 458780, 0, 3, 458781, 0, 1, 458782, 0, 2, 458783, 0, 3, 458784, 4, 2, 458785, 0, 1, 458786, 0, 2, 458787, 0, 3, 458788, 0, 1, 458789, 0, 2, 458790, 0, 3, 458791, 4, 2, 458792, 0, 4, 524304, 2, 1, 524305, 2, 65536, 524306, 2, 65537, 524307, 0, 65537, 524308, 0, 65538, 524309, 0, 65539, 524310, 0, 65537, 524311, 0, 65538, 524312, 0, 65539, 524313, 4, 65538, 524314, 0, 65537, 524315, 0, 65538, 524316, 0, 65539, 524317, 0, 65537, 524318, 0, 65538, 524319, 0, 65539, 524320, 4, 65538, 524321, 0, 65537, 524322, 0, 65538, 524323, 0, 65539, 524324, 0, 65537, 524325, 0, 65538, 524326, 0, 65539, 524327, 4, 65538, 524328, 0, 65540, 589826, 0, 0, 589827, 0, 1, 589828, 0, 2, 589829, 0, 3, 589830, 0, 1, 589831, 0, 2, 589832, 0, 3, 589833, 0, 1, 589834, 0, 2, 589835, 0, 3, 589836, 0, 1, 589837, 0, 2, 589838, 0, 3, 589839, 2, 65536, 589840, 2, 65537, 589841, 2, 131072, 589842, 2, 131073, 589843, 0, 131073, 589844, 0, 131074, 589845, 0, 131075, 589846, 0, 131073, 589847, 0, 131074, 589848, 0, 131075, 589849, 0, 131074, 589850, 0, 131073, 589851, 0, 131074, 589852, 0, 131075, 589853, 0, 131073, 589854, 0, 131074, 589855, 0, 131075, 589856, 0, 131074, 589857, 0, 131073, 589858, 0, 131074, 589859, 0, 131075, 589860, 0, 131073, 589861, 0, 131074, 589862, 0, 131075, 589863, 0, 131074, 589864, 0, 131076, 655362, 0, 65536, 655363, 0, 65537, 655364, 0, 65538, 655365, 0, 65539, 655366, 0, 65537, 655367, 0, 65538, 655368, 0, 65539, 655369, 0, 65537, 655370, 0, 65538, 655371, 0, 65539, 655372, 0, 65537, 655373, 0, 65538, 655374, 0, 65539, 655375, 2, 131072, 655376, 2, 131073, 655377, 4, 0, 655378, 4, 1, 655379, 0, 196610, 655380, 0, 196610, 655381, 0, 196610, 655382, 0, 196610, 655383, 0, 196610, 655384, 0, 196610, 655385, 0, 196610, 655386, 0, 196610, 655387, 0, 196610, 655388, 0, 196610, 655389, 0, 196610, 655390, 0, 196610, 655391, 0, 196610, 655392, 0, 196610, 655393, 0, 196610, 655394, 0, 196610, 655395, 0, 196610, 655396, 0, 196610, 655397, 0, 196610, 655398, 0, 196610, 655399, 0, 196610, 655400, 0, 196612, 720898, 0, 131072, 720899, 0, 131073, 720900, 0, 131074, 720901, 0, 131075, 720902, 0, 131073, 720903, 0, 131074, 720904, 0, 131075, 720905, 0, 131073, 720906, 0, 131074, 720907, 0, 131075, 720908, 0, 131073, 720909, 0, 131074, 720910, 0, 131075, 720911, 4, 0, 720912, 4, 1, 720913, 0, 196610, 720914, 0, 196610, 720915, 0, 196610, 720916, 0, 196610, 720917, 0, 196610, 720918, 0, 196610, 720919, 0, 196610, 720920, 0, 196610, 720921, 0, 196610, 720922, 0, 196610, 720923, 0, 196610, 720924, 0, 196610, 720925, 0, 196610, 720926, 0, 196610, 720927, 0, 196610, 720928, 0, 196610, 720929, 0, 196610, 720930, 0, 196610, 720931, 0, 196610, 720932, 0, 196610, 720933, 0, 196610, 720934, 0, 196610, 720935, 0, 262147, 720936, 0, 262148 ) tile_data = PoolIntArray( 196636, 4, 131072, 196637, 4, 131073, 196638, 4, 131073, 196639, 4, 131073, 196640, 4, 131073, 196641, 4, 131073, 196642, 4, 131073, 196643, 4, 131074, 262172, 4, 196608, 262173, 4, 196609, 262174, 4, 196609, 262175, 4, 196609, 262176, 4, 196609, 262177, 4, 196609, 262178, 4, 196609, 262179, 4, 196610, 458770, 2, 1, 458771, 0, 1, 458772, 0, 2, 458773, 0, 3, 458774, 0, 1, 458775, 0, 2, 458776, 0, 3, 458777, 4, 2, 458778, 0, 1, 458779, 0, 2, 458780, 0, 3, 458781, 0, 1, 458782, 0, 2, 458783, 0, 3, 458784, 4, 2, 458785, 0, 1, 458786, 0, 2, 458787, 0, 3, 458788, 0, 1, 458789, 0, 2, 458790, 0, 3, 458791, 4, 2, 458792, 0, 4, 458796, 0, 3, 458797, 0, 1, 458798, 0, 2, 458799, 0, 3, 458800, 0, 1, 458801, 0, 2, 458802, 0, 3, 458803, 0, 1, 458804, 0, 2, 458805, 0, 3, 458806, 0, 1, 458807, 0, 2, 458808, 0, 3, 524304, 2, 1, 524305, 2, 65536, 524306, 2, 65537, 524307, 0, 65537, 524308, 0, 65538, 524309, 0, 65539, 524310, 0, 65537, 524311, 0, 65538, 524312, 0, 65539, 524313, 4, 65538, 524314, 0, 65537, 524315, 0, 65538, 524316, 0, 65539, 524317, 0, 65537, 524318, 0, 65538, 524319, 0, 65539, 524320, 4, 65538, 524321, 0, 65537, 524322, 0, 65538, 524323, 0, 65539, 524324, 0, 65537, 524325, 0, 65538, 524326, 0, 65539, 524327, 4, 65538, 524328, 0, 65540, 524332, 0, 65536, 524333, 0, 65537, 524334, 0, 65538, 524335, 0, 65539, 524336, 0, 65537, 524337, 0, 65538, 524338, 0, 65539, 524339, 0, 65537, 524340, 0, 65538, 524341, 0, 65539, 524342, 0, 65537, 524343, 0, 65538, 524344, 0, 65539, 589826, 0, 0, 589827, 0, 1, 589828, 0, 2, 589829, 0, 3, 589830, 0, 1, 589831, 0, 2, 589832, 0, 3, 589833, 0, 1, 589834, 0, 2, 589835, 0, 3, 589836, 0, 1, 589837, 0, 2, 589838, 0, 3, 589839, 2, 65536, 589840, 2, 65537, 589841, 2, 131072, 589842, 2, 131073, 589843, 0, 131073, 589844, 0, 131074, 589845, 0, 131075, 589846, 0, 131073, 589847, 0, 131074, 589848, 0, 131075, 589849, 0, 131074, 589850, 0, 131073, 589851, 0, 131074, 589852, 0, 131075, 589853, 0, 131073, 589854, 0, 131074, 589855, 0, 131075, 589856, 0, 131074, 589857, 0, 131073, 589858, 0, 131074, 589859, 0, 131075, 589860, 0, 131073, 589861, 0, 131074, 589862, 0, 131075, 589863, 0, 131074, 589864, 0, 131076, 589868, 0, 131072, 589869, 0, 131073, 589870, 0, 131074, 589871, 0, 131075, 589872, 0, 131073, 589873, 0, 131074, 589874, 0, 131075, 589875, 0, 131073, 589876, 0, 131074, 589877, 0, 131075, 589878, 0, 131073, 589879, 0, 131074, 589880, 0, 131075, 655362, 0, 65536, 655363, 0, 65537, 655364, 0, 65538, 655365, 0, 65539, 655366, 0, 65537, 655367, 0, 65538, 655368, 0, 65539, 655369, 0, 65537, 655370, 0, 65538, 655371, 0, 65539, 655372, 0, 65537, 655373, 0, 65538, 655374, 0, 65539, 655375, 2, 131072, 655376, 2, 131073, 655377, 4, 0, 655378, 4, 1, 655379, 0, 196610, 655380, 0, 196610, 655381, 0, 196610, 655382, 0, 196610, 655383, 0, 196610, 655384, 0, 196610, 655385, 0, 196610, 655386, 0, 196610, 655387, 0, 196610, 655388, 0, 196610, 655389, 0, 196610, 655390, 0, 196610, 655391, 0, 196610, 655392, 0, 196610, 655393, 0, 196610, 655394, 0, 196610, 655395, 0, 196610, 655396, 0, 196610, 655397, 0, 196610, 655398, 0, 196610, 655399, 0, 196610, 655400, 0, 196612, 655404, 0, 196608, 655405, 0, 196610, 655406, 0, 196610, 655407, 0, 196610, 655408, 0, 196610, 655409, 0, 196610, 655410, 0, 196610, 655411, 0, 196610, 655412, 0, 196610, 655413, 0, 196610, 655414, 0, 196610, 655415, 0, 196610, 655416, 0, 196610, 720898, 0, 131072, 720899, 0, 131073, 720900, 0, 131074, 720901, 0, 131075, 720902, 0, 131073, 720903, 0, 131074, 720904, 0, 131075, 720905, 0, 131073, 720906, 0, 131074, 720907, 0, 131075, 720908, 0, 131073, 720909, 0, 131074, 720910, 0, 131075, 720911, 4, 0, 720912, 4, 1, 720913, 0, 196610, 720914, 0, 196610, 720915, 0, 196610, 720916, 0, 196610, 720917, 0, 196610, 720918, 0, 196610, 720919, 0, 196610, 720920, 0, 196610, 720921, 0, 196610, 720922, 0, 196610, 720923, 0, 196610, 720924, 0, 196610, 720925, 0, 196610, 720926, 0, 196610, 720927, 0, 196610, 720928, 0, 196610, 720929, 0, 196610, 720930, 0, 196610, 720931, 0, 196610, 720932, 0, 196610, 720933, 0, 196610, 720934, 0, 196610, 720935, 0, 262147, 720936, 0, 262148, 720940, 0, 262144, 720941, 0, 262145, 720942, 0, 262146, 720943, 0, 262147, 720944, 0, 262145, 720945, 0, 262146, 720946, 0, 262147, 720947, 0, 262145, 720948, 0, 262146, 720949, 0, 262147, 720950, 0, 262145, 720951, 0, 262146, 720952, 0, 262147 )
__meta__ = { __meta__ = {
"_edit_lock_": true "_edit_lock_": true
} }
@ -289,3 +289,6 @@ __meta__ = {
"_edit_lock_": true "_edit_lock_": true
} }
actor_type = "NPC" actor_type = "NPC"
[node name="EnemyC3" parent="." instance=ExtResource( 7 )]
position = Vector2( 796, 89 )

View File

@ -1,24 +0,0 @@
[gd_scene load_steps=4 format=2]
[ext_resource path="res://assets/High Forest/Assets/Interior-01.png" type="Texture" id=1]
[ext_resource path="res://src/components/Interactable_Component.gd" type="Script" id=2]
[sub_resource type="RectangleShape2D" id=1]
[node name="Interactable_Component" type="Area2D"]
script = ExtResource( 2 )
sprite_node = NodePath("Sprite")
[node name="Sprite" type="Sprite" parent="."]
texture = ExtResource( 1 )
vframes = 2
region_enabled = true
region_rect = Rect2( 49, 80, 30, 64 )
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
modulate = Color( 0.290196, 1, 0, 1 )
position = Vector2( -1, 3 )
shape = SubResource( 1 )
[connection signal="body_entered" from="." to="." method="_on_Interactable_Component_body_entered"]
[connection signal="body_exited" from="." to="." method="_on_Interactable_Component_body_exited"]

View File

@ -24,8 +24,13 @@ func hit_Receiver(damage):
yield( get_tree().create_timer(2 + $movement_state_machine/hurt.timeout_seconds), "timeout") yield( get_tree().create_timer(2 + $movement_state_machine/hurt.timeout_seconds), "timeout")
$Hurtbox_Component.set_hurtbox(true) $Hurtbox_Component.set_hurtbox(true)
func touch_the_thing(): func touch_the_thing(the_thing: Interactable) -> bool:
print("You see! a THING...") print("You see! a THING...", the_thing.name)
if the_thing is HealthPickup:
# Do some healthy stuff.
the_thing.trigger_interaction()
return false
return true
func _on_attack_do_attack(): func _on_attack_do_attack():
var is_shooting = false var is_shooting = false

View File

@ -15,7 +15,7 @@
[ext_resource path="res://src/Gun.gd" type="Script" id=13] [ext_resource path="res://src/Gun.gd" type="Script" id=13]
[ext_resource path="res://src/playerD/states/roll.gd" type="Script" id=14] [ext_resource path="res://src/playerD/states/roll.gd" type="Script" id=14]
[ext_resource path="res://src/state_animated_actor.gd" type="Script" id=15] [ext_resource path="res://src/state_animated_actor.gd" type="Script" id=15]
[ext_resource path="res://src/components/Interactable_Receiver.gd" type="Script" id=16] [ext_resource path="res://src/templates/Interactable/Interactable_Receiver.gd" type="Script" id=16]
[sub_resource type="StreamTexture" id=90] [sub_resource type="StreamTexture" id=90]
load_path = "res://.import/Mega.png-93dfe0790902b932f7b46f7b23c5d4e7.stex" load_path = "res://.import/Mega.png-93dfe0790902b932f7b46f7b23c5d4e7.stex"
@ -561,6 +561,7 @@ __meta__ = {
[node name="movement_component" parent="." index="2"] [node name="movement_component" parent="." index="2"]
script = ExtResource( 2 ) script = ExtResource( 2 )
player_number = 1 player_number = 1
interactable_node = NodePath("../Interactable_Receiver")
[node name="idle" parent="movement_state_machine" index="0"] [node name="idle" parent="movement_state_machine" index="0"]
script = ExtResource( 4 ) script = ExtResource( 4 )
@ -637,7 +638,7 @@ jump_node = NodePath("../jump")
[node name="roll" type="Node" parent="movement_state_machine" index="7"] [node name="roll" type="Node" parent="movement_state_machine" index="7"]
script = ExtResource( 14 ) script = ExtResource( 14 )
move_speed = 50.0 move_speed = 150.0
animation_sequence = [ "roll" ] animation_sequence = [ "roll" ]
emitter_frame_subscriptions = { emitter_frame_subscriptions = {
2: "roll" 2: "roll"

View File

@ -17,12 +17,23 @@ extends MovementComponent
export var player_number: int = 1 export var player_number: int = 1
export (NodePath) var interactable_node
onready var interactable_receiver_node: Interactable_Receiver = get_node(interactable_node)
func process_physics(delta): func process_physics(delta):
PlayerInfo.player_position = owner.global_position PlayerInfo.player_position = owner.global_position
func process_input(event: InputEvent): func process_input(event: InputEvent):
var interactables = interactable_receiver_node.interactable_function_callables
for interactable in interactables: # Iterate through the interactable collection
if interactable is Interactable: # Make sure we didn't push something dumb in there.
if (Input.is_action_pressed("ui_up")): # We pressed up?
interactable.trigger_interaction()
get_movement_direction() get_movement_direction()
# Return the desired direction of movement for the character # Return the desired direction of movement for the character
# in the range [-1, 1], where positive values indicate a desire # in the range [-1, 1], where positive values indicate a desire
# to move to the right and negative values to the left. # to move to the right and negative values to the left.

View File

@ -17,9 +17,8 @@ extends Area2D
# Declare member variables here. Examples: # Declare member variables here. Examples:
# var a = 2 # var a = 2
# var b = "text" # var b = "text"
export (NodePath) var sprite_node
onready var sprite: Sprite = get_node(sprite_node) export var type_name :String
# Called when the node enters the scene tree for the first time. # Called when the node enters the scene tree for the first time.
func _ready(): func _ready():
@ -28,6 +27,7 @@ func _ready():
func trigger_interaction(): func trigger_interaction():
# This is something that should maybe be extended for every differant interactible. # This is something that should maybe be extended for every differant interactible.
# They could inherit from this base class and implement this function. # They could inherit from this base class and implement this function.
# sprite.frame = 1
pass pass
# Called every frame. 'delta' is the elapsed time since the previous frame. # Called every frame. 'delta' is the elapsed time since the previous frame.

View File

@ -0,0 +1,9 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://src/templates/Interactable/Interactable_Component.gd" type="Script" id=2]
[node name="Interactable_Template" type="Area2D"]
script = ExtResource( 2 )
[connection signal="body_entered" from="." to="." method="_on_Interactable_Component_body_entered"]
[connection signal="body_exited" from="." to="." method="_on_Interactable_Component_body_exited"]

View File

@ -32,9 +32,12 @@ func _ready():
# Switching to a new model that starts with Hitbox # Switching to a new model that starts with Hitbox
func register_interactable(sender): func register_interactable(sender):
print("Interactable Registered " + sender.name) print("Interactable Registered " + sender.name)
if interactable_parent_callback: if call_function.is_valid():
call_function.call_func() var should_register: bool = call_function.call_func(sender)
if should_register:
interactable_function_callables.append(sender) interactable_function_callables.append(sender)
else:
print("Interactable handled by Player")
func remove_interactable(sender): func remove_interactable(sender):
print("Interactable Removal " + sender.name) print("Interactable Removal " + sender.name)