From fc007ca71a7e0672450b5f73621082af314dfad6 Mon Sep 17 00:00:00 2001 From: godzilla5hrimp Date: Sun, 20 Sep 2026 16:06:58 +0200 Subject: [PATCH] feat: add a chest node; add logic for random scroll in the chest; add a timer t hide the scroll after; --- Ninja Adventure - Asset Pack/LICENSE.txt | 234 ++++++++++----------- Ninja Adventure - Asset Pack/README.md | 35 ++- Scenes/GameScene/game_scene.tscn | 10 + Scenes/TreasureChest/treasure_chest.gd | 23 ++ Scenes/TreasureChest/treasure_chest.gd.uid | 1 + Scenes/TreasureChest/treasure_chest.tscn | 85 ++++++++ 6 files changed, 253 insertions(+), 135 deletions(-) create mode 100644 Scenes/TreasureChest/treasure_chest.gd create mode 100644 Scenes/TreasureChest/treasure_chest.gd.uid create mode 100644 Scenes/TreasureChest/treasure_chest.tscn diff --git a/Ninja Adventure - Asset Pack/LICENSE.txt b/Ninja Adventure - Asset Pack/LICENSE.txt index 09b6e49..1d61241 100644 --- a/Ninja Adventure - Asset Pack/LICENSE.txt +++ b/Ninja Adventure - Asset Pack/LICENSE.txt @@ -1,117 +1,117 @@ -CC0 1.0 Universal - -Statement of Purpose - -The laws of most jurisdictions throughout the world automatically confer -exclusive Copyright and Related Rights (defined below) upon the creator and -subsequent owner(s) (each and all, an "owner") of an original work of -authorship and/or a database (each, a "Work"). - -Certain owners wish to permanently relinquish those rights to a Work for the -purpose of contributing to a commons of creative, cultural and scientific -works ("Commons") that the public can reliably and without fear of later -claims of infringement build upon, modify, incorporate in other works, reuse -and redistribute as freely as possible in any form whatsoever and for any -purposes, including without limitation commercial purposes. These owners may -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 -reputation or greater distribution for their Work in part through the use and -efforts of others. - -For these and/or other purposes and motivations, and without any expectation -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 -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 -Copyright and Related Rights in the Work and the meaning and intended legal -effect of CC0 on those rights. - -1. Copyright and Related Rights. A Work made available under CC0 may be -protected by copyright and related or neighboring rights ("Copyright and -Related Rights"). Copyright and Related Rights include, but are not limited -to, the following: - - i. the right to reproduce, adapt, distribute, perform, display, communicate, - and translate a Work; - - 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 - depicted in a Work; - - iv. rights protecting against unfair competition in regards to a Work, - subject to the limitations in paragraph 4(a), below; - - v. rights protecting the extraction, dissemination, use and reuse of data in - a Work; - - 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 - protection of databases, and under any national implementation thereof, - including any amended or successor version of such directive); and - - vii. other similar, equivalent or corresponding rights throughout the world - based on applicable law or treaty, and any national implementations thereof. - -2. Waiver. To the greatest extent permitted by, but not in contravention of, -applicable law, Affirmer hereby overtly, fully, permanently, irrevocably and -unconditionally waives, abandons, and surrenders all of Affirmer's Copyright -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 -action), in the Work (i) in all territories worldwide, (ii) for the maximum -duration 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 purpose whatsoever, including without limitation -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 -detriment of Affirmer's heirs and successors, fully intending that such Waiver -shall not be subject to revocation, rescission, cancellation, termination, or -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. - -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 -shall be preserved to the maximum extent permitted taking into account -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, -non transferable, non sublicensable, non exclusive, irrevocable and -unconditional license to exercise Affirmer's Copyright and Related Rights in -the Work (i) in all territories worldwide, (ii) for the maximum duration -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 -purpose whatsoever, including without limitation commercial, advertising or -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 -License for any reason be judged legally invalid or ineffective under -applicable law, such partial invalidity or ineffectiveness shall not -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 -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 -Affirmer's express Statement of Purpose. - -4. Limitations and Disclaimers. - - a. No trademark or patent rights held by Affirmer are waived, abandoned, - surrendered, licensed or otherwise affected by this document. - - b. Affirmer offers the Work as-is and makes no representations or warranties - of any kind concerning the Work, express, implied, statutory or otherwise, - including without limitation warranties of title, merchantability, fitness - 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 - discoverable, all to the greatest extent permissible under applicable law. - - c. Affirmer disclaims responsibility for clearing rights of other persons - 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 - disclaims responsibility for obtaining any necessary consents, permissions - or other rights required for any use of the Work. - - 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 - CC0 or use of the Work. - -For more information, please see - - \ No newline at end of file +CC0 1.0 Universal + +Statement of Purpose + +The laws of most jurisdictions throughout the world automatically confer +exclusive Copyright and Related Rights (defined below) upon the creator and +subsequent owner(s) (each and all, an "owner") of an original work of +authorship and/or a database (each, a "Work"). + +Certain owners wish to permanently relinquish those rights to a Work for the +purpose of contributing to a commons of creative, cultural and scientific +works ("Commons") that the public can reliably and without fear of later +claims of infringement build upon, modify, incorporate in other works, reuse +and redistribute as freely as possible in any form whatsoever and for any +purposes, including without limitation commercial purposes. These owners may +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 +reputation or greater distribution for their Work in part through the use and +efforts of others. + +For these and/or other purposes and motivations, and without any expectation +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 +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 +Copyright and Related Rights in the Work and the meaning and intended legal +effect of CC0 on those rights. + +1. Copyright and Related Rights. A Work made available under CC0 may be +protected by copyright and related or neighboring rights ("Copyright and +Related Rights"). Copyright and Related Rights include, but are not limited +to, the following: + + i. the right to reproduce, adapt, distribute, perform, display, communicate, + and translate a Work; + + 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 + depicted in a Work; + + iv. rights protecting against unfair competition in regards to a Work, + subject to the limitations in paragraph 4(a), below; + + v. rights protecting the extraction, dissemination, use and reuse of data in + a Work; + + 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 + protection of databases, and under any national implementation thereof, + including any amended or successor version of such directive); and + + vii. other similar, equivalent or corresponding rights throughout the world + based on applicable law or treaty, and any national implementations thereof. + +2. Waiver. To the greatest extent permitted by, but not in contravention of, +applicable law, Affirmer hereby overtly, fully, permanently, irrevocably and +unconditionally waives, abandons, and surrenders all of Affirmer's Copyright +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 +action), in the Work (i) in all territories worldwide, (ii) for the maximum +duration 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 purpose whatsoever, including without limitation +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 +detriment of Affirmer's heirs and successors, fully intending that such Waiver +shall not be subject to revocation, rescission, cancellation, termination, or +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. + +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 +shall be preserved to the maximum extent permitted taking into account +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, +non transferable, non sublicensable, non exclusive, irrevocable and +unconditional license to exercise Affirmer's Copyright and Related Rights in +the Work (i) in all territories worldwide, (ii) for the maximum duration +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 +purpose whatsoever, including without limitation commercial, advertising or +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 +License for any reason be judged legally invalid or ineffective under +applicable law, such partial invalidity or ineffectiveness shall not +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 +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 +Affirmer's express Statement of Purpose. + +4. Limitations and Disclaimers. + + a. No trademark or patent rights held by Affirmer are waived, abandoned, + surrendered, licensed or otherwise affected by this document. + + b. Affirmer offers the Work as-is and makes no representations or warranties + of any kind concerning the Work, express, implied, statutory or otherwise, + including without limitation warranties of title, merchantability, fitness + 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 + discoverable, all to the greatest extent permissible under applicable law. + + c. Affirmer disclaims responsibility for clearing rights of other persons + 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 + disclaims responsibility for obtaining any necessary consents, permissions + or other rights required for any use of the Work. + + 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 + CC0 or use of the Work. + +For more information, please see + + diff --git a/Ninja Adventure - Asset Pack/README.md b/Ninja Adventure - Asset Pack/README.md index f306bb0..e96cf05 100644 --- a/Ninja Adventure - Asset Pack/README.md +++ b/Ninja Adventure - Asset Pack/README.md @@ -1,18 +1,17 @@ -# Ninja Adventure Asset Pack - -Assets created by: -[Pixel-boy](https://pixel-boy.itch.io/) -[AAA](https://www.instagram.com/challenger.aaa/?hl=fr) - -# 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, -even commercial ones. Attribution is not required but appreciated. - -# Placing one of these links somewhere would be awesome :) -Patreon: https://www.patreon.com/pixelarchipel -Itchio Page: https://pixel-boy.itch.io/ -Pack Page: https://pixel-boy.itch.io/ninja-adventure-asset-pack - +# Ninja Adventure Asset Pack + +Assets created by: +[Pixel-boy](https://pixel-boy.itch.io/) +[AAA](https://www.instagram.com/challenger.aaa/?hl=fr) + +# 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, +even commercial ones. Attribution is not required but appreciated. + +# Placing one of these links somewhere would be awesome :) +Patreon: https://www.patreon.com/pixelarchipel +Itchio Page: https://pixel-boy.itch.io/ +Pack Page: https://pixel-boy.itch.io/ninja-adventure-asset-pack diff --git a/Scenes/GameScene/game_scene.tscn b/Scenes/GameScene/game_scene.tscn index 26603b8..0dab0e1 100644 --- a/Scenes/GameScene/game_scene.tscn +++ b/Scenes/GameScene/game_scene.tscn @@ -12,6 +12,7 @@ [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://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"] [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")] 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")] position = Vector2(137, -107) diff --git a/Scenes/TreasureChest/treasure_chest.gd b/Scenes/TreasureChest/treasure_chest.gd new file mode 100644 index 0000000..56e5949 --- /dev/null +++ b/Scenes/TreasureChest/treasure_chest.gd @@ -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 diff --git a/Scenes/TreasureChest/treasure_chest.gd.uid b/Scenes/TreasureChest/treasure_chest.gd.uid new file mode 100644 index 0000000..5bc3567 --- /dev/null +++ b/Scenes/TreasureChest/treasure_chest.gd.uid @@ -0,0 +1 @@ +uid://h2y2p3dcj4ne diff --git a/Scenes/TreasureChest/treasure_chest.tscn b/Scenes/TreasureChest/treasure_chest.tscn new file mode 100644 index 0000000..6cb2a4d --- /dev/null +++ b/Scenes/TreasureChest/treasure_chest.tscn @@ -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"]