feat: add a chest node; add logic for random scroll in the chest; add a timer t hide the scroll after;

This commit is contained in:
2026-09-20 16:06:58 +02:00
parent d8d342ab56
commit fc007ca71a
6 changed files with 253 additions and 135 deletions
+117 -117
View File
@@ -1,117 +1,117 @@
CC0 1.0 Universal CC0 1.0 Universal
Statement of Purpose Statement of Purpose
The laws of most jurisdictions throughout the world automatically confer The laws of most jurisdictions throughout the world automatically confer
exclusive Copyright and Related Rights (defined below) upon the creator and exclusive Copyright and Related Rights (defined below) upon the creator and
subsequent owner(s) (each and all, an "owner") of an original work of subsequent owner(s) (each and all, an "owner") of an original work of
authorship and/or a database (each, a "Work"). authorship and/or a database (each, a "Work").
Certain owners wish to permanently relinquish those rights to a Work for the Certain owners wish to permanently relinquish those rights to a Work for the
purpose of contributing to a commons of creative, cultural and scientific purpose of contributing to a commons of creative, cultural and scientific
works ("Commons") that the public can reliably and without fear of later works ("Commons") that the public can reliably and without fear of later
claims of infringement build upon, modify, incorporate in other works, reuse claims of infringement build upon, modify, incorporate in other works, reuse
and redistribute as freely as possible in any form whatsoever and for any and redistribute as freely as possible in any form whatsoever and for any
purposes, including without limitation commercial purposes. These owners may purposes, including without limitation commercial purposes. These owners may
contribute to the Commons to promote the ideal of a free culture and the contribute to the Commons to promote the ideal of a free culture and the
further production of creative, cultural and scientific works, or to gain further production of creative, cultural and scientific works, or to gain
reputation or greater distribution for their Work in part through the use and reputation or greater distribution for their Work in part through the use and
efforts of others. efforts of others.
For these and/or other purposes and motivations, and without any expectation For these and/or other purposes and motivations, and without any expectation
of additional consideration or compensation, the person associating CC0 with a of additional consideration or compensation, the person associating CC0 with a
Work (the "Affirmer"), to the extent that he or she is an owner of Copyright Work (the "Affirmer"), to the extent that he or she is an owner of Copyright
and Related Rights in the Work, voluntarily elects to apply CC0 to the Work and Related Rights in the Work, voluntarily elects to apply CC0 to the Work
and publicly distribute the Work under its terms, with knowledge of his or her and publicly distribute the Work under its terms, with knowledge of his or her
Copyright and Related Rights in the Work and the meaning and intended legal Copyright and Related Rights in the Work and the meaning and intended legal
effect of CC0 on those rights. effect of CC0 on those rights.
1. Copyright and Related Rights. A Work made available under CC0 may be 1. Copyright and Related Rights. A Work made available under CC0 may be
protected by copyright and related or neighboring rights ("Copyright and protected by copyright and related or neighboring rights ("Copyright and
Related Rights"). Copyright and Related Rights include, but are not limited Related Rights"). Copyright and Related Rights include, but are not limited
to, the following: to, the following:
i. the right to reproduce, adapt, distribute, perform, display, communicate, i. the right to reproduce, adapt, distribute, perform, display, communicate,
and translate a Work; and translate a Work;
ii. moral rights retained by the original author(s) and/or performer(s); ii. moral rights retained by the original author(s) and/or performer(s);
iii. publicity and privacy rights pertaining to a person's image or likeness iii. publicity and privacy rights pertaining to a person's image or likeness
depicted in a Work; depicted in a Work;
iv. rights protecting against unfair competition in regards to a Work, iv. rights protecting against unfair competition in regards to a Work,
subject to the limitations in paragraph 4(a), below; subject to the limitations in paragraph 4(a), below;
v. rights protecting the extraction, dissemination, use and reuse of data in v. rights protecting the extraction, dissemination, use and reuse of data in
a Work; a Work;
vi. database rights (such as those arising under Directive 96/9/EC of the vi. database rights (such as those arising under Directive 96/9/EC of the
European Parliament and of the Council of 11 March 1996 on the legal European Parliament and of the Council of 11 March 1996 on the legal
protection of databases, and under any national implementation thereof, protection of databases, and under any national implementation thereof,
including any amended or successor version of such directive); and including any amended or successor version of such directive); and
vii. other similar, equivalent or corresponding rights throughout the world vii. other similar, equivalent or corresponding rights throughout the world
based on applicable law or treaty, and any national implementations thereof. based on applicable law or treaty, and any national implementations thereof.
2. Waiver. To the greatest extent permitted by, but not in contravention of, 2. Waiver. To the greatest extent permitted by, but not in contravention of,
applicable law, Affirmer hereby overtly, fully, permanently, irrevocably and applicable law, Affirmer hereby overtly, fully, permanently, irrevocably and
unconditionally waives, abandons, and surrenders all of Affirmer's Copyright unconditionally waives, abandons, and surrenders all of Affirmer's Copyright
and Related Rights and associated claims and causes of action, whether now and Related Rights and associated claims and causes of action, whether now
known or unknown (including existing as well as future claims and causes of known or unknown (including existing as well as future claims and causes of
action), in the Work (i) in all territories worldwide, (ii) for the maximum action), in the Work (i) in all territories worldwide, (ii) for the maximum
duration provided by applicable law or treaty (including future time duration provided by applicable law or treaty (including future time
extensions), (iii) in any current or future medium and for any number of extensions), (iii) in any current or future medium and for any number of
copies, and (iv) for any purpose whatsoever, including without limitation copies, and (iv) for any purpose whatsoever, including without limitation
commercial, advertising or promotional purposes (the "Waiver"). Affirmer makes commercial, advertising or promotional purposes (the "Waiver"). Affirmer makes
the Waiver for the benefit of each member of the public at large and to the the Waiver for the benefit of each member of the public at large and to the
detriment of Affirmer's heirs and successors, fully intending that such Waiver detriment of Affirmer's heirs and successors, fully intending that such Waiver
shall not be subject to revocation, rescission, cancellation, termination, or shall not be subject to revocation, rescission, cancellation, termination, or
any other legal or equitable action to disrupt the quiet enjoyment of the Work any other legal or equitable action to disrupt the quiet enjoyment of the Work
by the public as contemplated by Affirmer's express Statement of Purpose. by the public as contemplated by Affirmer's express Statement of Purpose.
3. Public License Fallback. Should any part of the Waiver for any reason be 3. Public License Fallback. Should any part of the Waiver for any reason be
judged legally invalid or ineffective under applicable law, then the Waiver judged legally invalid or ineffective under applicable law, then the Waiver
shall be preserved to the maximum extent permitted taking into account shall be preserved to the maximum extent permitted taking into account
Affirmer's express Statement of Purpose. In addition, to the extent the Waiver Affirmer's express Statement of Purpose. In addition, to the extent the Waiver
is so judged Affirmer hereby grants to each affected person a royalty-free, is so judged Affirmer hereby grants to each affected person a royalty-free,
non transferable, non sublicensable, non exclusive, irrevocable and non transferable, non sublicensable, non exclusive, irrevocable and
unconditional license to exercise Affirmer's Copyright and Related Rights in unconditional license to exercise Affirmer's Copyright and Related Rights in
the Work (i) in all territories worldwide, (ii) for the maximum duration the Work (i) in all territories worldwide, (ii) for the maximum duration
provided by applicable law or treaty (including future time extensions), (iii) provided by applicable law or treaty (including future time extensions), (iii)
in any current or future medium and for any number of copies, and (iv) for any in any current or future medium and for any number of copies, and (iv) for any
purpose whatsoever, including without limitation commercial, advertising or purpose whatsoever, including without limitation commercial, advertising or
promotional purposes (the "License"). The License shall be deemed effective as promotional purposes (the "License"). The License shall be deemed effective as
of the date CC0 was applied by Affirmer to the Work. Should any part of the of the date CC0 was applied by Affirmer to the Work. Should any part of the
License for any reason be judged legally invalid or ineffective under License for any reason be judged legally invalid or ineffective under
applicable law, such partial invalidity or ineffectiveness shall not applicable law, such partial invalidity or ineffectiveness shall not
invalidate the remainder of the License, and in such case Affirmer hereby invalidate the remainder of the License, and in such case Affirmer hereby
affirms that he or she will not (i) exercise any of his or her remaining affirms that he or she will not (i) exercise any of his or her remaining
Copyright and Related Rights in the Work or (ii) assert any associated claims Copyright and Related Rights in the Work or (ii) assert any associated claims
and causes of action with respect to the Work, in either case contrary to and causes of action with respect to the Work, in either case contrary to
Affirmer's express Statement of Purpose. Affirmer's express Statement of Purpose.
4. Limitations and Disclaimers. 4. Limitations and Disclaimers.
a. No trademark or patent rights held by Affirmer are waived, abandoned, a. No trademark or patent rights held by Affirmer are waived, abandoned,
surrendered, licensed or otherwise affected by this document. surrendered, licensed or otherwise affected by this document.
b. Affirmer offers the Work as-is and makes no representations or warranties b. Affirmer offers the Work as-is and makes no representations or warranties
of any kind concerning the Work, express, implied, statutory or otherwise, of any kind concerning the Work, express, implied, statutory or otherwise,
including without limitation warranties of title, merchantability, fitness including without limitation warranties of title, merchantability, fitness
for a particular purpose, non infringement, or the absence of latent or for a particular purpose, non infringement, or the absence of latent or
other defects, accuracy, or the present or absence of errors, whether or not other defects, accuracy, or the present or absence of errors, whether or not
discoverable, all to the greatest extent permissible under applicable law. discoverable, all to the greatest extent permissible under applicable law.
c. Affirmer disclaims responsibility for clearing rights of other persons c. Affirmer disclaims responsibility for clearing rights of other persons
that may apply to the Work or any use thereof, including without limitation that may apply to the Work or any use thereof, including without limitation
any person's Copyright and Related Rights in the Work. Further, Affirmer any person's Copyright and Related Rights in the Work. Further, Affirmer
disclaims responsibility for obtaining any necessary consents, permissions disclaims responsibility for obtaining any necessary consents, permissions
or other rights required for any use of the Work. or other rights required for any use of the Work.
d. Affirmer understands and acknowledges that Creative Commons is not a d. Affirmer understands and acknowledges that Creative Commons is not a
party to this document and has no duty or obligation with respect to this party to this document and has no duty or obligation with respect to this
CC0 or use of the Work. CC0 or use of the Work.
For more information, please see For more information, please see
<http://creativecommons.org/publicdomain/zero/1.0/> <http://creativecommons.org/publicdomain/zero/1.0/>
<http://creativecommons.org/publicdomain/zero/1.0/> <http://creativecommons.org/publicdomain/zero/1.0/>
+17 -18
View File
@@ -1,18 +1,17 @@
# Ninja Adventure Asset Pack # Ninja Adventure Asset Pack
Assets created by: Assets created by:
[Pixel-boy](https://pixel-boy.itch.io/) [Pixel-boy](https://pixel-boy.itch.io/)
[AAA](https://www.instagram.com/challenger.aaa/?hl=fr) [AAA](https://www.instagram.com/challenger.aaa/?hl=fr)
# License # License
They are released under the Creative Commons Zero (CC0) license. They are released under the Creative Commons Zero (CC0) license.
You can use any and all of the assets found in this package in your own games, You can use any and all of the assets found in this package in your own games,
even commercial ones. Attribution is not required but appreciated. even commercial ones. Attribution is not required but appreciated.
# Placing one of these links somewhere would be awesome :) # Placing one of these links somewhere would be awesome :)
Patreon: https://www.patreon.com/pixelarchipel Patreon: https://www.patreon.com/pixelarchipel
Itchio Page: https://pixel-boy.itch.io/ Itchio Page: https://pixel-boy.itch.io/
Pack Page: https://pixel-boy.itch.io/ninja-adventure-asset-pack Pack Page: https://pixel-boy.itch.io/ninja-adventure-asset-pack
+10
View File
@@ -12,6 +12,7 @@
[ext_resource type="Script" uid="uid://decx4kt8ftrb5" path="res://Scenes/LockedDoor/locked_door.gd" id="7_nr542"] [ext_resource type="Script" uid="uid://decx4kt8ftrb5" path="res://Scenes/LockedDoor/locked_door.gd" id="7_nr542"]
[ext_resource type="PackedScene" uid="uid://onpen57mc6i8" path="res://Scenes/PuzzleButton/puzzle_button.tscn" id="7_ohrk8"] [ext_resource type="PackedScene" uid="uid://onpen57mc6i8" path="res://Scenes/PuzzleButton/puzzle_button.tscn" id="7_ohrk8"]
[ext_resource type="PackedScene" uid="uid://bdu180bpjrn5h" path="res://Scenes/Switch/switch.tscn" id="8_njm7v"] [ext_resource type="PackedScene" uid="uid://bdu180bpjrn5h" path="res://Scenes/Switch/switch.tscn" id="8_njm7v"]
[ext_resource type="PackedScene" uid="uid://bqcsg2t581j7b" path="res://Scenes/TreasureChest/treasure_chest.tscn" id="9_bkvnf"]
[ext_resource type="PackedScene" uid="uid://dsb83tlcapw8l" path="res://Scenes/NPC/npc.tscn" id="10_g3lhp"] [ext_resource type="PackedScene" uid="uid://dsb83tlcapw8l" path="res://Scenes/NPC/npc.tscn" id="10_g3lhp"]
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_04h35"] [sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_04h35"]
@@ -831,6 +832,15 @@ text = "Green Ninja"
[node name="Switch" parent="ObstacleLayer" unique_id=78052327 instance=ExtResource("8_njm7v")] [node name="Switch" parent="ObstacleLayer" unique_id=78052327 instance=ExtResource("8_njm7v")]
position = Vector2(-8, -26) position = Vector2(-8, -26)
[node name="TreasureChest" parent="ObstacleLayer" unique_id=2069908436 instance=ExtResource("9_bkvnf")]
position = Vector2(-41, -19)
[node name="TreasureChest2" parent="ObstacleLayer" unique_id=1691247799 instance=ExtResource("9_bkvnf")]
position = Vector2(15, -19)
[node name="TreasureChest3" parent="ObstacleLayer" unique_id=267919049 instance=ExtResource("9_bkvnf")]
position = Vector2(-79, -19)
[node name="SceneEntrance" parent="." unique_id=1734357035 instance=ExtResource("5_oi8ly")] [node name="SceneEntrance" parent="." unique_id=1734357035 instance=ExtResource("5_oi8ly")]
position = Vector2(137, -107) position = Vector2(137, -107)
+23
View File
@@ -0,0 +1,23 @@
extends StaticBody2D
var can_interact: bool = false
var is_open: bool = false
@export var scrolls: Array[Sprite2D]
var scroll_number = 0
func _ready() -> void:
scroll_number = randi_range(1, 4)
func _process(delta: float) -> void:
if Input.is_action_just_pressed("Interact") and can_interact:
if !is_open:
$AudioStreamPlayer.play()
$AnimatedSprite2D.play("open")
scrolls[scroll_number].visible = true
$Timer.start()
is_open = true
func _on_timer_timeout(scroll_number: int) -> void:
scrolls[scroll_number].visible = false
@@ -0,0 +1 @@
uid://h2y2p3dcj4ne
+85
View File
@@ -0,0 +1,85 @@
[gd_scene format=3 uid="uid://bqcsg2t581j7b"]
[ext_resource type="Script" uid="uid://h2y2p3dcj4ne" path="res://Scenes/TreasureChest/treasure_chest.gd" id="1_2tkyh"]
[ext_resource type="Texture2D" uid="uid://crewi6wldd7od" path="res://Ninja Adventure - Asset Pack/Items/Treasure/BigTreasureChest.png" id="1_v1qrq"]
[ext_resource type="AudioStream" uid="uid://ug5n4ca2cc77" path="res://Ninja Adventure - Asset Pack/Sounds/Game/Success3.wav" id="3_sdjdt"]
[ext_resource type="Texture2D" uid="uid://fybqrl1dbdao" path="res://Ninja Adventure - Asset Pack/Items/Scroll/ScrollIce.png" id="4_vnph0"]
[ext_resource type="Texture2D" uid="uid://c1coi2k1hgv5b" path="res://Ninja Adventure - Asset Pack/Items/Scroll/ScrollFire.png" id="5_2b3qj"]
[ext_resource type="Texture2D" uid="uid://d1his3w8n84aa" path="res://Ninja Adventure - Asset Pack/Items/Scroll/ScrollPlant.png" id="6_n2as5"]
[ext_resource type="Texture2D" uid="uid://d1vovcdepn1w5" path="res://Ninja Adventure - Asset Pack/Items/Scroll/ScrollRock.png" id="7_lh1s0"]
[ext_resource type="Texture2D" uid="uid://6dmy1j0t5mqy" path="res://Ninja Adventure - Asset Pack/Items/Scroll/ScrollEmpty.png" id="8_lh1s0"]
[sub_resource type="AtlasTexture" id="AtlasTexture_2tkyh"]
atlas = ExtResource("1_v1qrq")
region = Rect2(0, 0, 16, 14)
[sub_resource type="AtlasTexture" id="AtlasTexture_sdjdt"]
atlas = ExtResource("1_v1qrq")
region = Rect2(16, 0, 16, 14)
[sub_resource type="SpriteFrames" id="SpriteFrames_chgu2"]
animations = [{
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_2tkyh")
}],
"loop": 1,
"name": &"closed",
"speed": 5.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_sdjdt")
}],
"loop": 1,
"name": &"open",
"speed": 5.0
}]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_chgu2"]
size = Vector2(16, 12)
[node name="TreasureChest" type="StaticBody2D" unique_id=2069908436 node_paths=PackedStringArray("scrolls") groups=["interactable"]]
script = ExtResource("1_2tkyh")
scrolls = [NodePath("EmptyScroll"), NodePath("IceScroll"), NodePath("FireScroll"), NodePath("PlantScroll"), NodePath("RockScroll")]
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="." unique_id=990575183]
sprite_frames = SubResource("SpriteFrames_chgu2")
animation = &"open"
[node name="CollisionShape2D" type="CollisionShape2D" parent="." unique_id=104658718]
position = Vector2(0, 1)
shape = SubResource("RectangleShape2D_chgu2")
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="." unique_id=1922945704]
stream = ExtResource("3_sdjdt")
[node name="IceScroll" type="Sprite2D" parent="." unique_id=1614825692]
visible = false
position = Vector2(0, -13)
texture = ExtResource("4_vnph0")
[node name="FireScroll" type="Sprite2D" parent="." unique_id=55522702]
visible = false
position = Vector2(0, -13)
texture = ExtResource("5_2b3qj")
[node name="PlantScroll" type="Sprite2D" parent="." unique_id=1806015749]
visible = false
position = Vector2(0, -13)
texture = ExtResource("6_n2as5")
[node name="RockScroll" type="Sprite2D" parent="." unique_id=1276385957]
visible = false
position = Vector2(0, -13)
texture = ExtResource("7_lh1s0")
[node name="Timer" type="Timer" parent="." unique_id=647285700]
one_shot = true
[node name="EmptyScroll" type="Sprite2D" parent="." unique_id=699932407]
visible = false
position = Vector2(0, -13)
texture = ExtResource("8_lh1s0")
[connection signal="timeout" from="Timer" to="." method="_on_timer_timeout"]