From b49edef593d3942b22bd596cde38aceaa94faaef Mon Sep 17 00:00:00 2001 From: Harmony Honey Date: Tue, 4 Apr 2023 23:07:44 -0400 Subject: [PATCH] Arrow simplified to Area2D root! (= Player arrow monitoring disabled if !is_npc is_idle_flip = use opposite idle_dir ^.^ Clouds color_dark a little lighter! (; 2C/0 NPCs coming along! <3 --- src/actor/Player.gd | 8 +++- src/actor/door/Arrow.gd | 13 +++--- src/actor/door/Arrow.tscn | 12 +++-- src/autoload/Clouds.tscn | 4 +- src/map/worlds/1/0_hub.tscn | 4 +- src/map/worlds/2C/0_hub.tscn | 86 +++++++++++++++++++++++++++++++++++- 6 files changed, 107 insertions(+), 20 deletions(-) diff --git a/src/actor/Player.gd b/src/actor/Player.gd index adfae87..78e54f9 100644 --- a/src/actor/Player.gd +++ b/src/actor/Player.gd @@ -50,6 +50,7 @@ signal scale_x signal scale_y var idle_dir := "idle" export var idle_anim := "idle" +export var is_idle_flip := false var walk_speed := 350.0 var floor_accel := 12.0 @@ -200,7 +201,10 @@ func _ready(): if idle_anim == "handstand": emit_signal("scale_y", -1) else: - if arrow: arrow.is_locked = true + if arrow: + arrow.is_locked = true + arrow.monitoring = false + arrow.monitorable = false func wipe_start(arg): if !is_npc: @@ -596,7 +600,7 @@ func set_dir_x(arg := dir_x): dir_x = -1.0 if arg < 0 else 1.0 areas.scale.x = dir_x var l = idle_anim + "_left" - idle_dir = idle_anim if dir_x > 0 else (l if anim.has_animation(l) else "idle") + idle_dir = idle_anim if (dir_x < 0 if is_idle_flip else dir_x > 0) else (l if anim.has_animation(l) else "idle") emit_signal("scale_x", dir_x) func set_jump_height(arg): diff --git a/src/actor/door/Arrow.gd b/src/actor/door/Arrow.gd index 9f02713..f7d3aca 100644 --- a/src/actor/door/Arrow.gd +++ b/src/actor/door/Arrow.gd @@ -11,8 +11,7 @@ export var image_show := false setget set_image_show export var image_pos := Vector2(0, -95) setget set_image_pos onready var image := $Image -onready var area := $Area2D -onready var col_shape := $Area2D/CollisionShape2D +onready var col_shape := $CollisionShape2D var player = null var body = null @@ -75,7 +74,7 @@ func set_col_size(arg := col_size): func set_col_pos(arg := col_pos): col_pos = arg - if area: area.position = col_pos + if col_shape: col_shape.position = col_pos func set_image_show(arg := image_show): image_show = arg @@ -85,16 +84,18 @@ func set_image_pos(arg := image_pos): image_pos = arg if image: image.position = image_pos -func _on_Area2D_body_entered(_body): +func _on_body_entered(_body): body = _body try_active() + print(get_parent().name, " entered ", body, " is_active ", is_active) -func _on_Area2D_body_exited(_body): +func _on_body_exited(_body): + print(get_parent().name, " exited ", _body) body = null try_active() func try_active(): - if (is_active and (body != player or (player.dir != dir))) or (!is_active and body == player and player.dir == dir): + if (is_active and (body != player or player.dir != dir)) or (!is_active and body == player and player.dir == dir): is_active = !is_active emit_signal("activate") if is_active and Shared.arrow_track != self: diff --git a/src/actor/door/Arrow.tscn b/src/actor/door/Arrow.tscn index eb520e4..42d1791 100644 --- a/src/actor/door/Arrow.tscn +++ b/src/actor/door/Arrow.tscn @@ -8,14 +8,12 @@ resource_local_to_scene = true extents = Vector2( 40, 50 ) -[node name="Arrow" type="Node2D" groups=["door"]] -script = ExtResource( 1 ) - -[node name="Area2D" type="Area2D" parent="."] +[node name="Arrow" type="Area2D" groups=["door"]] collision_layer = 1024 collision_mask = 2 +script = ExtResource( 1 ) -[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"] +[node name="CollisionShape2D" type="CollisionShape2D" parent="."] visible = false shape = SubResource( 1 ) @@ -33,5 +31,5 @@ size = Vector2( 100, 100 ) radius = Plane( 60, -1, -1, -1 ) points = 4 -[connection signal="body_entered" from="Area2D" to="." method="_on_Area2D_body_entered"] -[connection signal="body_exited" from="Area2D" to="." method="_on_Area2D_body_exited"] +[connection signal="body_entered" from="." to="." method="_on_body_entered"] +[connection signal="body_exited" from="." to="." method="_on_body_exited"] diff --git a/src/autoload/Clouds.tscn b/src/autoload/Clouds.tscn index 2873471..82da627 100644 --- a/src/autoload/Clouds.tscn +++ b/src/autoload/Clouds.tscn @@ -159,7 +159,7 @@ transform_2d_array = PoolVector2Array( 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, z_index = -50 z_as_relative = false script = ExtResource( 2 ) -day_clock = 90.0 +day_clock = 150.0 orbit_distance = 400.0 cloud_bonus_rings = 2 snow_mat = SubResource( 16 ) @@ -167,7 +167,7 @@ snow_tex = ExtResource( 7 ) rain_mat = SubResource( 17 ) rain_tex = ExtResource( 6 ) is_rain = true -color_dark = Color( 0.878431, 0.878431, 1, 1 ) +color_dark = Color( 0.92, 0.92, 1, 1 ) [node name="BG" type="CanvasLayer" parent="."] layer = -5 diff --git a/src/map/worlds/1/0_hub.tscn b/src/map/worlds/1/0_hub.tscn index 3134aa0..c4ad3b8 100644 --- a/src/map/worlds/1/0_hub.tscn +++ b/src/map/worlds/1/0_hub.tscn @@ -521,11 +521,11 @@ position = Vector2( 950, 900 ) palette = 2 [node name="FlowerPetals11" parent="Details" instance=ExtResource( 4 )] -position = Vector2( 1235, 150 ) +position = Vector2( 1235, 160 ) palette = 2 [node name="FlowerPetals12" parent="Details" instance=ExtResource( 4 )] -position = Vector2( 1465, 150 ) +position = Vector2( 1465, 160 ) palette = 5 [node name="FlowerPetals5" parent="Details" instance=ExtResource( 4 )] diff --git a/src/map/worlds/2C/0_hub.tscn b/src/map/worlds/2C/0_hub.tscn index 60a6cb7..85591cb 100644 --- a/src/map/worlds/2C/0_hub.tscn +++ b/src/map/worlds/2C/0_hub.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=14 format=2] +[gd_scene load_steps=15 format=2] [ext_resource path="res://src/detail/PineTree.tscn" type="PackedScene" id=1] [ext_resource path="res://src/detail/Rocks.tscn" type="PackedScene" id=2] @@ -11,6 +11,7 @@ [ext_resource path="res://src/detail/Flower.tscn" type="PackedScene" id=9] [ext_resource path="res://src/detail/RockSquare.tscn" type="PackedScene" id=10] [ext_resource path="res://src/detail/RockCircle.tscn" type="PackedScene" id=11] +[ext_resource path="res://src/actor/Player.tscn" type="PackedScene" id=12] [ext_resource path="res://src/detail/Candle.tscn" type="PackedScene" id=13] [ext_resource path="res://src/detail/Snowman.tscn" type="PackedScene" id=14] @@ -74,6 +75,89 @@ dir = 2 scene_path = "res://src/map/worlds/0/2_end.tscn" gem_count = 50 +[node name="NPC" parent="Actors" instance=ExtResource( 12 )] +position = Vector2( 2450, 800 ) +dir = 3 +idle_anim = "invisible" +dye = { +"eye": 3, +"fit": 5, +"hair": 14, +"skin": 0 +} +hairstyle_back = 2 +hat = 3 +is_npc = true +lines = [ "Here I am!", "What gave me away? ;P", "Did you see me wiggle? d;", "It's quite cozy in here...", "It does get a little stinky... o:", "I've been hiding since morning!", "I'm supposed to be in class...", "I packed my own lunch! (-;", "Want a carrot?", "Find your own snowman!!.. Or we can share (;", "Hop in! The snow is fine ^.^" ] +greeting = 0 +chat_offset = Vector2( 0, -220 ) +ready_z_index = -50 + +[node name="NPC2" parent="Actors" instance=ExtResource( 12 )] +position = Vector2( 2750, 840 ) +dir = 1 +idle_anim = "bench" +dye = { +"eye": 3, +"fit": 5, +"hair": 14, +"skin": 0 +} +hairstyle_back = 2 +hat = 3 +is_npc = true +lines = [ "Hey! Come chill.. (:", "I hope I don't melt in the sun! ;P", "There's snow place I'd rather be! ^.^", "Look at this! Take it all in..", "What did we do to deserve such beauty? (:", "Join me for the sunrise! <3", "It's a lovely day to be outside! <3", "Remember to breathe...", "Starlight be praised!", "This is where I belong..." ] +greeting = 0 + +[node name="NPC3" parent="Actors" instance=ExtResource( 12 )] +position = Vector2( 1850, 1750 ) +dir = 2 +idle_anim = "snowball" +dye = { +"eye": 3, +"fit": 4, +"hair": 11, +"skin": 0 +} +hairstyle_back = 2 +hairstyle_front = 2 +hat = 3 +is_npc = true +lines = [ "Hey babe! (;", "Watch how far I can throw!! (=", "I'm throwing this one into orbit! ;P", "Look at her goooo!", "I'll knock that star out of the sky!!", "Check this out (;", "Take this!", "Witness the power of concentrated snow! 0=", "Oh they are going down!", "I'm the best snowballer around!! (:<" ] +greeting = 0 + +[node name="NPC4" parent="Actors" instance=ExtResource( 12 )] +position = Vector2( 2290, 1950 ) +idle_anim = "ponder" +is_idle_flip = true +dye = { +"eye": 16, +"fit": 12, +"hair": 3, +"skin": 0 +} +hairstyle_back = 3 +hairstyle_front = 7 +hat = 3 +is_npc = true +lines = [ "What's good!? ^.^", "You've come a long way!", "Few puzzlers make it out this far..", "What brings you so deep into the frost?", "I came here searching for more gems!", "It's nice to breathe some fresh air (:", "I've been stumped on this puzzle all day..", "Swap the two and slide one over.. hmm...", "These puzzles perplex me..", "A-ha! That might work.." ] +greeting = 0 + +[node name="NPC5" parent="Actors" instance=ExtResource( 12 )] +position = Vector2( 3000, 1550 ) +dir = 2 +idle_anim = "handstand" +dye = { +"eye": 0, +"fit": 17, +"hair": 10, +"skin": 5 +} +hairstyle_back = 3 +is_npc = true +lines = [ "Hey friend! (-:", "I'm giving my brain a break!", "All the blood is rushing to my head! 0=", "More blood flow = more brain power!!", "Wiggle your fingers and your toes! ;P", "I feel wild from all these puzzles!", "I had to get up and move my body!", "I gotta stay moving! (;", "Feel the balance!", "Let it happen... <3" ] +greeting = 0 + [node name="Details" type="Node2D" parent="."] [node name="Rocks" type="Node2D" parent="Details"]