From 3b835b78f1837935666b705206d2fee41b6ef9a5 Mon Sep 17 00:00:00 2001 From: Haze Weathers Date: Thu, 13 Jul 2023 11:41:10 -0400 Subject: [PATCH] make death liquids not cause blood splatter (closes #140) --- maps/canopy.tscn | 2 +- maps/graveyard.tscn | 14 +++++++++++--- maps/hills_scholar.tscn | 13 ++----------- maps/rust.tscn | 14 +++++++------- objects/player/player.gd | 15 +++++++++++---- tilesets/t_death.tres | 16 +++++++++++++--- 6 files changed, 45 insertions(+), 29 deletions(-) diff --git a/maps/canopy.tscn b/maps/canopy.tscn index b6f42ff..5b56266 100644 --- a/maps/canopy.tscn +++ b/maps/canopy.tscn @@ -63,7 +63,7 @@ cell_size = Vector2( 8, 8 ) format = 1 tile_data = PoolIntArray( 393303, 0, 1, 458839, 0, 1, 524375, 0, 1, 589911, 0, 1, 655367, 0, 1, 655447, 0, 1, 720903, 0, 1, 720983, 0, 1, 786519, 0, 1, 852055, 0, 1, 917516, 0, 1, 917591, 0, 1, 983052, 0, 1, 983127, 0, 1, 1048588, 0, 1, 1048663, 0, 1, 1114199, 0, 1, 1179735, 0, 1, 1245271, 0, 1 ) -[node name="Death" type="TileMap" parent="." groups=["death"]] +[node name="Death" type="TileMap" parent="." groups=["death", "no_blood"]] tile_set = ExtResource( 18 ) cell_size = Vector2( 8, 8 ) collision_layer = 32 diff --git a/maps/graveyard.tscn b/maps/graveyard.tscn index 018d85f..08ef819 100644 --- a/maps/graveyard.tscn +++ b/maps/graveyard.tscn @@ -60,16 +60,24 @@ cell_size = Vector2( 8, 8 ) collision_layer = 32 collision_mask = 0 format = 1 -tile_data = PoolIntArray( 196694, -1073741823, 0, 196696, -1610612735, 0, 262228, -1610612735, 0, 589914, -1073741823, 0, 720938, -1073741823, 0, 720971, -1073741823, 0, 786474, -1073741823, 0, 786520, 1, 0, 852006, -1073741823, 0, 852035, -1610612735, 0, 917542, -1073741823, 0, 1441831, 8, 0, 1441832, 8, 0, 1441833, 8, 0, 1441834, 8, 0, 1441835, 8, 0, 1441846, 8, 0, 1441847, 8, 0, 1441848, 8, 0, 1441849, 8, 0, 1441850, 8, 0, 1441866, 8, 0, 1441867, 8, 0, 1441868, 8, 0, 1441869, 8, 0, 1507367, 9, 0, 1507368, 9, 0, 1507369, 9, 0, 1507370, 9, 0, 1507371, 9, 0, 1507382, 9, 0, 1507383, 9, 0, 1507384, 9, 0, 1507385, 9, 0, 1507386, 9, 0, 1507402, 9, 0, 1507403, 9, 0, 1507404, 9, 0, 1507405, 9, 0 ) +tile_data = PoolIntArray( 196694, -1073741823, 0, 196696, -1610612735, 0, 262228, -1610612735, 0, 589914, -1073741823, 0, 720938, -1073741823, 0, 720971, -1073741823, 0, 786474, -1073741823, 0, 786520, 1, 0, 852006, -1073741823, 0, 852035, -1610612735, 0, 917542, -1073741823, 0 ) -[node name="DeathBackground" type="TileMap" parent="Death"] +[node name="DeathNoBlood" type="TileMap" parent="." groups=["death", "no_blood"]] +tile_set = ExtResource( 6 ) +cell_size = Vector2( 8, 8 ) +collision_layer = 32 +collision_mask = 0 +format = 1 +tile_data = PoolIntArray( 1441831, 8, 0, 1441832, 8, 0, 1441833, 8, 0, 1441834, 8, 0, 1441835, 8, 0, 1441846, 8, 0, 1441847, 8, 0, 1441848, 8, 0, 1441849, 8, 0, 1441850, 8, 0, 1441865, 8, 0, 1441866, 8, 0, 1441867, 8, 0, 1441868, 8, 0, 1441869, 8, 0, 1507367, 9, 0, 1507368, 9, 0, 1507369, 9, 0, 1507370, 9, 0, 1507371, 9, 0, 1507382, 9, 0, 1507383, 9, 0, 1507384, 9, 0, 1507385, 9, 0, 1507386, 9, 0, 1507401, 9, 0, 1507402, 9, 0, 1507403, 9, 0, 1507404, 9, 0, 1507405, 9, 0 ) + +[node name="DeathBackground" type="TileMap" parent="DeathNoBlood"] z_index = -1 tile_set = ExtResource( 6 ) cell_size = Vector2( 8, 8 ) collision_layer = 0 collision_mask = 0 format = 1 -tile_data = PoolIntArray( 1441830, 8, 0, 1441836, 8, 0, 1441845, 8, 0, 1441851, 8, 0, 1441864, 8, 0, 1441865, 8, 0, 1441870, 8, 0, 1507366, 9, 0, 1507372, 9, 0, 1507381, 9, 0, 1507387, 9, 0, 1507400, 9, 0, 1507401, 9, 0, 1507406, 9, 0 ) +tile_data = PoolIntArray( 1441830, 8, 0, 1441836, 8, 0, 1441845, 8, 0, 1441851, 8, 0, 1441864, 8, 0, 1441870, 8, 0, 1507366, 9, 0, 1507372, 9, 0, 1507381, 9, 0, 1507387, 9, 0, 1507400, 9, 0, 1507406, 9, 0 ) [node name="Environment" type="Node2D" parent="."] diff --git a/maps/hills_scholar.tscn b/maps/hills_scholar.tscn index 0d71b20..33d7e00 100644 --- a/maps/hills_scholar.tscn +++ b/maps/hills_scholar.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=28 format=2] +[gd_scene load_steps=27 format=2] [ext_resource path="res://objects/environment/ladder/ladder.tscn" type="PackedScene" id=1] [ext_resource path="res://objects/hud/hud.tscn" type="PackedScene" id=2] @@ -9,7 +9,6 @@ [ext_resource path="res://graphics/backgrounds/blue_sky.png" type="Texture" id=7] [ext_resource path="res://tilesets/t_grass.tres" type="TileSet" id=8] [ext_resource path="res://tilesets/t_death.tres" type="TileSet" id=9] -[ext_resource path="res://objects/environment/death tile/death_tile.tscn" type="PackedScene" id=10] [ext_resource path="res://objects/environment/moving_platform/moving_platform.tscn" type="PackedScene" id=11] [ext_resource path="res://objects/enemy/bat.tscn" type="PackedScene" id=12] [ext_resource path="res://objects/environment/barrier/barrier.tscn" type="PackedScene" id=13] @@ -63,7 +62,7 @@ tile_data = PoolIntArray( 65535, 3, 0, 96, 3, 0, 131071, 3, 65536, 65632, 3, 655 [node name="Player" parent="." instance=ExtResource( 26 )] position = Vector2( 24, 176 ) -[node name="Death" type="TileMap" parent="." groups=["death"]] +[node name="Death" type="TileMap" parent="." groups=["death", "no_blood"]] tile_set = ExtResource( 9 ) cell_size = Vector2( 8, 8 ) collision_layer = 32 @@ -128,14 +127,6 @@ position = Vector2( 616, 160 ) position = Vector2( 408, 152 ) time = 80.0 -[node name="DeathTile" parent="Environment" instance=ExtResource( 10 )] -position = Vector2( 176, 192 ) -scale = Vector2( 3, 1 ) - -[node name="DeathTile2" parent="Environment" instance=ExtResource( 10 )] -position = Vector2( 360, 192 ) -scale = Vector2( 8, 1 ) - [node name="MovingPlatform" parent="Environment" instance=ExtResource( 11 )] position = Vector2( 624, 40 ) scale = Vector2( 2, 1 ) diff --git a/maps/rust.tscn b/maps/rust.tscn index fe836bd..5bb5fae 100644 --- a/maps/rust.tscn +++ b/maps/rust.tscn @@ -56,13 +56,6 @@ tile_data = PoolIntArray( 48, 0, 0, 65584, 0, 0, 131120, 0, 0, 196614, 0, 0, 196 position = Vector2( 24, 176 ) [node name="Death" type="TileMap" parent="." groups=["death"]] -tile_set = ExtResource( 16 ) -cell_size = Vector2( 8, 8 ) -collision_layer = 32 -format = 1 -tile_data = PoolIntArray( 1441838, 7, 0, 1441839, 7, 0, 1441840, 7, 0, 1441841, 7, 0, 1441842, 7, 0, 1441847, 7, 0, 1441848, 7, 0, 1441849, 7, 0, 1441850, 7, 0, 1441851, 7, 0, 1441852, 7, 0, 1441868, 7, 0, 1441869, 7, 0, 1441870, 7, 0, 1441871, 7, 0, 1441872, 7, 0, 1441873, 7, 0, 1441874, 7, 0, 1441875, 7, 0, 1441876, 7, 0, 1441877, 7, 0, 1441878, 7, 0, 1441879, 7, 0, 1441880, 7, 0, 1441881, 7, 0, 1507374, 6, 0, 1507375, 6, 0, 1507376, 6, 0, 1507377, 6, 0, 1507378, 6, 0, 1507383, 6, 0, 1507384, 6, 0, 1507385, 6, 0, 1507386, 6, 0, 1507387, 6, 0, 1507388, 6, 0, 1507404, 6, 0, 1507405, 6, 0, 1507406, 6, 0, 1507407, 6, 0, 1507408, 6, 0, 1507409, 6, 0, 1507410, 6, 0, 1507411, 6, 0, 1507412, 6, 0, 1507413, 6, 0, 1507414, 6, 0, 1507415, 6, 0, 1507416, 6, 0, 1507417, 6, 0 ) - -[node name="Death2" type="TileMap" parent="." groups=["death"]] position = Vector2( 0, 1 ) tile_set = ExtResource( 16 ) cell_size = Vector2( 8, 8 ) @@ -70,6 +63,13 @@ collision_layer = 32 format = 1 tile_data = PoolIntArray( 262157, 1, 0, 262161, 1, 0, 262168, 1, 0, 262172, 1, 0, 393254, 1, 0, 393255, 1, 0, 393256, 1, 0, 393257, 1, 0, 393258, 1, 0, 393259, 1, 0, 393260, 1, 0, 393261, 1, 0, 393262, 1, 0 ) +[node name="DeathNoBlood" type="TileMap" parent="." groups=["death", "no_blood"]] +tile_set = ExtResource( 16 ) +cell_size = Vector2( 8, 8 ) +collision_layer = 32 +format = 1 +tile_data = PoolIntArray( 1441838, 7, 0, 1441839, 7, 0, 1441840, 7, 0, 1441841, 7, 0, 1441842, 7, 0, 1441847, 7, 0, 1441848, 7, 0, 1441849, 7, 0, 1441850, 7, 0, 1441851, 7, 0, 1441852, 7, 0, 1441868, 7, 0, 1441869, 7, 0, 1441870, 7, 0, 1441871, 7, 0, 1441872, 7, 0, 1441873, 7, 0, 1441874, 7, 0, 1441875, 7, 0, 1441876, 7, 0, 1441877, 7, 0, 1441878, 7, 0, 1441879, 7, 0, 1441880, 7, 0, 1441881, 7, 0, 1507374, 6, 0, 1507375, 6, 0, 1507376, 6, 0, 1507377, 6, 0, 1507378, 6, 0, 1507383, 6, 0, 1507384, 6, 0, 1507385, 6, 0, 1507386, 6, 0, 1507387, 6, 0, 1507388, 6, 0, 1507404, 6, 0, 1507405, 6, 0, 1507406, 6, 0, 1507407, 6, 0, 1507408, 6, 0, 1507409, 6, 0, 1507410, 6, 0, 1507411, 6, 0, 1507412, 6, 0, 1507413, 6, 0, 1507414, 6, 0, 1507415, 6, 0, 1507416, 6, 0, 1507417, 6, 0 ) + [node name="Ladder" type="TileMap" parent="."] tile_set = ExtResource( 23 ) cell_size = Vector2( 8, 8 ) diff --git a/objects/player/player.gd b/objects/player/player.gd index 924dd29..f933cc9 100644 --- a/objects/player/player.gd +++ b/objects/player/player.gd @@ -37,6 +37,8 @@ var velocity: Vector2 = Vector2.ZERO var snap: Vector2 = Vector2.ZERO # ladder currently attached to var _attached_ladder: Node2D = null +# whether to skip blood splatter for this death +var skip_blood: bool = false # NODE REFERENCES # @@ -250,10 +252,13 @@ func _on_Dead_state_entered() -> void: emit_signal("died") state_chart.send_event("died") # spawn death particles - var particles = DeathSplatter.instance() - particles.global_position = death_splatter_position.global_position - particles.emitting = true - get_parent().add_child(particles) + if not skip_blood: + var particles = DeathSplatter.instance() + particles.global_position = death_splatter_position.global_position + particles.emitting = true + get_parent().add_child(particles) + else: + skip_blood = false # fade into the ether graphics.visible = false state_chart.send_event("respawn") @@ -427,6 +432,8 @@ func _process_floating_up(delta: float) -> void: # COLLISION CALLBACKS # func _on_Hitbox_body_entered(body: Node) -> void: if body.is_in_group("death"): + if body.is_in_group("no_blood"): + skip_blood = true die() diff --git a/tilesets/t_death.tres b/tilesets/t_death.tres index 0d383cd..d9e8f2e 100644 --- a/tilesets/t_death.tres +++ b/tilesets/t_death.tres @@ -1,4 +1,4 @@ -[gd_resource type="TileSet" load_steps=14 format=2] +[gd_resource type="TileSet" load_steps=15 format=2] [ext_resource path="res://graphics/tiles/water.tres" type="Texture" id=1] [ext_resource path="res://graphics/tiles/spike.png" type="Texture" id=2] @@ -13,6 +13,9 @@ [sub_resource type="ConvexPolygonShape2D" id=1] points = PoolVector2Array( 7, 8, 1, 8, 1, 2, 7, 2 ) +[sub_resource type="ConvexPolygonShape2D" id=7] +points = PoolVector2Array( 8, 8, 0, 8, 0, 0, 8, 0 ) + [sub_resource type="ConvexPolygonShape2D" id=2] points = PoolVector2Array( 8, 8, 0, 8, 0, 0, 8, 0 ) @@ -222,7 +225,14 @@ points = PoolVector2Array( 8, 8, 0, 8, 0, 0, 8, 0 ) 11/navigation_offset = Vector2( 0, 0 ) 11/shape_offset = Vector2( 0, 0 ) 11/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 ) +11/shape = SubResource( 7 ) 11/shape_one_way = false -11/shape_one_way_margin = 0.0 -11/shapes = [ ] +11/shape_one_way_margin = 1.0 +11/shapes = [ { +"autotile_coord": Vector2( 0, 0 ), +"one_way": false, +"one_way_margin": 1.0, +"shape": SubResource( 7 ), +"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 ) +} ] 11/z_index = 0