Compare commits

..

3 Commits

Author SHA1 Message Date
8f1ebe6e09 Level change almost there. 2025-03-28 23:08:00 -07:00
2309558593 Create Level Transition Interactable 2025-03-28 21:35:37 -07:00
7106fe35de Rename interactable 2025-03-28 21:23:50 -07:00
15 changed files with 125 additions and 13 deletions

View File

@ -15,3 +15,12 @@ __meta__ = {
position = Vector2( 112, 56 )
[node name="UI_Layer" parent="." instance=ExtResource( 3 )]
[node name="TransitionScene" type="ColorRect" parent="."]
visible = false
modulate = Color( 0, 0, 0, 0 )
margin_right = 320.0
margin_bottom = 180.0
__meta__ = {
"_edit_lock_": true
}

View File

@ -6,6 +6,17 @@ extends Node
# var b = "text"
var player_start_position: Position2D
func change_level(_level_name :String):
print("res://src/levels/" + _level_name + ".tscn" )
#var simultaneous_scene = preload("res://levels/level2.tscn").instance()
var new_level = load("res://src/levels/" + _level_name + ".tscn" ).instance()
#print (get_tree().get_root().get_children())
for l in get_node("/root/Main").get_children():
#print (get_node("/root/Main").get_children())
if l is Level:
print(l)
get_node("/root/Main").remove_child(l)
get_node("/root/Main").add_child(new_level)
# Called every frame. 'delta' is the elapsed time since the previous frame.

View File

@ -1,5 +1,5 @@
class_name Interactable_Receiver
extends Node2D
extends Node
# This may be stupid but we're going to have two kinds of callbacks here.
# It's going to be up to the parent/actor/kinematicbody2d/whatever to know

View File

@ -1,9 +1,9 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://lib/templates/Interactable/Interactable_Component.gd" type="Script" id=2]
[ext_resource path="res://lib/templates/Interactable/Interactable.gd" type="Script" id=1]
[node name="Interactable_Template" type="Area2D"]
script = ExtResource( 2 )
script = ExtResource( 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

@ -44,12 +44,12 @@ _global_script_classes=[ {
"language": "GDScript",
"path": "res://src/Interactables/HealthPickup.gd"
}, {
"base": "Area2D",
"base": "Reference",
"class": "Interactable",
"language": "GDScript",
"path": "res://lib/templates/Interactable/Interactable_Component.gd"
"path": "res://lib/templates/Interactable/Interactable.gd"
}, {
"base": "Node2D",
"base": "Node",
"class": "Interactable_Receiver",
"language": "GDScript",
"path": "res://lib/templates/Interactable/Interactable_Receiver.gd"
@ -59,6 +59,11 @@ _global_script_classes=[ {
"language": "GDScript",
"path": "res://src/classes/Level.gd"
}, {
"base": "Interactable",
"class": "LevelTransition",
"language": "GDScript",
"path": "res://src/Interactables/LevelTransition.gd"
}, {
"base": "Node2D",
"class": "Modifier_Receiver",
"language": "GDScript",
@ -120,6 +125,7 @@ _global_script_class_icons={
"Interactable": "",
"Interactable_Receiver": "",
"Level": "",
"LevelTransition": "",
"Modifier_Receiver": "",
"MovementComponent": "",
"Movement_StateReceiver": "",

View File

@ -1,6 +1,6 @@
[gd_scene load_steps=5 format=2]
[ext_resource path="res://lib/templates/Interactable/Interactable_Component.tscn" type="PackedScene" id=1]
[ext_resource path="res://lib/templates/Interactable/Interactable_Template.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]

View File

@ -1,6 +1,6 @@
[gd_scene load_steps=15 format=2]
[ext_resource path="res://lib/templates/Interactable/Interactable_Component.tscn" type="PackedScene" id=1]
[ext_resource path="res://lib/templates/Interactable/Interactable_Template.tscn" type="PackedScene" id=1]
[ext_resource path="res://src/Interactables/Door.gd" type="Script" id=2]
[ext_resource path="res://assets/mmz1_door.png" type="Texture" id=3]

View File

@ -1,7 +1,7 @@
[gd_scene load_steps=5 format=2]
[ext_resource path="res://src/Interactables/HealthPickup.gd" type="Script" id=1]
[ext_resource path="res://lib/templates/Interactable/Interactable_Component.tscn" type="PackedScene" id=2]
[ext_resource path="res://lib/templates/Interactable/Interactable_Template.tscn" type="PackedScene" id=2]
[ext_resource path="res://src/Interactables/QuickHealthPickup.tres" type="SpriteFrames" id=3]
[sub_resource type="CircleShape2D" id=1]

View File

@ -0,0 +1,15 @@
class_name LevelTransition
extends Interactable
# Declare member variables here. Examples:
# var a = 2
# var b = "text"
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.
print("Okay, I'll transition the level now!")
LevelInfo.change_level("CloneBox")

View File

@ -0,0 +1,10 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://src/Interactables/LevelTransition.gd" type="Script" id=1]
[node name="LevelTransition" type="Area2D"]
script = ExtResource( 1 )
type_name = "LevelTransition"
[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,3 +24,13 @@ func hit_Receiver(damage):
return
yield( get_tree().create_timer(2 + movement_state_machine.get_state_reference('hurt').timeout_seconds), "timeout")
$Hurtbox_Component.set_hurtbox(true)
func touch_the_thing(the_thing: Interactable) -> bool:
print("You see! a THING...", the_thing.name)
if the_thing is HealthPickup:
# Do some healthy stuff.
the_thing.trigger_interaction()
return false
if the_thing is LevelTransition:
the_thing.trigger_interaction()
return true

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=24 format=2]
[gd_scene load_steps=25 format=2]
[ext_resource path="res://lib/templates/Actor/ActorTemplate.tscn" type="PackedScene" id=1]
[ext_resource path="res://assets/actors/players/playerE/PlayerE_SpriteFrames.tres" type="SpriteFrames" id=2]
@ -20,6 +20,7 @@
[ext_resource path="res://lib/classes/state_animated_actor.gd" type="Script" id=18]
[ext_resource path="res://src/actors/players/playerE/states/ledge_grab.tres" type="Resource" id=19]
[ext_resource path="res://src/actors/players/playerE/states/ledge_climb.tres" type="Resource" id=20]
[ext_resource path="res://lib/templates/Interactable/Interactable_Receiver.gd" type="Script" id=21]
[sub_resource type="Resource" id=3]
resource_local_to_scene = true
@ -99,3 +100,7 @@ hurtbox_entered_function = "hit_Receiver"
modulate = Color( 0, 0, 1, 1 )
position = Vector2( -1, 2 )
shape = SubResource( 2 )
[node name="Interactable_Receiver" type="Node" parent="." index="9"]
script = ExtResource( 21 )
interactable_parent_callback = "touch_the_thing"

35
src/levels/CloneBox.tscn Normal file
View File

@ -0,0 +1,35 @@
[gd_scene load_steps=5 format=2]
[ext_resource path="res://src/templates/level_templates/LevelTemplate.tscn" type="PackedScene" id=1]
[ext_resource path="res://assets/levels/LegacyFantasy-High_Forest/tileset.tres" type="TileSet" id=2]
[ext_resource path="res://lib/components/Hitbox_Component.tscn" type="PackedScene" id=3]
[sub_resource type="CircleShape2D" id=1]
radius = 5.09902
[node name="CloneBox" instance=ExtResource( 1 )]
[node name="TileMap Collision" parent="." index="1"]
tile_set = ExtResource( 2 )
tile_data = PoolIntArray( 0, 4, 65536, 19, 4, 65536, 65536, 4, 65536, 65555, 4, 65536, 131072, 4, 65536, 131091, 4, 65536, 196608, 4, 65536, 196620, 2, 0, 196621, 2, 1, 196622, 2, 2, 196627, 4, 65536, 262144, 4, 0, 262156, 2, 65536, 262157, 2, 65537, 262158, 2, 65538, 262163, 4, 0, 327680, 4, 65536, 327699, 4, 65536, 393216, 4, 65536, 458752, 4, 65536, 589823, 0, 1, 524288, 4, 131072, 524289, 0, 3, 524290, 0, 1, 524291, 0, 2, 524292, 0, 3, 524293, 0, 1, 524294, 0, 2, 524295, 0, 3, 524296, 0, 1, 524297, 0, 2, 524298, 0, 3, 524299, 0, 1, 524300, 0, 2, 524301, 0, 3, 524302, 0, 1, 524303, 0, 2, 524304, 0, 3, 524305, 0, 1, 524306, 0, 2, 524308, 0, 1, 524309, 0, 2, 524310, 0, 3, 655359, 0, 65537, 589824, 0, 65538, 589825, 0, 65539, 589826, 0, 65537, 589827, 0, 65538, 589828, 0, 65539, 589829, 0, 65537, 589830, 0, 65538, 589831, 0, 65539, 589832, 0, 65537, 589833, 0, 65538, 589834, 0, 65539, 589835, 0, 65537, 589836, 0, 65538, 589837, 0, 65539, 589838, 0, 65537, 589839, 0, 65538, 589840, 0, 65539, 589841, 0, 65537, 589842, 0, 65538, 589843, 0, 65539, 589844, 0, 65537, 589845, 0, 65538, 589846, 0, 65539, 720895, 0, 131073, 655360, 0, 131074, 655361, 0, 131075, 655362, 0, 131073, 655363, 0, 131074, 655364, 0, 131075, 655365, 0, 131073, 655366, 0, 131074, 655367, 0, 131075, 655368, 0, 131073, 655369, 0, 131074, 655370, 0, 131075, 655371, 0, 131073, 655372, 0, 131074, 655373, 0, 131075, 655374, 0, 131073, 655375, 0, 131074, 655376, 0, 131075, 655377, 0, 131073, 655378, 0, 131074, 655379, 0, 131075, 655380, 0, 131073, 655381, 0, 131074, 655382, 0, 131075, 786431, 0, 196609, 720896, 0, 196610, 720897, 0, 196611, 720898, 0, 196609, 720899, 0, 196610, 720900, 0, 196611, 720901, 0, 196609, 720902, 0, 196610, 720903, 0, 196611, 720904, 0, 196609, 720905, 0, 196610, 720906, 0, 196611, 720907, 0, 196609, 720908, 0, 196610, 720909, 0, 196611, 720910, 0, 196609, 720911, 0, 196610, 720912, 0, 196611, 720913, 0, 196609, 720914, 0, 196610, 720915, 0, 196611, 720916, 0, 196609, 720917, 0, 196610, 720918, 0, 196611, 851967, 0, 262145, 786432, 0, 262146, 786433, 0, 262147, 786434, 0, 262145, 786435, 0, 262146, 786436, 0, 262147, 786437, 0, 262145, 786438, 0, 262146, 786439, 0, 262147, 786440, 0, 262145, 786441, 0, 262146, 786442, 0, 262147, 786443, 0, 262145, 786444, 0, 262146, 786445, 0, 262147, 786446, 0, 262145, 786447, 0, 262146, 786448, 0, 262147, 786449, 0, 262145, 786450, 0, 262146, 786451, 0, 262147, 786452, 0, 262145, 786453, 0, 262146, 786454, 0, 262147 )
[node name="TileMap Foreground" parent="." index="2"]
tile_set = ExtResource( 2 )
collision_layer = 0
collision_mask = 0
tile_data = PoolIntArray( 524288, 0, 2, 524307, 0, 3 )
[node name="Hitbox_Component" parent="." index="4" instance=ExtResource( 3 )]
damage_amount = 10
[node name="ColorRect" type="ColorRect" parent="Hitbox_Component" index="0"]
margin_left = 208.0
margin_top = 41.0
margin_right = 218.0
margin_bottom = 50.0
color = Color( 1, 0, 0, 1 )
[node name="CollisionShape2D" type="CollisionShape2D" parent="Hitbox_Component" index="1"]
modulate = Color( 1, 0, 0, 1 )
position = Vector2( 213, 45 )
shape = SubResource( 1 )

View File

@ -1,17 +1,21 @@
[gd_scene load_steps=5 format=2]
[gd_scene load_steps=7 format=2]
[ext_resource path="res://src/templates/level_templates/LevelTemplate.tscn" type="PackedScene" id=1]
[ext_resource path="res://assets/levels/LegacyFantasy-High_Forest/tileset.tres" type="TileSet" id=2]
[ext_resource path="res://lib/components/Hitbox_Component.tscn" type="PackedScene" id=3]
[ext_resource path="res://src/Interactables/LevelTransition.tscn" type="PackedScene" id=4]
[sub_resource type="CircleShape2D" id=1]
radius = 5.09902
[sub_resource type="RectangleShape2D" id=2]
extents = Vector2( 4.5, 10 )
[node name="TestBox" instance=ExtResource( 1 )]
[node name="TileMap Collision" parent="." index="1"]
tile_set = ExtResource( 2 )
tile_data = PoolIntArray( 0, 4, 65536, 19, 4, 65536, 65536, 4, 65536, 65555, 4, 65536, 131072, 4, 65536, 131091, 4, 65536, 196608, 4, 65536, 196620, 2, 0, 196621, 2, 1, 196622, 2, 2, 196627, 4, 65536, 262144, 4, 0, 262156, 2, 65536, 262157, 2, 65537, 262158, 2, 65538, 262163, 4, 0, 327680, 4, 65536, 327699, 4, 65536, 393216, 4, 65536, 393235, 4, 65536, 458752, 4, 65536, 458771, 4, 65536, 589823, 0, 1, 524288, 4, 131072, 524289, 0, 3, 524290, 0, 1, 524291, 0, 2, 524292, 0, 3, 524293, 0, 1, 524294, 0, 2, 524295, 0, 3, 524296, 0, 1, 524297, 0, 2, 524298, 0, 3, 524299, 0, 1, 524300, 0, 2, 524301, 0, 3, 524302, 0, 1, 524303, 0, 2, 524304, 0, 3, 524305, 0, 1, 524306, 0, 2, 524307, 4, 131072, 524308, 0, 1, 524309, 0, 2, 524310, 0, 3, 655359, 0, 65537, 589824, 0, 65538, 589825, 0, 65539, 589826, 0, 65537, 589827, 0, 65538, 589828, 0, 65539, 589829, 0, 65537, 589830, 0, 65538, 589831, 0, 65539, 589832, 0, 65537, 589833, 0, 65538, 589834, 0, 65539, 589835, 0, 65537, 589836, 0, 65538, 589837, 0, 65539, 589838, 0, 65537, 589839, 0, 65538, 589840, 0, 65539, 589841, 0, 65537, 589842, 0, 65538, 589843, 0, 65539, 589844, 0, 65537, 589845, 0, 65538, 589846, 0, 65539, 720895, 0, 131073, 655360, 0, 131074, 655361, 0, 131075, 655362, 0, 131073, 655363, 0, 131074, 655364, 0, 131075, 655365, 0, 131073, 655366, 0, 131074, 655367, 0, 131075, 655368, 0, 131073, 655369, 0, 131074, 655370, 0, 131075, 655371, 0, 131073, 655372, 0, 131074, 655373, 0, 131075, 655374, 0, 131073, 655375, 0, 131074, 655376, 0, 131075, 655377, 0, 131073, 655378, 0, 131074, 655379, 0, 131075, 655380, 0, 131073, 655381, 0, 131074, 655382, 0, 131075, 786431, 0, 196609, 720896, 0, 196610, 720897, 0, 196611, 720898, 0, 196609, 720899, 0, 196610, 720900, 0, 196611, 720901, 0, 196609, 720902, 0, 196610, 720903, 0, 196611, 720904, 0, 196609, 720905, 0, 196610, 720906, 0, 196611, 720907, 0, 196609, 720908, 0, 196610, 720909, 0, 196611, 720910, 0, 196609, 720911, 0, 196610, 720912, 0, 196611, 720913, 0, 196609, 720914, 0, 196610, 720915, 0, 196611, 720916, 0, 196609, 720917, 0, 196610, 720918, 0, 196611, 851967, 0, 262145, 786432, 0, 262146, 786433, 0, 262147, 786434, 0, 262145, 786435, 0, 262146, 786436, 0, 262147, 786437, 0, 262145, 786438, 0, 262146, 786439, 0, 262147, 786440, 0, 262145, 786441, 0, 262146, 786442, 0, 262147, 786443, 0, 262145, 786444, 0, 262146, 786445, 0, 262147, 786446, 0, 262145, 786447, 0, 262146, 786448, 0, 262147, 786449, 0, 262145, 786450, 0, 262146, 786451, 0, 262147, 786452, 0, 262145, 786453, 0, 262146, 786454, 0, 262147 )
tile_data = PoolIntArray( 0, 4, 65536, 19, 4, 65536, 65536, 4, 65536, 65555, 4, 65536, 131072, 4, 65536, 131091, 4, 65536, 196608, 4, 65536, 196620, 2, 0, 196621, 2, 1, 196622, 2, 2, 196627, 4, 65536, 262144, 4, 0, 262156, 2, 65536, 262157, 2, 65537, 262158, 2, 65538, 262163, 4, 0, 327680, 4, 65536, 327699, 4, 65536, 393216, 4, 65536, 458752, 4, 65536, 589823, 0, 1, 524288, 4, 131072, 524289, 0, 3, 524290, 0, 1, 524291, 0, 2, 524292, 0, 3, 524293, 0, 1, 524294, 0, 2, 524295, 0, 3, 524296, 0, 1, 524297, 0, 2, 524298, 0, 3, 524299, 0, 1, 524300, 0, 2, 524301, 0, 3, 524302, 0, 1, 524303, 0, 2, 524304, 0, 3, 524305, 0, 1, 524306, 0, 2, 524308, 0, 1, 524309, 0, 2, 524310, 0, 3, 655359, 0, 65537, 589824, 0, 65538, 589825, 0, 65539, 589826, 0, 65537, 589827, 0, 65538, 589828, 0, 65539, 589829, 0, 65537, 589830, 0, 65538, 589831, 0, 65539, 589832, 0, 65537, 589833, 0, 65538, 589834, 0, 65539, 589835, 0, 65537, 589836, 0, 65538, 589837, 0, 65539, 589838, 0, 65537, 589839, 0, 65538, 589840, 0, 65539, 589841, 0, 65537, 589842, 0, 65538, 589843, 0, 65539, 589844, 0, 65537, 589845, 0, 65538, 589846, 0, 65539, 720895, 0, 131073, 655360, 0, 131074, 655361, 0, 131075, 655362, 0, 131073, 655363, 0, 131074, 655364, 0, 131075, 655365, 0, 131073, 655366, 0, 131074, 655367, 0, 131075, 655368, 0, 131073, 655369, 0, 131074, 655370, 0, 131075, 655371, 0, 131073, 655372, 0, 131074, 655373, 0, 131075, 655374, 0, 131073, 655375, 0, 131074, 655376, 0, 131075, 655377, 0, 131073, 655378, 0, 131074, 655379, 0, 131075, 655380, 0, 131073, 655381, 0, 131074, 655382, 0, 131075, 786431, 0, 196609, 720896, 0, 196610, 720897, 0, 196611, 720898, 0, 196609, 720899, 0, 196610, 720900, 0, 196611, 720901, 0, 196609, 720902, 0, 196610, 720903, 0, 196611, 720904, 0, 196609, 720905, 0, 196610, 720906, 0, 196611, 720907, 0, 196609, 720908, 0, 196610, 720909, 0, 196611, 720910, 0, 196609, 720911, 0, 196610, 720912, 0, 196611, 720913, 0, 196609, 720914, 0, 196610, 720915, 0, 196611, 720916, 0, 196609, 720917, 0, 196610, 720918, 0, 196611, 851967, 0, 262145, 786432, 0, 262146, 786433, 0, 262147, 786434, 0, 262145, 786435, 0, 262146, 786436, 0, 262147, 786437, 0, 262145, 786438, 0, 262146, 786439, 0, 262147, 786440, 0, 262145, 786441, 0, 262146, 786442, 0, 262147, 786443, 0, 262145, 786444, 0, 262146, 786445, 0, 262147, 786446, 0, 262145, 786447, 0, 262146, 786448, 0, 262147, 786449, 0, 262145, 786450, 0, 262146, 786451, 0, 262147, 786452, 0, 262145, 786453, 0, 262146, 786454, 0, 262147 )
[node name="TileMap Foreground" parent="." index="2"]
tile_set = ExtResource( 2 )
@ -33,3 +37,10 @@ color = Color( 1, 0, 0, 1 )
modulate = Color( 1, 0, 0, 1 )
position = Vector2( 268, 119 )
shape = SubResource( 1 )
[node name="LevelTransition" parent="." index="5" instance=ExtResource( 4 )]
[node name="CollisionShape2D" type="CollisionShape2D" parent="LevelTransition" index="0"]
modulate = Color( 1, 0, 1, 1 )
position = Vector2( 316, 121 )
shape = SubResource( 2 )