This commit is contained in:
2025-10-26 02:57:00 +02:00
parent 1fe75a871e
commit eea9c18358
18 changed files with 216 additions and 41 deletions

Binary file not shown.

BIN
aseprite/hood_player.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 914 B

View File

@@ -0,0 +1,40 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://duxnw68jxoauh"
path="res://.godot/imported/table_chair.png-e74f8b9bc13823f10c8b29c28e9a3a90.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/textures/spritesheets/table_chair.png"
dest_files=["res://.godot/imported/table_chair.png-e74f8b9bc13823f10c8b29c28e9a3a90.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: 481 B

After

Width:  |  Height:  |  Size: 8.3 KiB

View File

@@ -0,0 +1,30 @@
[gd_scene load_steps=6 format=3 uid="uid://bsvy3yhylfoui"]
[ext_resource type="Script" uid="uid://c1xp6fm2mh83g" path="res://scripts/interactables/chair.gd" id="1_asrj3"]
[ext_resource type="PackedScene" uid="uid://n24dhbpflcec" path="res://scenes/interactable.tscn" id="3_dblhm"]
[sub_resource type="CompressedTexture2D" id="CompressedTexture2D_o804i"]
load_path = "res://.godot/imported/table_chair.png-e74f8b9bc13823f10c8b29c28e9a3a90.ctex"
[sub_resource type="AtlasTexture" id="AtlasTexture_asrj3"]
resource_local_to_scene = true
atlas = SubResource("CompressedTexture2D_o804i")
region = Rect2(32, 0, 32, 32)
[sub_resource type="RectangleShape2D" id="RectangleShape2D_w04lg"]
size = Vector2(14, 18)
[node name="Chair" type="StaticBody2D"]
script = ExtResource("1_asrj3")
direction = 2
[node name="Sprite2D" type="Sprite2D" parent="."]
texture = SubResource("AtlasTexture_asrj3")
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2(1, 6)
shape = SubResource("RectangleShape2D_w04lg")
[node name="Interactable" parent="." instance=ExtResource("3_dblhm")]
[connection signal="interacted" from="Interactable" to="." method="_on_interacted"]

View File

@@ -8,4 +8,4 @@ script = ExtResource("1_f3ssn")
[node name="Interactable" parent="." instance=ExtResource("2_43o6g")]
[connection signal="interacted" from="Interactable" to="." method="_on_interactable_interacted"]
[connection signal="interacted" from="Interactable" to="." method="_on_interacted"]

View File

@@ -1,10 +1,12 @@
[gd_scene load_steps=5 format=4 uid="uid://ccfdsdgaon63m"]
[gd_scene load_steps=6 format=4 uid="uid://ccfdsdgaon63m"]
[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"]
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_2vl8h"]
texture = ExtResource("1_q28r8")
texture_region_size = Vector2i(32, 32)
0:0/0 = 0
1:0/0 = 0
2:0/0 = 0
@@ -71,14 +73,31 @@ texture = ExtResource("1_q28r8")
7:7/0 = 0
[sub_resource type="TileSet" id="TileSet_ikf4c"]
sources/1 = SubResource("TileSetAtlasSource_2vl8h")
tile_size = Vector2i(32, 32)
sources/0 = SubResource("TileSetAtlasSource_2vl8h")
[node name="Home" type="Node2D"]
[node name="TileMapLayer" type="TileMapLayer" parent="."]
tile_map_data = PackedByteArray("AAAGAAMAAQACAAMAAAAGAAQAAQACAAMAAAAGAAUAAQACAAMAAAAGAAYAAQACAAMAAAAGAAcAAQACAAMAAAAGAAgAAQACAAMAAAAGAAkAAQACAAMAAAAGAAoAAQACAAMAAAAGAAsAAQACAAMAAAAGAAwAAQACAAMAAAAHAAMAAQACAAMAAAAHAAQAAQACAAMAAAAHAAUAAQACAAMAAAAHAAYAAQACAAMAAAAHAAcAAQACAAMAAAAHAAgAAQACAAMAAAAHAAkAAQACAAMAAAAHAAoAAQACAAMAAAAHAAsAAQACAAMAAAAHAAwAAQACAAMAAAAIAAMAAQACAAMAAAAIAAQAAQACAAMAAAAIAAUAAQACAAMAAAAIAAYAAQACAAMAAAAIAAcAAQACAAMAAAAIAAgAAQACAAMAAAAIAAkAAQACAAMAAAAIAAoAAQACAAMAAAAIAAsAAQACAAMAAAAIAAwAAQACAAMAAAAJAAMAAQACAAMAAAAJAAQAAQACAAMAAAAJAAUAAQACAAMAAAAJAAYAAQACAAMAAAAJAAcAAQACAAMAAAAJAAgAAQACAAMAAAAJAAkAAQACAAMAAAAJAAoAAQACAAMAAAAJAAsAAQACAAMAAAAJAAwAAQACAAMAAAAKAAMAAQACAAMAAAAKAAQAAQACAAMAAAAKAAUAAQACAAMAAAAKAAYAAQACAAMAAAAKAAcAAQACAAMAAAAKAAgAAQACAAMAAAAKAAkAAQACAAMAAAAKAAoAAQACAAMAAAAKAAsAAQACAAMAAAAKAAwAAQACAAMAAAALAAMAAQACAAMAAAALAAQAAQACAAMAAAALAAUAAQACAAMAAAALAAYAAQACAAMAAAALAAcAAQACAAMAAAALAAgAAQACAAMAAAALAAkAAQACAAMAAAALAAoAAQACAAMAAAALAAsAAQACAAMAAAALAAwAAQACAAMAAAAMAAMAAQACAAMAAAAMAAQAAQACAAMAAAAMAAUAAQACAAMAAAAMAAYAAQACAAMAA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AAIAAAAGAAIAAAAIAAMAAAAGAAIAAAAIAAQAAAAGAAIAAAAIAAUAAAAGAAIAAAAIAAYAAAAGAAIAAAAIAAcAAAAGAAIAAAACAAQAAAAGAAIAAAADAAQAAAAGAAIAAAAEAAQAAAAGAAIAAAAFAAQAAAAGAAIAAAAGAAQAAAAGAAIAAAAFAAMAAAAGAAIAAAA=")
tile_set = SubResource("TileSet_ikf4c")
[node name="Chair" parent="." instance=ExtResource("3_2vl8h")]
position = Vector2(144, 144)
direction = 1
[node name="Chair2" parent="." instance=ExtResource("3_2vl8h")]
position = Vector2(208, 144)
direction = 0
[node name="Chair3" parent="." instance=ExtResource("3_2vl8h")]
position = Vector2(176, 112)
[node name="Player" parent="." node_paths=PackedStringArray("tilemap") instance=ExtResource("1_ikf4c")]
position = Vector2(180, 183)
tilemap = NodePath("../TileMapLayer")
[node name="AnimatedSprite2D" parent="Player" index="0"]
animation = &"up"
[editable path="Player"]

File diff suppressed because one or more lines are too long

View File

@@ -1,43 +1,47 @@
[gd_scene load_steps=14 format=3 uid="uid://dfbomt0l6b1o4"]
[gd_scene load_steps=15 format=3 uid="uid://dfbomt0l6b1o4"]
[ext_resource type="Script" uid="uid://dxvslwwnnlosy" path="res://scripts/player.gd" id="1_3vyb7"]
[ext_resource type="Texture2D" uid="uid://c12v1hnrbfjr4" path="res://assets/textures/spritesheets/hood_player.png" id="2_g2els"]
[sub_resource type="AtlasTexture" id="AtlasTexture_g2els"]
atlas = ExtResource("2_g2els")
region = Rect2(0, 0, 33, 33)
region = Rect2(0, 0, 32, 32)
[sub_resource type="AtlasTexture" id="AtlasTexture_qhqgy"]
atlas = ExtResource("2_g2els")
region = Rect2(34, 0, 33, 33)
region = Rect2(32, 0, 32, 32)
[sub_resource type="AtlasTexture" id="AtlasTexture_dqkch"]
atlas = ExtResource("2_g2els")
region = Rect2(68, 0, 33, 33)
region = Rect2(64, 0, 32, 32)
[sub_resource type="AtlasTexture" id="AtlasTexture_qlg0r"]
atlas = ExtResource("2_g2els")
region = Rect2(0, 34, 33, 33)
region = Rect2(0, 32, 32, 32)
[sub_resource type="AtlasTexture" id="AtlasTexture_tuyoq"]
atlas = ExtResource("2_g2els")
region = Rect2(34, 34, 33, 33)
region = Rect2(32, 32, 32, 32)
[sub_resource type="AtlasTexture" id="AtlasTexture_fjrip"]
atlas = ExtResource("2_g2els")
region = Rect2(68, 34, 33, 33)
region = Rect2(64, 32, 32, 32)
[sub_resource type="AtlasTexture" id="AtlasTexture_smehm"]
atlas = ExtResource("2_g2els")
region = Rect2(0, 68, 33, 33)
region = Rect2(0, 96, 32, 32)
[sub_resource type="AtlasTexture" id="AtlasTexture_ur7pv"]
atlas = ExtResource("2_g2els")
region = Rect2(34, 68, 33, 33)
region = Rect2(0, 64, 32, 32)
[sub_resource type="AtlasTexture" id="AtlasTexture_y4r1p"]
atlas = ExtResource("2_g2els")
region = Rect2(68, 68, 33, 33)
region = Rect2(32, 64, 32, 32)
[sub_resource type="AtlasTexture" id="AtlasTexture_d2wvv"]
atlas = ExtResource("2_g2els")
region = Rect2(64, 64, 32, 32)
[sub_resource type="SpriteFrames" id="SpriteFrames_qhqgy"]
animations = [{
@@ -78,15 +82,23 @@ animations = [{
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_smehm")
}],
"loop": true,
"name": &"sit",
"speed": 5.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_ur7pv")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_y4r1p")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_ur7pv")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_smehm")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_y4r1p")
"texture": SubResource("AtlasTexture_d2wvv")
}],
"loop": true,
"name": &"up",

View File

@@ -20,5 +20,6 @@ func run_event(event: Events, player_postion: Vector2 = Vector2.ZERO):
match event:
Events.PUMPKIN_CARVE:
get_tree().change_scene_to_file("uid://ccfdsdgaon63m") # scenes/levels/home.tscn
pass
await get_tree().scene_changed
player.animated_sprite.animation = "sit" # should be replaced with chair interaction trigger
transition_end()

View File

@@ -1,6 +1,6 @@
class_name Interactable
extends Area2D
signal interacted
signal interacted(player: Player)
func interact() -> void: interacted.emit()
func interact(player: Player) -> void: interacted.emit(player)

View File

@@ -0,0 +1,62 @@
@tool
extends StaticBody2D
enum Direction { LEFT, RIGHT, FRONT }
@onready var sprite: Sprite2D = $Sprite2D
const SEAT_HEIGHT_OFFSET := 8
var player: Player
var input_released: bool = true
var move_input: Vector2 = Vector2.ZERO
@export var direction: Direction = Direction.RIGHT:
set(value):
direction = value
flip_chair()
func _ready() -> void:
flip_chair()
func flip_chair() -> void:
if !sprite:
return
var atlas_tex := sprite.texture as AtlasTexture
match direction:
Direction.LEFT:
atlas_tex.region.position.x = 32
sprite.flip_h = true
Direction.RIGHT:
atlas_tex.region.position.x = 32
sprite.flip_h = false
Direction.FRONT:
atlas_tex.region.position.x = -3
sprite.flip_h = false
func _on_interacted(p_player: Player) -> void:
if player:
unmount()
else:
player = p_player
input_released = move_input.length() == 0
player.animated_sprite.animation = "sit"
player.animated_sprite.flip_h = direction == Direction.LEFT
player.position = Vector2(position.x, position.y - SEAT_HEIGHT_OFFSET)
func _process(_delta: float) -> void:
if player:
move_input = Input.get_vector("move_left","move_right","move_up","move_down")
if move_input.length() == 0:
input_released = true
elif input_released:
unmount()
func unmount() -> void:
if direction == Direction.FRONT:
player.position = Vector2(position.x -16, position.y)
else:
player.position = Vector2(position.x, position.y + 8)
player.animated_sprite.animation = "down"
player = null
input_released = true

View File

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

View File

@@ -2,5 +2,5 @@ extends Node2D
@export var scene: PackedScene
func _on_interactable_interacted() -> void:
func _on_interacted(_player: Player) -> void:
get_tree().change_scene_to_packed(scene)

View File

@@ -12,6 +12,7 @@ const RAYCAST_RAGE: int = 32
@export var tilemap: TileMapLayer
var tilesize: int = 32
var position_limit_rect: Rect2
const STILL_POSITIONS: Array[String] = ["sit", "hand_down", "hand_side", "hand_up"]
func _ready() -> void:
EventManager.player = self
@@ -36,10 +37,10 @@ func _ready() -> void:
func _process(_delta: float) -> void:
if Input.is_action_just_pressed("interact") && raycast.is_colliding() && raycast.get_collider() is Interactable:
var interactable: Interactable = raycast.get_collider()
interactable.interact()
interactable.interact(self)
func _physics_process(delta: float) -> void:
if EventManager.player_free:
if !STILL_POSITIONS.has(animated_sprite.animation) && EventManager.player_free:
var input := Input.get_vector("move_left", "move_right", "move_up", "move_down").normalized()
var raycast_input := Vector2.ZERO