From c25382dd833c0e9655a074f035c7b1e151fba5a2 Mon Sep 17 00:00:00 2001 From: Haze Weathers Date: Sat, 7 Oct 2023 21:43:05 -0400 Subject: [PATCH] exit teleport animation :) --- graphics/player/sg_particles_mask.png | Bin 0 -> 4463 bytes graphics/player/sg_particles_mask.png.import | 35 ++++++++++++++++ objects/environment/exit/exit.gd | 9 +++- objects/environment/exit/exit.tscn | 9 ++-- objects/player/player.gd | 15 +++++++ objects/player/player.tscn | 41 ++++++++++++++++++- 6 files changed, 100 insertions(+), 9 deletions(-) create mode 100644 graphics/player/sg_particles_mask.png create mode 100644 graphics/player/sg_particles_mask.png.import diff --git a/graphics/player/sg_particles_mask.png b/graphics/player/sg_particles_mask.png new file mode 100644 index 0000000000000000000000000000000000000000..fd4b40dba462d3487b3a618c148424518deb2316 GIT binary patch literal 4463 zcmeHKe^38PZl5=HCC|+%vtJ6DwaHAm?qm)T&;*4&2M5c^ zM);$SfsXk6UhO@~}hZ3_|wW6}Db*N+I zhjW5YKL|M7{^)jQ-EqA*vex(C*^36q*}{ju508Ge?bTID&t?f@{4$FFoXuVr#_HL^ zPlo2Ap9W`Tx#V=nr(gK&Iz0QI$~o zg?nluxBhLQ@5|eN_|L{aeccz5p6K|X0Ogi|s&g}-y4D-s!b#RDA}H2Gi`-T_C_8~5 zI@WC`NDIwDCOVg~so_VTwZafXso@N{0X5h)bRMHCcF?KCNoi!Ug;Y^+Y)oLZ8wUVZ znj;{$HQ(mM-D=p2i-SHd7Q>L>MsO^#&uPVI4Fi6Ujs<67OaTC2&k26z!nQc#1Y* z6atLYa306mak1Fta*1405$nhmV=9$Oj7r232?8t-XOWE~+=$J&l!q9>(9%xQ!Pq&5 zwLv^4VPXq7H4FniG!~!LZZM3)+nl2;06xTS!Y;-{sMu;1Pxf$f@r3|nG@u{#aHfGx zDo&xDY=MKM;|pmUw{$WDMUMO13mp00bSP3x=hIeT>IAc5Q>IMR8;s)~JO#Oo)$a8I zWKXf=81n>KQ)1&a-gG7h0^G-Or&y2W?llHh1_Q2T$pSt+y;cqL^WzjtG8FFZ5)`GB zDrqwkr2@+#lVcLZWTGiVDyI~bijaK z8Lhw&!X#557;RF@NwXX%u}Kig4hB>ukv};q9*P1`awRE~U}hD9$t5HrGfATmLSaG? zj3iVt87h&XCb<`iBJl*)VI{zFGFBp&7TayPUIkA$9%t06VTlNxkQnm`&I}yX@LPqukSd^OC61o58ZY6I9#6u}W%f};T_Dv{zCilfRj35KIG&_}=zJJRky0Q~nTn8*N<>LTDL^&J&4`IsfF5d=sN_*5g$h$lMR&4h&P6!r zxLm*^;0lzdmn&$wccCJuTD$USeiZ;=2v5=v2osMcEauOQv5cd|Kj0+VYcT1M0e&Mg zaCm{UP&|GZj&jByJ3nC?U5lS^1^_)X$+Y;Lp=*Y&X)!P@Pr+q6La&WWi|Qn)wvg|?sv?(VzI5x<@VbTjYkQOK^jy{MBc5EY ze^0pf`}r2Afe0AruYUdJ>ZmqTSWMfSI-eAG`=+v$344ODb9aY-QE%iTj)q|(?VQ8I z83P#j5l3Yi-6gN|K94Ow@^R^bti4(O0c&&HTe@{7{h^Mw`a`9$UEiMB+w^dj zXZVevUDd<-*~&-RWDaQS8#!N5Qe#kf6?ysvq$Out7Ivld>fKYj|8mx)63O>0JErjm zZNY2XcdZ%}N%;BdSG--dXxHu|{su|Ym6|&xm6m_y%=PFt-_$r3biF?$*z6bn$*;mP ztDnbVdyJTd=69_<38CGp=lv`EK=YKZ>bvwt)8z(VfvSs^H;O{L0dWF-e3JI$ In>i)_1yjmZ@c;k- literal 0 HcmV?d00001 diff --git a/graphics/player/sg_particles_mask.png.import b/graphics/player/sg_particles_mask.png.import new file mode 100644 index 0000000..d2e7566 --- /dev/null +++ b/graphics/player/sg_particles_mask.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/sg_particles_mask.png-c9c7f43473087b6f629bc945f72d141f.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://graphics/player/sg_particles_mask.png" +dest_files=[ "res://.import/sg_particles_mask.png-c9c7f43473087b6f629bc945f72d141f.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=false +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +process/normal_map_invert_y=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/objects/environment/exit/exit.gd b/objects/environment/exit/exit.gd index 93df2e1..2f75907 100644 --- a/objects/environment/exit/exit.gd +++ b/objects/environment/exit/exit.gd @@ -21,5 +21,10 @@ func _physics_process(delta): func _on_Area2D_area_entered(area): if area.is_in_group("player_hitbox"): - Game.tally_scores() - SceneManager.change_scene(preload("res://menus/results.tscn").instance()) + var player = area.get_parent() + player.state_chart.send_event("start_teleport") + player.connect("teleport_finished", self, "_on_player_teleport_finished") + +func _on_player_teleport_finished(): + Game.tally_scores() + SceneManager.change_scene(preload("res://menus/results.tscn").instance()) diff --git a/objects/environment/exit/exit.tscn b/objects/environment/exit/exit.tscn index 9dafa27..43c058b 100644 --- a/objects/environment/exit/exit.tscn +++ b/objects/environment/exit/exit.tscn @@ -27,8 +27,8 @@ interpolation_mode = 1 offsets = PoolRealArray( 0, 0.5 ) colors = PoolColorArray( 0.345098, 0.74902, 0.878431, 1, 0.396078, 1, 1, 1 ) -[sub_resource type="RectangleShape2D" id=12] -extents = Vector2( 1, 1 ) +[sub_resource type="SegmentShape2D" id=12] +b = Vector2( 0, 15 ) [sub_resource type="RectangleShape2D" id=7] extents = Vector2( 7, 7.5 ) @@ -91,10 +91,9 @@ theme = ExtResource( 1 ) text = "ΒΆ22" [node name="DetectPlayer" type="Area2D" parent="."] -z_index = -3 -[node name="CollisionShape2D" type="CollisionShape2D" parent="DetectPlayer"] -position = Vector2( 0, 11 ) +[node name="CollisionShape" type="CollisionShape2D" parent="DetectPlayer"] +position = Vector2( 0, -3 ) shape = SubResource( 12 ) [node name="Collision" type="StaticBody2D" parent="." groups=["can_stain"]] diff --git a/objects/player/player.gd b/objects/player/player.gd index 286f2e1..970ca47 100644 --- a/objects/player/player.gd +++ b/objects/player/player.gd @@ -2,6 +2,7 @@ extends KinematicBody2D # SIGNALS # signal died() +signal teleport_finished() # CONSTANTS # const ArrowProjectile = preload("res://objects/player/arrow_projectile.tscn") @@ -317,6 +318,20 @@ func _on_Inactive_state_entered() -> void: func _on_Inactive_state_exited() -> void: body_shape.disabled = false +func _on_Teleporting_state_entered() -> void: + velocity = Vector2.ZERO + animation_player.play("idle") + var tween = create_tween() + for i in 8: + tween.tween_property(sprite, "position:x", 1.0, 0.0333333) + tween.tween_property(sprite, "position:x", -1.0, 0.0333333) + tween.tween_property(sprite, "position:x", 0.0, 0.0666667) + yield(tween, "finished") + sprite.visible = false + $"%DissolveParticles".emitting = true + yield(get_tree().create_timer(1.0, false), "timeout") + emit_signal("teleport_finished") + # STATE PROCESSING # ## when on ground diff --git a/objects/player/player.tscn b/objects/player/player.tscn index ac130fb..10c39f9 100644 --- a/objects/player/player.tscn +++ b/objects/player/player.tscn @@ -1029,6 +1029,24 @@ material = SubResource( 1 ) position = Vector2( 0, -10 ) texture = ExtResource( 4 ) +[node name="DissolveParticles" type="CPUParticles2D" parent="Graphics"] +unique_name_in_owner = true +position = Vector2( -9.5, -19.5 ) +emitting = false +amount = 256 +lifetime = 0.8 +one_shot = true +explosiveness = 1.0 +lifetime_randomness = 1.0 +emission_shape = 3 +emission_points = PoolVector2Array( 4, 6, 4, 7, 4, 8, 4, 9, 4, 10, 5, 2, 5, 3, 5, 4, 5, 5, 5, 6, 5, 7, 5, 8, 5, 9, 5, 10, 5, 11, 6, 1, 6, 2, 6, 3, 6, 4, 6, 5, 6, 6, 6, 7, 6, 8, 6, 9, 6, 10, 6, 11, 6, 12, 6, 13, 6, 14, 6, 15, 6, 16, 7, 0, 7, 1, 7, 2, 7, 3, 7, 4, 7, 5, 7, 6, 7, 7, 7, 8, 7, 9, 7, 10, 7, 11, 7, 12, 7, 13, 7, 14, 7, 15, 7, 16, 7, 17, 7, 18, 7, 19, 8, 0, 8, 1, 8, 2, 8, 3, 8, 4, 8, 5, 8, 6, 8, 7, 8, 8, 8, 9, 8, 10, 8, 11, 8, 12, 8, 13, 8, 14, 8, 15, 8, 16, 8, 17, 8, 18, 8, 19, 9, 0, 9, 1, 9, 2, 9, 3, 9, 4, 9, 5, 9, 6, 9, 7, 9, 8, 9, 9, 9, 10, 9, 11, 9, 12, 9, 13, 9, 14, 9, 15, 9, 16, 9, 17, 9, 18, 9, 19, 10, 0, 10, 1, 10, 2, 10, 3, 10, 4, 10, 5, 10, 6, 10, 7, 10, 8, 10, 9, 10, 10, 10, 11, 10, 12, 10, 13, 10, 14, 10, 15, 10, 16, 10, 17, 10, 18, 10, 19, 11, 0, 11, 1, 11, 2, 11, 3, 11, 4, 11, 5, 11, 6, 11, 7, 11, 8, 11, 9, 11, 10, 11, 11, 11, 12, 11, 13, 11, 14, 11, 15, 11, 16, 11, 17, 11, 18, 11, 19, 12, 0, 12, 1, 12, 2, 12, 3, 12, 4, 12, 5, 12, 6, 12, 7, 12, 8, 12, 9, 12, 10, 12, 11, 12, 12, 12, 13, 12, 14, 12, 15, 12, 16, 12, 17, 12, 18, 12, 19, 13, 0, 13, 1, 13, 2, 13, 3, 13, 4, 13, 5, 13, 6, 13, 7, 13, 8, 13, 9, 13, 10, 13, 11, 13, 12, 13, 13, 13, 14, 13, 15, 13, 16, 13, 17, 13, 18, 13, 19, 14, 1, 14, 2, 14, 3, 14, 4, 14, 5, 14, 6, 14, 7, 14, 8, 14, 9, 14, 10, 14, 11, 15, 2, 15, 3, 15, 4, 15, 5, 15, 6, 15, 7, 15, 8, 15, 9, 15, 10, 15, 11 ) +emission_colors = PoolColorArray( 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0.478431, 0.219608, 1, 0, 0, 0, 1, 1, 0.478431, 0.219608, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0.478431, 0.219608, 1, 1, 0.478431, 0.219608, 1, 1, 0.478431, 0.219608, 1, 1, 0.478431, 0.219608, 1, 1, 0.478431, 0.219608, 1, 1, 0.478431, 0.219608, 1, 1, 0.478431, 0.219608, 1, 1, 0.478431, 0.219608, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0.478431, 0.219608, 1, 1, 0.478431, 0.219608, 1, 1, 0.478431, 0.219608, 1, 1, 0.478431, 0.219608, 1, 1, 0.478431, 0.219608, 1, 1, 0.478431, 0.219608, 1, 1, 0.478431, 0.219608, 1, 1, 0.478431, 0.219608, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0.513726, 0.47451, 0.603922, 1, 0.513726, 0.47451, 0.603922, 1, 1, 0.835294, 0.619608, 1, 1, 0.835294, 0.619608, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0.478431, 0.219608, 1, 1, 0.478431, 0.219608, 1, 1, 0.72549, 0.607843, 1, 1, 0.478431, 0.219608, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0.835294, 0.619608, 1, 1, 0.478431, 0.219608, 1, 1, 0.835294, 0.619608, 1, 1, 0.478431, 0.219608, 1, 0.513726, 0.47451, 0.603922, 1, 0.513726, 0.47451, 0.603922, 1, 0.513726, 0.47451, 0.603922, 1, 1, 0.835294, 0.619608, 1, 1, 0.835294, 0.619608, 1, 0.513726, 0.47451, 0.603922, 1, 0.513726, 0.47451, 0.603922, 1, 0.458824, 0.235294, 0.0823529, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0.478431, 0.219608, 1, 1, 0.72549, 0.607843, 1, 1, 0.478431, 0.219608, 1, 1, 0.478431, 0.219608, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.835294, 0.619608, 1, 1, 0.835294, 0.619608, 1, 0.513726, 0.47451, 0.603922, 1, 0.513726, 0.47451, 0.603922, 1, 0.219608, 0.211765, 0.254902, 1, 0.360784, 0.345098, 0.439216, 1, 0.360784, 0.345098, 0.439216, 1, 0.513726, 0.47451, 0.603922, 1, 0.513726, 0.47451, 0.603922, 1, 0.513726, 0.47451, 0.603922, 1, 0.458824, 0.235294, 0.0823529, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0.478431, 0.219608, 1, 1, 0.478431, 0.219608, 1, 1, 0.478431, 0.219608, 1, 1, 0.478431, 0.219608, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0.513726, 0.47451, 0.603922, 1, 1, 0.835294, 0.619608, 1, 1, 0.835294, 0.619608, 1, 0.360784, 0.345098, 0.439216, 1, 0.360784, 0.345098, 0.439216, 1, 0.360784, 0.345098, 0.439216, 1, 0.219608, 0.211765, 0.254902, 1, 0.360784, 0.345098, 0.439216, 1, 0.360784, 0.345098, 0.439216, 1, 0.219608, 0.211765, 0.254902, 1, 0.219608, 0.211765, 0.254902, 1, 0.458824, 0.235294, 0.0823529, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0.478431, 0.219608, 1, 1, 0.478431, 0.219608, 1, 1, 0.478431, 0.219608, 1, 1, 0.478431, 0.219608, 1, 1, 0.478431, 0.219608, 1, 1, 0.835294, 0.619608, 1, 1, 0.835294, 0.619608, 1, 1, 0.835294, 0.619608, 1, 0, 0, 0, 1, 0.360784, 0.345098, 0.439216, 1, 0.360784, 0.345098, 0.439216, 1, 0.360784, 0.345098, 0.439216, 1, 0.219608, 0.211765, 0.254902, 1, 0.360784, 0.345098, 0.439216, 1, 0.219608, 0.211765, 0.254902, 1, 0.219608, 0.211765, 0.254902, 1, 0.219608, 0.211765, 0.254902, 1, 0.219608, 0.141176, 0.0392157, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0.478431, 0.219608, 1, 1, 0.478431, 0.219608, 1, 1, 0.478431, 0.219608, 1, 1, 0.478431, 0.219608, 1, 1, 0.478431, 0.219608, 1, 1, 0.478431, 0.219608, 1, 1, 0.835294, 0.619608, 1, 1, 0.835294, 0.619608, 1, 0, 0, 0, 1, 1, 0.478431, 0.219608, 1, 0.513726, 0.47451, 0.603922, 1, 0.513726, 0.47451, 0.603922, 1, 0.513726, 0.47451, 0.603922, 1, 1, 0.835294, 0.619608, 1, 1, 0.835294, 0.619608, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0.219608, 0.141176, 0.0392157, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0.478431, 0.219608, 1, 1, 0.478431, 0.219608, 1, 1, 0.478431, 0.219608, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0.513726, 0.47451, 0.603922, 1, 1, 0.835294, 0.619608, 1, 1, 0.835294, 0.619608, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0.478431, 0.219608, 1, 1, 0.478431, 0.219608, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.478431, 0.219608, 1, 1, 0.478431, 0.219608, 1, 1, 0.478431, 0.219608, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1 ) +direction = Vector2( 0, -1 ) +spread = 15.0 +gravity = Vector2( 0, 0 ) +initial_velocity = 4.0 +initial_velocity_random = 1.0 + [node name="ArrowPosition" type="Position2D" parent="Graphics"] unique_name_in_owner = true position = Vector2( 5, -7 ) @@ -1152,6 +1170,11 @@ script = ExtResource( 10 ) to = NodePath("../Inactive") event = "died" +[node name="On StartTeleport" type="Node" parent="StateChart/Root/Movement"] +script = ExtResource( 10 ) +to = NodePath("../Teleporting") +event = "start_teleport" + [node name="Grounded" type="Node" parent="StateChart/Root/Movement"] script = ExtResource( 9 ) __meta__ = { @@ -1431,7 +1454,18 @@ __meta__ = { "_editor_description_": "player can not move or do anything, immobile" } -[node name="On Respawn" type="Node" parent="StateChart/Root/Movement/Inactive"] +[node name="On GetReal" type="Node" parent="StateChart/Root/Movement/Inactive"] +script = ExtResource( 10 ) +to = NodePath("../../Grounded") +event = "get_real" + +[node name="Teleporting" type="Node" parent="StateChart/Root/Movement"] +script = ExtResource( 11 ) +__meta__ = { +"_editor_description_": "player can not move or do anything, immobile" +} + +[node name="On GetReal" type="Node" parent="StateChart/Root/Movement/Teleporting"] script = ExtResource( 10 ) to = NodePath("../../Grounded") event = "get_real" @@ -1542,8 +1576,8 @@ align = 1 [connection signal="state_physics_processing" from="StateChart/Root/Movement" to="." method="_process_movement"] [connection signal="state_entered" from="StateChart/Root/Movement/Grounded" to="." method="_on_Grounded_state_entered"] [connection signal="state_physics_processing" from="StateChart/Root/Movement/Grounded" to="." method="_process_grounded"] -[connection signal="state_physics_processing" from="StateChart/Root/Movement/Grounded/CanWalk" to="." method="_process_can_walk"] [connection signal="state_physics_processing" from="StateChart/Root/Movement/Grounded/CanWalk" to="." method="_process_horizontal_movement_grounded"] +[connection signal="state_physics_processing" from="StateChart/Root/Movement/Grounded/CanWalk" to="." method="_process_can_walk"] [connection signal="state_entered" from="StateChart/Root/Movement/Grounded/CanWalk/Still" to="." method="_on_Still_state_entered"] [connection signal="state_entered" from="StateChart/Root/Movement/Grounded/CanWalk/Walking" to="." method="_on_Walking_state_entered"] [connection signal="state_entered" from="StateChart/Root/Movement/Grounded/CanWalk/Blinking" to="." method="_on_Blinking_state_entered"] @@ -1577,6 +1611,9 @@ align = 1 [connection signal="state_physics_processing" from="StateChart/Root/Movement/Climbing" to="." method="_process_climbing"] [connection signal="state_entered" from="StateChart/Root/Movement/Inactive" to="." method="_on_Inactive_state_entered"] [connection signal="state_exited" from="StateChart/Root/Movement/Inactive" to="." method="_on_Inactive_state_exited"] +[connection signal="state_entered" from="StateChart/Root/Movement/Teleporting" to="." method="_on_Inactive_state_entered"] +[connection signal="state_entered" from="StateChart/Root/Movement/Teleporting" to="." method="_on_Teleporting_state_entered"] +[connection signal="state_exited" from="StateChart/Root/Movement/Teleporting" to="." method="_on_Inactive_state_exited"] [connection signal="state_entered" from="StateChart/Root/Health/Respawn" to="." method="_on_Respawn_state_entered"] [connection signal="state_entered" from="StateChart/Root/Health/Dead" to="." method="_on_Dead_state_entered"] [connection signal="state_entered" from="StateChart/Root/Health/Drowning" to="." method="_on_Drowning_state_entered"]