This commit is contained in:
2025-10-28 02:22:59 +01:00
parent bfd653c136
commit f6fe381551
17 changed files with 647 additions and 157 deletions

BIN
aseprite/heart.aseprite Normal file

Binary file not shown.

BIN
aseprite/heart.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 341 B

Binary file not shown.

BIN
aseprite/normal_player.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

BIN
aseprite/ui.aseprite Normal file

Binary file not shown.

BIN
aseprite/ui.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 832 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 914 B

After

Width:  |  Height:  |  Size: 678 B

View File

@@ -9,7 +9,7 @@ load_path = "res://.godot/imported/table_chair.png-e74f8b9bc13823f10c8b29c28e9a3
[sub_resource type="AtlasTexture" id="AtlasTexture_asrj3"]
resource_local_to_scene = true
atlas = SubResource("CompressedTexture2D_o804i")
region = Rect2(32, 0, 32, 32)
region = Rect2(-3, 0, 32, 32)
[sub_resource type="RectangleShape2D" id="RectangleShape2D_w04lg"]
size = Vector2(14, 18)

View File

@@ -1,7 +1,8 @@
[gd_scene load_steps=8 format=4 uid="uid://ccfdsdgaon63m"]
[gd_scene load_steps=12 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://duxnw68jxoauh" path="res://assets/textures/spritesheets/table_chair.png" id="1_snitx"]
[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"]
@@ -16,6 +17,20 @@ func _ready() -> void:
RenderingServer.set_default_clear_color(\"#0d0805\")
"
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_yskkl"]
texture = ExtResource("1_snitx")
texture_region_size = Vector2i(32, 32)
0:0/0 = 0
1:0/0 = 0
0:1/0 = 0
0:1/0/physics_layer_0/polygon_0/points = PackedVector2Array(-12, -4, 16, -4, 16, 16, -12, 16)
1:1/0 = 0
1:1/0/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -4, 12, -4, 12, 16, -16, 16)
0:2/0 = 0
0:2/0/physics_layer_0/polygon_0/points = PackedVector2Array(-11.5, -16, 16, -16, 16, -7, -2, -7, -2, 7, -8, 7)
1:2/0 = 0
1:2/0/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, 12, -16, 12, -7.5, 9, 7, 2, 7, 2, -7, -16, -7)
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_5uvba"]
texture = ExtResource("1_2vl8h")
texture_region_size = Vector2i(32, 32)
@@ -81,26 +96,63 @@ 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")
sources/0 = SubResource("TileSetAtlasSource_yskkl")
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_d1b6h"]
texture = ExtResource("1_snitx")
texture_region_size = Vector2i(32, 32)
0:0/0 = 0
1:0/0 = 0
0:1/0 = 0
0:1/0/physics_layer_0/polygon_0/points = PackedVector2Array(-12, -4, 16, -4, 16, 16, -12, 16)
1:1/0 = 0
1:1/0/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -4, 12, -4, 12, 16, -16, 16)
0:2/0 = 0
0:2/0/physics_layer_0/polygon_0/points = PackedVector2Array(-11.5, -16, 16, -16, 16, -7, -2, -7, -2, 7, -8, 7)
1:2/0 = 0
1:2/0/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, 12, -16, 12, -7.5, 9, 7, 2, 7, 2, -7, -16, -7)
[sub_resource type="TileSet" id="TileSet_cchwu"]
tile_size = Vector2i(32, 32)
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/0 = SubResource("TileSetAtlasSource_d1b6h")
[node name="Home" type="Node2D"]
y_sort_enabled = true
script = SubResource("GDScript_2vl8h")
[node name="TileMapLayer" type="TileMapLayer" parent="."]
tile_map_data = PackedByteArray("AAAHAAYAAQABAAEAAAAHAAUAAQABAAEAAAAHAAQAAQABAAEAAAAHAAMAAQABAAEAAAAGAAYAAQABAAEAAAAGAAUAAQABAAEAAAAGAAQAAQABAAEAAAAGAAMAAQABAAEAAAAFAAYAAQABAAEAAAAFAAUAAQABAAEAAAAFAAQAAQABAAEAAAAFAAMAAQABAAEAAAAEAAYAAQABAAEAAAAEAAUAAQABAAEAAAAEAAQAAQABAAEAAAAEAAMAAQABAAEAAAADAAYAAQABAAEAAAADAAUAAQABAAEAAAADAAQAAQABAAEAAAADAAMAAQABAAEAAAACAAQAAQAAAAEAAAACAAMAAQAAAAEAAAACAAIAAQAAAAAAAAADAAIAAQABAAAAAAAEAAIAAQABAAAAAAACAAUAAQAAAAEAAAACAAYAAQAAAAEAAAAEAAcAAQABAAIAAAADAAcAAQABAAIAAAACAAcAAQAAAAIAAAAFAAIAAQAAAAMAAAAGAAIAAQABAAAAAAAGAAcAAQABAAIAAAAHAAIAAQABAAAAAAAHAAcAAQABAAIAAAAIAAMAAQACAAEAAAAIAAQAAQACAAEAAAAIAAIAAQACAAAAAAAIAAUAAQACAAEAAAAIAAYAAQACAAEAAAAIAAcAAQACAAIAAAAFAAcAAQABAAEAAAA=")
tile_set = SubResource("TileSet_ikf4c")
[node name="TileMapLayer2" type="TileMapLayer" parent="."]
y_sort_enabled = true
tile_map_data = PackedByteArray("AAAGAAUAAAABAAEAAAAGAAYAAAABAAIAAAAFAAYAAAAAAAIAAAAFAAUAAAAAAAEAAAA=")
tile_set = SubResource("TileSet_cchwu")
[node name="Chair" parent="." instance=ExtResource("3_2vl8h")]
position = Vector2(144, 175)
y_sort_enabled = true
position = Vector2(155, 191)
direction = 1
[node name="Chair2" parent="." instance=ExtResource("3_2vl8h")]
position = Vector2(208, 175)
y_sort_enabled = true
position = Vector2(229, 191)
direction = 0
[node name="Chair3" parent="." instance=ExtResource("3_2vl8h")]
position = Vector2(176, 143)
y_sort_enabled = true
position = Vector2(173, 166)
[node name="Chair4" parent="." instance=ExtResource("3_2vl8h")]
y_sort_enabled = true
position = Vector2(205, 166)
[node name="Player" parent="." node_paths=PackedStringArray("tilemap") instance=ExtResource("1_ikf4c")]
y_sort_enabled = true
position = Vector2(176, 235)
tilemap = NodePath("../TileMapLayer")

File diff suppressed because one or more lines are too long

View File

@@ -1,11 +1,22 @@
[gd_scene load_steps=5 format=3 uid="uid://dh8wt018qxj2y"]
[gd_scene load_steps=9 format=3 uid="uid://dh8wt018qxj2y"]
[ext_resource type="Script" uid="uid://b5c8ov4lhocb8" path="res://scripts/menus/pumpkin_carve.gd" id="1_vvdcc"]
[ext_resource type="Texture2D" uid="uid://cb8q0hsocixew" path="res://assets/textures/pumpkin_inner.png" id="2_fcp78"]
[ext_resource type="Texture2D" uid="uid://dk62sk18o0jhp" path="res://assets/textures/pumpkin_outer.png" id="3_0qx04"]
[ext_resource type="Texture2D" uid="uid://cfsvkp6w82tgh" path="res://assets/textures/1bit 16px icons part-2.png" id="4_0qx04"]
[sub_resource type="ImageTexture" id="ImageTexture_vvdcc"]
[sub_resource type="InputEventAction" id="InputEventAction_0qx04"]
action = &"ui_undo"
[sub_resource type="Shortcut" id="Shortcut_wfn45"]
events = [SubResource("InputEventAction_0qx04")]
[sub_resource type="AtlasTexture" id="AtlasTexture_wfn45"]
atlas = ExtResource("4_0qx04")
region = Rect2(346, 130, 12, 11)
[node name="PumpkinCarve" type="Control"]
layout_mode = 3
anchors_preset = 15
@@ -22,7 +33,7 @@ anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
color = Color(0, 0, 0, 0.2784314)
color = Color(0, 0, 0, 0.627451)
[node name="Background" type="TextureRect" parent="."]
layout_mode = 1
@@ -68,3 +79,22 @@ offset_bottom = 80.0
grow_horizontal = 2
grow_vertical = 2
texture = ExtResource("3_0qx04")
[node name="UndoButton" type="Button" parent="."]
layout_mode = 1
anchors_preset = 3
anchor_left = 1.0
anchor_top = 1.0
anchor_right = 1.0
anchor_bottom = 1.0
offset_left = -44.0
offset_top = -44.0
offset_right = -24.0
offset_bottom = -25.0
grow_horizontal = 0
grow_vertical = 0
tooltip_text = "Undo"
shortcut = SubResource("Shortcut_wfn45")
icon = SubResource("AtlasTexture_wfn45")
[connection signal="pressed" from="UndoButton" to="." method="_on_undo_button_pressed"]

View File

@@ -16,15 +16,16 @@ func transition_end() -> void:
func run_event(event: Events, player_postion: Vector2 = Vector2.ZERO):
current_event = event
transition_start()
if player != null && player_postion != Vector2.ZERO:
player.position = player_postion
match event:
Events.PUMPKIN_CARVE:
player_free = false
get_tree().change_scene_to_file("uid://ccfdsdgaon63m") # scenes/levels/home.tscn
transition_end()
transition_scene_file("uid://ccfdsdgaon63m") # scenes/levels/home.tscn
await get_tree().scene_changed
await get_tree().create_timer(2).timeout
var pumpkin_carve: Control = preload("res://scenes/menus/pumpkin_carve.tscn").instantiate()
add_child(pumpkin_carve)
func transition_scene_file(scene: String) -> void:
if !animation_player.is_playing():

View File

@@ -5,7 +5,9 @@ signal interacted(player: Player)
@export var auto_interact: bool = false
func interact(player: Player) -> void: interacted.emit(player)
func interact(player: Player) -> void:
if !auto_interact:
interacted.emit(player)
func _on_body_entered(body: Node2D) -> void:

View File

@@ -36,7 +36,9 @@ func _on_interacted(p_player: Player) -> void:
if player:
unmount()
else:
y_sort_enabled = false
player = p_player
player.z_index = 2
input_released = move_input.length() == 0
player.animated_sprite.animation = "sit"
player.animated_sprite.flip_h = direction == Direction.LEFT
@@ -58,5 +60,7 @@ func unmount() -> void:
else:
player.position = Vector2(position.x, position.y + 8)
player.animated_sprite.animation = "down"
player.z_index = 0
player = null
input_released = true
y_sort_enabled = true

View File

@@ -8,14 +8,23 @@ var drawing: bool = false
var erasing: bool = false
var undo_stack: Array[Image] = []
var bgimage: Image
var save_path: String = "user://pumpkin_carving.png"
func _ready() -> void:
image = Image.create_empty(32, 32, false, Image.FORMAT_RGBA8)
dtexture = $DrawTexture
bgtexture = $Background
bgimage = bgtexture.texture.get_image()
load_image()
update_texture()
func load_image() -> void:
if FileAccess.file_exists(save_path):
var loaded: Image = Image.load_from_file(save_path)
if loaded:
image = loaded
return
image = Image.create_empty(32, 32, false, Image.FORMAT_RGBA8)
func update_texture() -> void:
var texture: ImageTexture = ImageTexture.create_from_image(image)
dtexture.texture = texture
@@ -40,14 +49,15 @@ func draw_at_mouse() -> void:
var color: Color = Color.BLACK if not erasing else Color(0, 0, 0, 0)
pixel(pixel_pos, color)
update_texture()
save_image()
func _input(event: InputEvent) -> void:
if event is InputEventKey and event.pressed and not event.is_echo():
if event.keycode == KEY_Z and Input.is_key_pressed(KEY_CTRL):
undo()
return
if event is InputEventMouseButton and not event.is_echo():
if event is InputEventMouseButton and !event.is_echo():
var mouse_pos = get_global_mouse_position()
var drect = dtexture.get_global_rect()
if not drect.has_point(mouse_pos):
return
if event.button_index == MOUSE_BUTTON_LEFT:
if event.pressed:
push_undo_state()
@@ -72,3 +82,10 @@ func undo() -> void:
if undo_stack.size() > 0:
image = undo_stack.pop_back()
update_texture()
save_image()
func save_image() -> void:
image.save_png(save_path)
func _on_undo_button_pressed() -> void:
undo()

View File

@@ -72,5 +72,5 @@ func _physics_process(delta: float) -> void:
func _unhandled_input(event: InputEvent) -> void:
if event is InputEventMouse:
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
elif !event.is_action("escape"):
elif EventManager.player_free && !EventManager.animation_player.is_playing() && !event.is_action("escape"):
Input.mouse_mode = Input.MOUSE_MODE_HIDDEN