From 7e4c77dd49d4fd17ec7e01ce9d88d440cd502f8e Mon Sep 17 00:00:00 2001 From: Harmony Honey Date: Tue, 1 Nov 2022 18:34:48 -0400 Subject: [PATCH] secret collectibles WIP! (: --- src/actor/Note.gd | 21 ++++++++++++ src/actor/Note.tscn | 26 +++++++++++++++ src/actor/Player.gd | 3 ++ src/autoload/Shared.gd | 1 + src/map/1-1.tscn | 2 +- src/map/1-3.tscn | 12 +++++-- src/menu/splash.tscn | 3 -- src/stage/ObscureMap.gd | 9 +++++ src/stage/ObscureMap.tscn | 66 +++++++++++++++++++++++++++++++++++++ src/stage/SolidTileMap.gd | 1 + src/stage/SolidTileMap.tscn | 18 +++++++++- 11 files changed, 155 insertions(+), 7 deletions(-) create mode 100644 src/actor/Note.gd create mode 100644 src/actor/Note.tscn create mode 100644 src/stage/ObscureMap.gd create mode 100644 src/stage/ObscureMap.tscn diff --git a/src/actor/Note.gd b/src/actor/Note.gd new file mode 100644 index 0000000..a72715d --- /dev/null +++ b/src/actor/Note.gd @@ -0,0 +1,21 @@ +tool +extends Actor + +onready var sprite := $Sprite + +export var gra : Gradient +var clock := 0.0 +export var duration := 1.0 + +var bounce := 0.0 + +func _physics_process(delta): + if Engine.editor_hint: return + +# clock += delta +# clock = fmod(clock, duration) +# sprite.modulate = gra.interpolate(clock / duration) + + bounce += delta * 2.5 + sprite.offset.y = sin(bounce) * 1.5 + diff --git a/src/actor/Note.tscn b/src/actor/Note.tscn new file mode 100644 index 0000000..e3a28f4 --- /dev/null +++ b/src/actor/Note.tscn @@ -0,0 +1,26 @@ +[gd_scene load_steps=4 format=2] + +[ext_resource path="res://src/actor/Note.gd" type="Script" id=1] +[ext_resource path="res://media/image/HarmonyHoneyLogo.png" type="Texture" id=2] + +[sub_resource type="Gradient" id=1] +interpolation_mode = 2 +offsets = PoolRealArray( 0, 0.33, 0.66, 1 ) +colors = PoolColorArray( 1, 0, 0.301961, 1, 0, 0.894118, 0.211765, 1, 0.160784, 0.678431, 1, 1, 1, 0, 0.301961, 1 ) + +[node name="Note" type="Node2D"] +z_index = 10 +z_as_relative = false +script = ExtResource( 1 ) +hitbox_x = 10 +hitbox_y = 10 +tag = "note" +gra = SubResource( 1 ) +duration = 3.0 + +[node name="Sprite" type="Sprite" parent="."] +modulate = Color( 1, 0.945098, 0.909804, 1 ) +position = Vector2( 5, 5 ) +texture = ExtResource( 2 ) +region_enabled = true +region_rect = Rect2( 4, 2, 14, 14 ) diff --git a/src/actor/Player.gd b/src/actor/Player.gd index 4b9c8ee..cde0e5c 100644 --- a/src/actor/Player.gd +++ b/src/actor/Player.gd @@ -51,6 +51,9 @@ var btnp_pick = false export var is_attract_mode = false +func _enter_tree(): + Shared.player = self + # Called when the node enters the scene tree for the first time. func _ready(): if Engine.editor_hint or Shared.is_level_select: diff --git a/src/autoload/Shared.gd b/src/autoload/Shared.gd index fae4b69..fec9508 100644 --- a/src/autoload/Shared.gd +++ b/src/autoload/Shared.gd @@ -30,6 +30,7 @@ var current_map := 0 var maps := [] var actors := [] +var player func _ready(): print("Shared._ready(): ") diff --git a/src/map/1-1.tscn b/src/map/1-1.tscn index d290c18..940083d 100644 --- a/src/map/1-1.tscn +++ b/src/map/1-1.tscn @@ -47,10 +47,10 @@ margin_left = 12.0 margin_top = -7.0 margin_right = 42.0 margin_bottom = 6.0 -custom_fonts/font = ExtResource( 8 ) custom_colors/font_color = Color( 1, 0.945098, 0.909804, 1 ) custom_colors/font_color_shadow = Color( 0, 0, 0, 1 ) custom_constants/shadow_as_outline = 1 +custom_fonts/font = ExtResource( 8 ) text = "move" __meta__ = { "_edit_use_anchors_": false diff --git a/src/map/1-3.tscn b/src/map/1-3.tscn index f0d87de..7ad22ad 100644 --- a/src/map/1-3.tscn +++ b/src/map/1-3.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=12 format=2] +[gd_scene load_steps=14 format=2] [ext_resource path="res://src/stage/SolidTileMap.tscn" type="PackedScene" id=1] [ext_resource path="res://src/actor/Box.tscn" type="PackedScene" id=2] @@ -11,12 +11,14 @@ [ext_resource path="res://media/font/m6x11.tres" type="DynamicFont" id=9] [ext_resource path="res://media/image/btn.png" type="Texture" id=10] [ext_resource path="res://src/menu/hide_on_level_select.gd" type="Script" id=11] +[ext_resource path="res://src/actor/Note.tscn" type="PackedScene" id=12] +[ext_resource path="res://src/stage/ObscureMap.tscn" type="PackedScene" id=13] [node name="Stage" type="Node2D"] script = ExtResource( 8 ) [node name="SolidTileMap" parent="." instance=ExtResource( 1 )] -tile_data = PoolIntArray( -458762, 536870912, 0, -458761, 0, 1, -458760, 0, 0, -458759, 0, 1, -458758, 536870912, 0, -458757, 0, 1, -458756, 0, 1, -458755, 0, 0, -458754, 0, 1, -458753, 536870912, 0, -524288, 0, 1, -524287, 0, 1, -524286, 536870912, 0, -524285, 0, 1, -524284, 0, 0, -393226, 0, 1, -458748, 0, 1, -327690, 536870912, 0, -393212, 0, 0, -393211, 0, 1, -393210, 536870912, 0, -262154, 536870912, 0, -262153, 0, 1, -262152, 0, 1, -262151, 0, 0, -262150, 0, 1, -262149, 536870912, 0, -327674, 536870912, 0, -196616, 536870912, 0, -262138, 0, 1, -131080, 0, 1, -196602, 536870912, 0, -65549, 536870912, 0, -65548, 0, 1, -65547, 0, 0, -65546, 0, 1, -65545, 536870912, 0, -65544, 536870912, 0, -131066, 0, 1, -13, 536870912, 0, -65530, 536870912, 0, 65523, 0, 1, 65534, 536870912, 0, 65535, 0, 1, 0, 0, 0, 1, 0, 1, 2, 536870912, 0, 3, 0, 1, 4, 0, 0, 5, 0, 1, 6, 536870912, 0, 131059, 0, 0, 131070, 0, 1, 196595, 0, 1, 196606, 0, 0, 262131, 536870912, 0, 262142, 0, 1, 327667, 536870912, 0, 327668, 0, 1, 327669, 0, 0, 327670, 0, 1, 327671, 536870912, 0, 327672, 0, 1, 327673, 0, 1, 327674, 0, 0, 327675, 0, 1, 327676, 536870912, 0, 327677, 0, 1, 327678, 536870912, 0 ) +tile_data = PoolIntArray( -524303, 536870913, 0, -524302, 536870913, 0, -524301, 536870913, 0, -524300, 536870913, 0, -524299, 536870913, 0, -524298, 536870913, 0, -458767, 536870913, 0, -458762, 536870912, 0, -458761, 0, 1, -458760, 0, 0, -458759, 0, 1, -458758, 536870912, 0, -458757, 0, 1, -458756, 0, 1, -458755, 0, 0, -458754, 0, 1, -458753, 536870912, 0, -524288, 0, 1, -524287, 0, 1, -524286, 536870912, 0, -524285, 0, 1, -524284, 0, 0, -393231, 536870913, 0, -393226, 0, 1, -458748, 0, 1, -327695, 536870913, 0, -327690, 536870912, 0, -393212, 0, 0, -393211, 0, 1, -393210, 536870912, 0, -262159, 536870913, 0, -262154, 536870912, 0, -262153, 0, 1, -262152, 0, 1, -262151, 0, 0, -262150, 0, 1, -262149, 536870912, 0, -327674, 536870912, 0, -196623, 536870913, 0, -262138, 0, 1, -131087, 536870913, 0, -196602, 536870912, 0, -65551, 536870913, 0, -65550, 536870913, 0, -65549, 536870912, 0, -65548, 0, 1, -65547, 0, 0, -65546, 0, 1, -65545, 536870912, 0, -65544, 536870912, 0, -131066, 0, 1, -13, 536870912, 0, -65530, 536870912, 0, 65523, 0, 1, 65534, 536870912, 0, 65535, 0, 1, 0, 0, 0, 1, 0, 1, 2, 536870912, 0, 3, 0, 1, 4, 0, 0, 5, 0, 1, 6, 536870912, 0, 131059, 0, 0, 131070, 0, 1, 196595, 0, 1, 196606, 0, 0, 262131, 536870912, 0, 262142, 0, 1, 327667, 536870912, 0, 327668, 0, 1, 327669, 0, 0, 327670, 0, 1, 327671, 536870912, 0, 327672, 0, 1, 327673, 0, 1, 327674, 0, 0, 327675, 0, 1, 327676, 536870912, 0, 327677, 0, 1, 327678, 536870912, 0 ) [node name="SpikeTileMap" parent="." instance=ExtResource( 6 )] @@ -24,6 +26,9 @@ tile_data = PoolIntArray( -458762, 536870912, 0, -458761, 0, 1, -458760, 0, 0, - z_index = -11 tile_data = PoolIntArray( -524295, 536870916, 3, -524294, 536870916, 0, -524293, 536870916, 2, -589821, 536870916, 3, -589820, 536870916, 1, -589819, 536870916, 2, -458766, 5, 2, -458765, -1610612731, 2, -524283, 536870916, 1, -524282, 4, 3, -393230, -1073741819, 0, -393229, -1073741819, 0, -393228, -1073741819, 1, -393227, -1073741819, 1, -393223, 4, 2, -393222, 4, 1, -393221, 4, 3, -393218, 5, 1, -458749, 4, 2, -458747, 4, 0, -458746, 4, 3, -327694, -1073741819, 2, -327693, 1610612741, 2, -327687, 4, 2, -327686, 4, 0, -327685, 4, 3, -327682, 1610612741, 2, -393209, 4, 3, -327678, 5, 2, -327677, 5, 0, -327676, -1610612731, 2, -327675, 4, 2, -327673, 4, 0, -327672, 4, 3, -196614, 1073741829, 2, -196613, 1610612741, 2, -262142, 5, 0, -262141, 5, 0, -262140, 5, 0, -262137, 536870916, 2, -131076, 536870916, 3, -131075, 4, 0, -131074, 536870916, 2, -196606, -1073741819, 2, -196605, 5, 0, -196604, 1610612741, 2, -65540, 536870916, 3, -65539, 4, 1, -65538, 536870916, 2, -131072, 536870916, 3, -131071, 4, 0, -131070, 4, 3, -131069, 5, 1, -11, 1073741829, 2, -10, 5, 0, -9, 1610612741, 2, -65536, 4, 2, -65535, 536870916, 1, -65534, 4, 3, -65533, 5, 1, 131057, 536870916, 3, 131058, 536870916, 0, 131060, 4, 0, 131061, 4, 1, 131062, 4, 3, 131071, -1610612731, 2, 65536, 4, 2, 65537, 4, 0, 65538, 536870916, 2, 65541, 5, 1, 196593, 536870916, 3, 196594, 536870916, 1, 196596, 4, 1, 196597, 4, 0, 196598, 4, 3, 196607, -1610612731, 0, 131077, 5, 1, 262129, 4, 2, 262130, 536870916, 0, 262132, 4, 0, 262133, 4, 1, 262134, 536870916, 2, 262138, 5, 2, 262139, 5, 0, 262140, 5, 0, 262141, 536870917, 2, 262143, -536870907, 2, 196613, 5, 0, 327666, 4, 2 ) +[node name="ObscureMap" parent="." instance=ExtResource( 13 )] +tile_data = PoolIntArray( -458766, 1, 0, -458765, 1, 0, -458764, 1, 0, -458763, 1, 0, -393230, 1, 0, -393229, 1, 0, -393228, 1, 0, -393227, 1, 0, -327694, 1, 0, -327693, 1, 0, -327692, 1, 0, -327691, 1, 0, -262158, 0, 0, -262157, 0, 0, -262156, 0, 0, -262155, 0, 0, -196622, 0, 0, -196621, 0, 0, -196620, 0, 0, -196619, 0, 0, -196618, 0, 0, -196617, 0, 0, -196616, 2, 0, -131086, 0, 0, -131085, 0, 0, -131084, 0, 0, -131083, 0, 0, -131082, 0, 0, -131081, 0, 0, -131080, 2, 1 ) + [node name="GameCamera" parent="." instance=ExtResource( 4 )] position = Vector2( -24, -16 ) @@ -44,6 +49,9 @@ position = Vector2( 14, -8 ) [node name="Box3" parent="Actors" instance=ExtResource( 2 )] position = Vector2( 11, -16 ) +[node name="Note" parent="Actors" instance=ExtResource( 12 )] +position = Vector2( -101, -37 ) + [node name="return" type="Sprite" parent="."] position = Vector2( 15, 36 ) texture = ExtResource( 10 ) diff --git a/src/menu/splash.tscn b/src/menu/splash.tscn index e5103b3..4880640 100644 --- a/src/menu/splash.tscn +++ b/src/menu/splash.tscn @@ -12,9 +12,6 @@ margin_left = 14.0 margin_right = 242.0 margin_bottom = 128.0 color = Color( 1, 0.945098, 0.909804, 1 ) -__meta__ = { -"_edit_use_anchors_": false -} [node name="Logo" type="Sprite" parent="."] modulate = Color( 0, 0, 0, 1 ) diff --git a/src/stage/ObscureMap.gd b/src/stage/ObscureMap.gd new file mode 100644 index 0000000..383d3db --- /dev/null +++ b/src/stage/ObscureMap.gd @@ -0,0 +1,9 @@ +extends TileMap + +func _ready(): + tile_set.tile_set_modulate(0, Color.black) + tile_set.tile_set_modulate(1, Color.transparent) + +func _physics_process(delta): + if is_instance_valid(Shared.player): + modulate.a = lerp(modulate.a, 0.0 if get_cellv(world_to_map(Shared.player.center())) != -1 else 1.0, delta * 10.0) diff --git a/src/stage/ObscureMap.tscn b/src/stage/ObscureMap.tscn new file mode 100644 index 0000000..f533bed --- /dev/null +++ b/src/stage/ObscureMap.tscn @@ -0,0 +1,66 @@ +[gd_scene load_steps=6 format=2] + +[ext_resource path="res://media/image/solid_bricks.png" type="Texture" id=3] +[ext_resource path="res://media/image/8pixel.png" type="Texture" id=4] +[ext_resource path="res://src/stage/ObscureMap.gd" type="Script" id=5] +[ext_resource path="res://media/image/wipe.png" type="Texture" id=6] + +[sub_resource type="TileSet" id=1] +0/name = "8pixel.png 0" +0/texture = ExtResource( 4 ) +0/tex_offset = Vector2( 0, 0 ) +0/modulate = Color( 0, 1, 0.06, 0.33 ) +0/region = Rect2( 0, 0, 8, 8 ) +0/tile_mode = 0 +0/occluder_offset = Vector2( 0, 0 ) +0/navigation_offset = Vector2( 0, 0 ) +0/shape_offset = Vector2( 0, 0 ) +0/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 ) +0/shape_one_way = false +0/shape_one_way_margin = 0.0 +0/shapes = [ ] +0/z_index = 0 +1/name = "wipe.png 1" +1/texture = ExtResource( 6 ) +1/tex_offset = Vector2( 0, 0 ) +1/modulate = Color( 0, 1, 0, 0.2 ) +1/region = Rect2( 32, 48, 8, 8 ) +1/tile_mode = 0 +1/occluder_offset = Vector2( 0, 0 ) +1/navigation_offset = Vector2( 0, 0 ) +1/shape_offset = Vector2( 0, 0 ) +1/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 ) +1/shape_one_way = false +1/shape_one_way_margin = 0.0 +1/shapes = [ ] +1/z_index = 0 +2/name = "solid_bricks.png 2" +2/texture = ExtResource( 3 ) +2/tex_offset = Vector2( 0, 0 ) +2/modulate = Color( 1, 1, 1, 1 ) +2/region = Rect2( 0, 0, 16, 8 ) +2/tile_mode = 2 +2/autotile/icon_coordinate = Vector2( 0, 0 ) +2/autotile/tile_size = Vector2( 8, 8 ) +2/autotile/spacing = 0 +2/autotile/occluder_map = [ ] +2/autotile/navpoly_map = [ ] +2/autotile/priority_map = [ ] +2/autotile/z_index_map = [ ] +2/occluder_offset = Vector2( 0, 0 ) +2/navigation_offset = Vector2( 0, 0 ) +2/shape_offset = Vector2( 0, 0 ) +2/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 ) +2/shape_one_way = false +2/shape_one_way_margin = 0.0 +2/shapes = [ ] +2/z_index = 0 + +[node name="ObscureMap" type="TileMap"] +light_mask = 4 +z_index = 12 +z_as_relative = false +tile_set = SubResource( 1 ) +cell_size = Vector2( 8, 8 ) +format = 1 +script = ExtResource( 5 ) diff --git a/src/stage/SolidTileMap.gd b/src/stage/SolidTileMap.gd index 3c0d107..235a01d 100644 --- a/src/stage/SolidTileMap.gd +++ b/src/stage/SolidTileMap.gd @@ -2,3 +2,4 @@ extends TileMap func _ready(): Shared.node_map_solid = self + tile_set.tile_set_modulate(1, Color.transparent) diff --git a/src/stage/SolidTileMap.tscn b/src/stage/SolidTileMap.tscn index 3baef4a..5470a93 100644 --- a/src/stage/SolidTileMap.tscn +++ b/src/stage/SolidTileMap.tscn @@ -1,5 +1,6 @@ -[gd_scene load_steps=4 format=2] +[gd_scene load_steps=5 format=2] +[ext_resource path="res://media/image/8pixel.png" type="Texture" id=1] [ext_resource path="res://media/image/solid_bricks.png" type="Texture" id=2] [sub_resource type="TileSet" id=1] @@ -24,12 +25,27 @@ 0/shape_one_way_margin = 0.0 0/shapes = [ ] 0/z_index = 0 +1/name = "8pixel.png 1" +1/texture = ExtResource( 1 ) +1/tex_offset = Vector2( 0, 0 ) +1/modulate = Color( 1, 0, 1, 0.33 ) +1/region = Rect2( 0, 0, 8, 8 ) +1/tile_mode = 0 +1/occluder_offset = Vector2( 0, 0 ) +1/navigation_offset = Vector2( 0, 0 ) +1/shape_offset = Vector2( 0, 0 ) +1/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 ) +1/shape_one_way = false +1/shape_one_way_margin = 0.0 +1/shapes = [ ] +1/z_index = 0 [sub_resource type="GDScript" id=2] script/source = "extends TileMap func _ready(): Shared.node_map_solid = self + tile_set.tile_set_modulate(1, Color.transparent) " [node name="SolidTileMap" type="TileMap"]