interior tiles and scene transitions

This commit is contained in:
2025-10-27 02:54:20 +01:00
parent eea9c18358
commit b36923a196
14 changed files with 196 additions and 82 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 849 B

View File

@@ -0,0 +1,40 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://ctr2whxnff2vn"
path="res://.godot/imported/main_house_interior_tileset.png-2d5b85e529c3039c8728b64174cd8c95.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/textures/tilemaps/main_house_interior_tileset.png"
dest_files=["res://.godot/imported/main_house_interior_tileset.png-2d5b85e529c3039c8728b64174cd8c95.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

View File

@@ -1,7 +1,44 @@
[gd_scene load_steps=2 format=3 uid="uid://cjbbslcx6vjjy"]
[gd_scene load_steps=5 format=3 uid="uid://cjbbslcx6vjjy"]
[ext_resource type="Script" uid="uid://b08q3lqbuoolb" path="res://scripts/autoloads/nodes/event_manager.gd" id="1_xplee"]
[sub_resource type="Animation" id="Animation_xplee"]
resource_name = "transition"
length = 0.5
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("ColorRect:self_modulate")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.5),
"transitions": PackedFloat32Array(0.5, 0.5),
"update": 0,
"values": [Color(1, 1, 1, 0), Color(1, 1, 1, 1)]
}
[sub_resource type="Animation" id="Animation_swnhv"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("ColorRect:self_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, 0)]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_gml0k"]
_data = {
&"RESET": SubResource("Animation_swnhv"),
&"transition": SubResource("Animation_xplee")
}
[node name="EventManager" type="CanvasLayer"]
script = ExtResource("1_xplee")
@@ -14,3 +51,8 @@ grow_horizontal = 2
grow_vertical = 2
mouse_filter = 2
color = Color(0, 0, 0, 1)
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
libraries = {
&"": SubResource("AnimationLibrary_gml0k")
}

View File

@@ -1,27 +1,27 @@
[gd_scene load_steps=6 format=3 uid="uid://cokphmh2g8wvs"]
[gd_scene load_steps=5 format=3 uid="uid://cokphmh2g8wvs"]
[ext_resource type="Texture2D" uid="uid://db4dctk13rgbm" path="res://assets/textures/spritesheets/houses.png" id="1_fltv6"]
[ext_resource type="PackedScene" uid="uid://h77hilgbces" path="res://scenes/interactables/interact_sceneswitch.tscn" id="2_0afuu"]
[ext_resource type="PackedScene" uid="uid://ccfdsdgaon63m" path="res://scenes/levels/home.tscn" id="3_0afuu"]
[sub_resource type="AtlasTexture" id="AtlasTexture_0db70"]
[sub_resource type="AtlasTexture" id="AtlasTexture_fltv6"]
atlas = ExtResource("1_fltv6")
region = Rect2(1, 4, 94, 89)
region = Rect2(161, 1, 158, 149)
[sub_resource type="RectangleShape2D" id="RectangleShape2D_0afuu"]
size = Vector2(90, 46)
size = Vector2(152.75, 80)
[node name="Home" type="StaticBody2D"]
[node name="Sprite2D" type="Sprite2D" parent="."]
texture = SubResource("AtlasTexture_0db70")
position = Vector2(-2, -28)
texture = SubResource("AtlasTexture_fltv6")
[node name="InteractSceneswitch" parent="." instance=ExtResource("2_0afuu")]
position = Vector2(0, 25)
scene = ExtResource("3_0afuu")
scene = "res://scenes/levels/home.tscn"
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
y_sort_enabled = true
position = Vector2(0, 18)
position = Vector2(-1.625, 1)
shape = SubResource("RectangleShape2D_0afuu")
debug_color = Color(0.8768643, 0.34231007, 0.046793222, 0.41960785)

View File

@@ -7,8 +7,9 @@ size = Vector2(32, 32)
[node name="Interactable" type="Area2D"]
collision_layer = 2
collision_mask = 0
script = ExtResource("1_56v82")
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
shape = SubResource("RectangleShape2D_ij5l6")
[connection signal="body_entered" from="." to="." method="_on_body_entered"]

View File

@@ -1,103 +1,111 @@
[gd_scene load_steps=6 format=4 uid="uid://ccfdsdgaon63m"]
[gd_scene load_steps=8 format=4 uid="uid://ccfdsdgaon63m"]
[ext_resource type="Texture2D" uid="uid://ctr2whxnff2vn" path="res://assets/textures/tilemaps/main_house_interior_tileset.png" id="1_2vl8h"]
[ext_resource type="PackedScene" uid="uid://dfbomt0l6b1o4" path="res://scenes/player.tscn" id="1_ikf4c"]
[ext_resource type="Texture2D" uid="uid://dve2b2glwitsw" path="res://assets/textures/tilemaps/grass_tilemap.png" id="1_q28r8"]
[ext_resource type="PackedScene" uid="uid://bsvy3yhylfoui" path="res://scenes/interactables/chair.tscn" id="3_2vl8h"]
[ext_resource type="PackedScene" uid="uid://h77hilgbces" path="res://scenes/interactables/interact_sceneswitch.tscn" id="4_snitx"]
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_2vl8h"]
texture = ExtResource("1_q28r8")
[sub_resource type="GDScript" id="GDScript_2vl8h"]
script/source = "extends Node2D
func _ready() -> void:
RenderingServer.set_default_clear_color(\"#0d0805\")
"
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_5uvba"]
texture = ExtResource("1_2vl8h")
texture_region_size = Vector2i(32, 32)
0:0/0 = 0
0:0/0/terrain_set = 0
0:0/0/physics_layer_0/polygon_0/points = PackedVector2Array(-16, 16, -16, -16, 16, -16, 16, 11, 2, 11, 2, 16)
0:0/0/terrains_peering_bit/bottom_right_corner = 0
1:0/0 = 0
1:0/0/terrain_set = 0
1:0/0/physics_layer_0/polygon_0/points = PackedVector2Array(-16, 11, -16, -16, 16, -16, 16, 11)
1:0/0/terrains_peering_bit/bottom_right_corner = 0
1:0/0/terrains_peering_bit/bottom_side = 0
1:0/0/terrains_peering_bit/bottom_left_corner = 0
2:0/0 = 0
3:0/0 = 0
4:0/0 = 0
5:0/0 = 0
6:0/0 = 0
7:0/0 = 0
2:0/0/terrain_set = 0
2:0/0/physics_layer_0/polygon_0/points = PackedVector2Array(-16, 11, -16, -16, 16, -16, 16, 16, -2, 16, -2, 11)
2:0/0/terrains_peering_bit/bottom_left_corner = 0
0:1/0 = 0
0:1/0/terrain_set = 0
0:1/0/physics_layer_0/polygon_0/points = PackedVector2Array(2, -16, 2, 16, -16, 16, -16, -16)
0:1/0/terrains_peering_bit/right_side = 0
0:1/0/terrains_peering_bit/bottom_right_corner = 0
0:1/0/terrains_peering_bit/top_right_corner = 0
1:1/0 = 0
1:1/0/terrain_set = 0
1:1/0/terrain = 0
1:1/0/terrains_peering_bit/right_side = 0
1:1/0/terrains_peering_bit/bottom_right_corner = 0
1:1/0/terrains_peering_bit/bottom_side = 0
1:1/0/terrains_peering_bit/bottom_left_corner = 0
1:1/0/terrains_peering_bit/left_side = 0
1:1/0/terrains_peering_bit/top_left_corner = 0
1:1/0/terrains_peering_bit/top_side = 0
1:1/0/terrains_peering_bit/top_right_corner = 0
2:1/0 = 0
3:1/0 = 0
4:1/0 = 0
5:1/0 = 0
6:1/0 = 0
7:1/0 = 0
2:1/0/terrain_set = 0
2:1/0/physics_layer_0/polygon_0/points = PackedVector2Array(16, -16, 16, 16, -2, 16, -2, -16)
2:1/0/terrains_peering_bit/bottom_left_corner = 0
2:1/0/terrains_peering_bit/left_side = 0
2:1/0/terrains_peering_bit/top_left_corner = 0
0:2/0 = 0
0:2/0/terrain_set = 0
0:2/0/physics_layer_0/polygon_0/points = PackedVector2Array(2, -16, 2, -8, 16, -8, 16, 16, -16, 16, -16, -16)
0:2/0/terrains_peering_bit/top_right_corner = 0
1:2/0 = 0
1:2/0/terrain_set = 0
1:2/0/physics_layer_0/polygon_0/points = PackedVector2Array(-16, 16, -16, -8, 16, -8, 16, 16)
1:2/0/terrains_peering_bit/top_left_corner = 0
1:2/0/terrains_peering_bit/top_side = 0
1:2/0/terrains_peering_bit/top_right_corner = 0
2:2/0 = 0
3:2/0 = 0
4:2/0 = 0
5:2/0 = 0
6:2/0 = 0
7:2/0 = 0
2:2/0/terrain_set = 0
2:2/0/physics_layer_0/polygon_0/points = PackedVector2Array(-2, -8, -2, -16, 16, -16, 16, 16, -16, 16, -16, -8)
2:2/0/terrains_peering_bit/top_left_corner = 0
0:3/0 = 0
1:3/0 = 0
2:3/0 = 0
3:3/0 = 0
4:3/0 = 0
5:3/0 = 0
6:3/0 = 0
7:3/0 = 0
0:4/0 = 0
1:4/0 = 0
2:4/0 = 0
3:4/0 = 0
4:4/0 = 0
5:4/0 = 0
6:4/0 = 0
7:4/0 = 0
0:5/0 = 0
1:5/0 = 0
2:5/0 = 0
3:5/0 = 0
4:5/0 = 0
5:5/0 = 0
6:5/0 = 0
7:5/0 = 0
0:6/0 = 0
1:6/0 = 0
2:6/0 = 0
3:6/0 = 0
4:6/0 = 0
5:6/0 = 0
6:6/0 = 0
7:6/0 = 0
0:7/0 = 0
1:7/0 = 0
2:7/0 = 0
3:7/0 = 0
4:7/0 = 0
5:7/0 = 0
6:7/0 = 0
7:7/0 = 0
0:3/0/terrain_set = 0
0:3/0/physics_layer_0/polygon_0/points = PackedVector2Array(-16, 11, -16, -16, 16, -16, 16, 11)
[sub_resource type="TileSet" id="TileSet_ikf4c"]
tile_size = Vector2i(32, 32)
sources/0 = SubResource("TileSetAtlasSource_2vl8h")
physics_layer_0/collision_layer = 1
terrain_set_0/mode = 0
terrain_set_0/terrain_0/name = "Ground 0"
terrain_set_0/terrain_0/color = Color(0.5, 0.34375, 0.25, 1)
sources/1 = SubResource("TileSetAtlasSource_5uvba")
[node name="Home" type="Node2D"]
script = SubResource("GDScript_2vl8h")
[node name="TileMapLayer" type="TileMapLayer" parent="."]
tile_map_data = PackedByteArray("AAACAAIAAAAGAAIAAAACAAMAAAAGAAIAAAACAAUAAAAGAAIAAAACAAYAAAAGAAIAAAACAAcAAAAGAAIAAAADAAIAAAAGAAIAAAADAAMAAAAGAAIAAAADAAUAAAAGAAIAAAADAAYAAAAGAAIAAAADAAcAAAAGAAIAAAAEAAIAAAAGAAIAAAAEAAMAAAAGAAIAAAAEAAUAAAAGAAIAAAAEAAYAAAAGAAIAAAAEAAcAAAAGAAIAAAAFAAIAAAAGAAIAAAAFAAUAAAAGAAIAAAAFAAYAAAAGAAIAAAAFAAcAAAAGAAIAAAAGAAIAAAAGAAIAAAAGAAMAAAAGAAIAAAAGAAUAAAAGAAIAAAAGAAYAAAAGAAIAAAAGAAcAAAAGAAIAAAAHAAIAAAAGAAIAAAAHAAMAAAAGAAIAAAAHAAQAAAAGAAIAAAAHAAUAAAAGAAIAAAAHAAYAAAAGAAIAAAAHAAcAAAAGAAIAAAAIAAIAAAAGAAIAAAAIAAMAAAAGAAIAAAAIAAQAAAAGAAIAAAAIAAUAAAAGAAIAAAAIAAYAAAAGAAIAAAAIAAcAAAAGAAIAAAACAAQAAAAGAAIAAAADAAQAAAAGAAIAAAAEAAQAAAAGAAIAAAAFAAQAAAAGAAIAAAAGAAQAAAAGAAIAAAAFAAMAAAAGAAIAAAA=")
tile_map_data = PackedByteArray("AAAHAAYAAQABAAEAAAAHAAUAAQABAAEAAAAHAAQAAQABAAEAAAAHAAMAAQABAAEAAAAGAAYAAQABAAEAAAAGAAUAAQABAAEAAAAGAAQAAQABAAEAAAAGAAMAAQABAAEAAAAFAAYAAQABAAEAAAAFAAUAAQABAAEAAAAFAAQAAQABAAEAAAAFAAMAAQABAAEAAAAEAAYAAQABAAEAAAAEAAUAAQABAAEAAAAEAAQAAQABAAEAAAAEAAMAAQABAAEAAAADAAYAAQABAAEAAAADAAUAAQABAAEAAAADAAQAAQABAAEAAAADAAMAAQABAAEAAAACAAQAAQAAAAEAAAACAAMAAQAAAAEAAAACAAIAAQAAAAAAAAADAAIAAQABAAAAAAAEAAIAAQABAAAAAAACAAUAAQAAAAEAAAACAAYAAQAAAAEAAAAEAAcAAQABAAIAAAADAAcAAQABAAIAAAACAAcAAQAAAAIAAAAFAAIAAQAAAAMAAAAGAAIAAQABAAAAAAAGAAcAAQABAAIAAAAHAAIAAQABAAAAAAAHAAcAAQABAAIAAAAIAAMAAQACAAEAAAAIAAQAAQACAAEAAAAIAAIAAQACAAAAAAAIAAUAAQACAAEAAAAIAAYAAQACAAEAAAAIAAcAAQACAAIAAAAFAAcAAQABAAEAAAA=")
tile_set = SubResource("TileSet_ikf4c")
[node name="Chair" parent="." instance=ExtResource("3_2vl8h")]
position = Vector2(144, 144)
position = Vector2(144, 175)
direction = 1
[node name="Chair2" parent="." instance=ExtResource("3_2vl8h")]
position = Vector2(208, 144)
position = Vector2(208, 175)
direction = 0
[node name="Chair3" parent="." instance=ExtResource("3_2vl8h")]
position = Vector2(176, 112)
position = Vector2(176, 143)
[node name="Player" parent="." node_paths=PackedStringArray("tilemap") instance=ExtResource("1_ikf4c")]
position = Vector2(180, 183)
position = Vector2(176, 235)
tilemap = NodePath("../TileMapLayer")
[node name="AnimatedSprite2D" parent="Player" index="0"]
animation = &"up"
[node name="InteractSceneswitch" parent="." instance=ExtResource("4_snitx")]
position = Vector2(176, 268)
scene = "res://scenes/levels/hood.tscn"
auto_interact = true
[editable path="Player"]

View File

@@ -230,5 +230,6 @@ tile_set = SubResource("TileSet_5rqdi")
rendering_quadrant_size = 32
physics_quadrant_size = 32
[node name="Player" parent="." instance=ExtResource("1_ge1l5")]
position = Vector2(110, 38)
[node name="Player" parent="." node_paths=PackedStringArray("tilemap") instance=ExtResource("1_ge1l5")]
position = Vector2(112, 51)
tilemap = NodePath("../Ground")

View File

@@ -106,7 +106,7 @@ animations = [{
}]
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_3vyb7"]
radius = 3.0
radius = 6.0
height = 14.0
[node name="Player" type="CharacterBody2D"]
@@ -119,7 +119,7 @@ sprite_frames = SubResource("SpriteFrames_qhqgy")
animation = &"down"
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2(0, 13)
position = Vector2(0, 10)
rotation = -1.5707964
shape = SubResource("CapsuleShape2D_3vyb7")

View File

@@ -3,14 +3,19 @@ extends Node
var player_free: bool = true
var player: Player
@onready var animation_player: AnimationPlayer = $AnimationPlayer
enum Events { NONE, PUMPKIN_CARVE, OUTSIDE_NORMAL }
var current_event: Events = Events.NONE
func transition_start() -> void:
pass
player_free = false
animation_player.play("transition")
func transition_end() -> void:
pass
animation_player.play_backwards("transition")
await animation_player.animation_finished
player_free = true
func run_event(event: Events, player_postion: Vector2 = Vector2.ZERO):
current_event = event
@@ -23,3 +28,10 @@ func run_event(event: Events, player_postion: Vector2 = Vector2.ZERO):
await get_tree().scene_changed
player.animated_sprite.animation = "sit" # should be replaced with chair interaction trigger
transition_end()
func transition_scene_file(scene: String) -> void:
if !animation_player.is_playing():
transition_start()
get_tree().call_deferred("change_scene_to_file", scene)
await get_tree().scene_changed
transition_end()

View File

@@ -3,4 +3,11 @@ extends Area2D
signal interacted(player: Player)
@export var auto_interact: bool = false
func interact(player: Player) -> void: interacted.emit(player)
func _on_body_entered(body: Node2D) -> void:
if auto_interact && body is Player:
interacted.emit(body as Player)

View File

@@ -1,6 +1,9 @@
extends Node2D
@export var scene: PackedScene
@export_file_path("*.tscn") var scene: String
@export var auto_interact: bool = false
func _ready() -> void: $Interactable.auto_interact = auto_interact
func _on_interacted(_player: Player) -> void:
get_tree().change_scene_to_packed(scene)
EventManager.transition_scene_file(scene)