falling blocks can crush sg!

This commit is contained in:
pennyrigate 2023-01-27 05:53:33 -05:00
parent e541e6ea5e
commit f8ce5ee5cf
3 changed files with 38 additions and 9 deletions

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=14 format=2]
[gd_scene load_steps=15 format=2]
[ext_resource path="res://objects/player/player.tscn" type="PackedScene" id=1]
[ext_resource path="res://tilesets/t_cave.tres" type="TileSet" id=2]
@ -13,6 +13,7 @@
[ext_resource path="res://maps/map.gd" type="Script" id=11]
[ext_resource path="res://objects/environment/turniwood/turning_platform.tscn" type="PackedScene" id=12]
[ext_resource path="res://objects/collectibles/arrow.tscn" type="PackedScene" id=13]
[ext_resource path="res://objects/environment/falling_block/falling_block.tscn" type="PackedScene" id=14]
[node name="Map" type="Node2D" groups=["map"]]
script = ExtResource( 11 )
@ -36,7 +37,7 @@ tile_set = ExtResource( 3 )
cell_size = Vector2( 8, 8 )
collision_layer = 9
format = 1
tile_data = PoolIntArray( 786454, 0, 65537, 786455, 0, 65537, 851990, 0, 65537, 917526, 0, 65537, 983052, 0, 65537, 983053, 0, 65537, 983061, 0, 65537, 983062, 0, 65537, 1048591, 0, 65537, 1048592, 0, 65537, 1048593, 0, 65537, 1048594, 0, 65537, 1114127, 0, 65537, 1179663, 0, 65537, 1245199, 0, 65537, 1310732, 0, 65537, 1310733, 0, 65537, 1310734, 0, 65537, 1310735, 0, 65537, 1441792, 0, 0, 1441793, 0, 0, 1441794, 0, 0, 1441795, 0, 0, 1441796, 0, 0, 1441797, 0, 0, 1441798, 0, 0, 1441799, 0, 0, 1441800, 0, 0, 1441801, 0, 0, 1441802, 0, 0, 1441803, 0, 0, 1441804, 0, 0, 1441805, 0, 0, 1441806, 0, 0, 1441807, 0, 0, 1441808, 0, 0, 1441809, 0, 0, 1441810, 0, 0, 1441811, 0, 0, 1441812, 0, 0, 1441813, 0, 0, 1441814, 0, 0, 1441815, 0, 0, 1441816, 0, 0, 1441817, 0, 0, 1441818, 0, 0, 1441819, 0, 0, 1441820, 0, 0, 1441821, 0, 0, 1441822, 0, 0, 1441823, 0, 0, 1507328, 0, 65537, 1507329, 0, 65537, 1507330, 0, 65537, 1507331, 0, 65537, 1507332, 0, 65537, 1507333, 0, 65537, 1507334, 0, 65537, 1507335, 0, 65537, 1507336, 0, 65537, 1507337, 0, 65537, 1507338, 0, 65537, 1507339, 0, 65537, 1507340, 0, 65537, 1507341, 0, 65537, 1507342, 0, 65537, 1507343, 0, 65537, 1507344, 0, 65537, 1507345, 0, 65537, 1507346, 0, 65537, 1507347, 0, 65537, 1507348, 0, 65537, 1507349, 0, 65537, 1507350, 0, 65537, 1507351, 0, 65537, 1507352, 0, 65537, 1507353, 0, 65537, 1507354, 0, 65537, 1507355, 0, 65537, 1507356, 0, 65537, 1507357, 0, 65537, 1507358, 0, 65537, 1507359, 0, 65537 )
tile_data = PoolIntArray( 917526, 0, 65537, 917527, 0, 65537, 983052, 0, 65537, 983053, 0, 65537, 983062, 0, 65537, 1048591, 0, 65537, 1048592, 0, 65537, 1048593, 0, 65537, 1048594, 0, 65537, 1048597, 0, 65537, 1048598, 0, 65537, 1114127, 0, 65537, 1179663, 0, 65537, 1245199, 0, 65537, 1310732, 0, 65537, 1310733, 0, 65537, 1310734, 0, 65537, 1310735, 0, 65537, 1441792, 0, 0, 1441793, 0, 0, 1441794, 0, 0, 1441795, 0, 0, 1441796, 0, 0, 1441797, 0, 0, 1441798, 0, 0, 1441799, 0, 0, 1441800, 0, 0, 1441801, 0, 0, 1441802, 0, 0, 1441803, 0, 0, 1441804, 0, 0, 1441805, 0, 0, 1441806, 0, 0, 1441807, 0, 0, 1441808, 0, 0, 1441809, 0, 0, 1441810, 0, 0, 1441811, 0, 0, 1441812, 0, 0, 1441813, 0, 0, 1441814, 0, 0, 1441815, 0, 0, 1441816, 0, 0, 1441817, 0, 0, 1441818, 0, 0, 1441819, 0, 0, 1441820, 0, 0, 1441821, 0, 0, 1441822, 0, 0, 1441823, 0, 0, 1507328, 0, 65537, 1507329, 0, 65537, 1507330, 0, 65537, 1507331, 0, 65537, 1507332, 0, 65537, 1507333, 0, 65537, 1507334, 0, 65537, 1507335, 0, 65537, 1507336, 0, 65537, 1507337, 0, 65537, 1507338, 0, 65537, 1507339, 0, 65537, 1507340, 0, 65537, 1507341, 0, 65537, 1507342, 0, 65537, 1507343, 0, 65537, 1507344, 0, 65537, 1507345, 0, 65537, 1507346, 0, 65537, 1507347, 0, 65537, 1507348, 0, 65537, 1507349, 0, 65537, 1507350, 0, 65537, 1507351, 0, 65537, 1507352, 0, 65537, 1507353, 0, 65537, 1507354, 0, 65537, 1507355, 0, 65537, 1507356, 0, 65537, 1507357, 0, 65537, 1507358, 0, 65537, 1507359, 0, 65537 )
[node name="Rock" parent="." instance=ExtResource( 9 )]
position = Vector2( 120, 120 )
@ -47,6 +48,15 @@ position = Vector2( 264, 168 )
[node name="Slime2" parent="." instance=ExtResource( 10 )]
position = Vector2( 264, 160 )
[node name="Slime2" parent="." instance=ExtResource( 10 )]
position = Vector2( 216, 168 )
[node name="Slime3" parent="." instance=ExtResource( 10 )]
position = Vector2( 216, 168 )
[node name="Slime4" parent="." instance=ExtResource( 10 )]
position = Vector2( 216, 168 )
[node name="Arrow" parent="." instance=ExtResource( 13 )]
position = Vector2( 184, 163 )
@ -88,3 +98,6 @@ delay = 1.5
[node name="Turniwood9" parent="." instance=ExtResource( 12 )]
position = Vector2( 48, 88 )
delay = 2.0
[node name="FallingBlock" parent="." instance=ExtResource( 14 )]
position = Vector2( 192, 112 )

View file

@ -5,10 +5,18 @@ export var fall_speed = 0.5
onready var startpos = position
onready var fall_timer = $FallTimer
onready var refresh_timer = $RefreshTimer
onready var crush_area = $CrushArea
func _physics_process(delta):
#Fall
if fall:
position.y += fall_speed
#Crush the player
for area in crush_area.get_overlapping_areas():
if area.is_in_group("player"):
var player = area.get_parent()
if player.is_on_floor():
player.die()
func _on_Area2D_area_entered(area):
if area.is_in_group("player"):

View file

@ -1,27 +1,29 @@
[gd_scene load_steps=5 format=2]
[gd_scene load_steps=6 format=2]
[ext_resource path="res://graphics/falling_block/falling_block_cave.png" type="Texture" id=1]
[ext_resource path="res://objects/environment/falling_block/falling_block.gd" type="Script" id=2]
[sub_resource type="RectangleShape2D" id=1]
extents = Vector2( 4, 3.5 )
extents = Vector2( 4, 1 )
[sub_resource type="RectangleShape2D" id=2]
extents = Vector2( 4, 0.5 )
[sub_resource type="RectangleShape2D" id=3]
extents = Vector2( 3, 0.5 )
[node name="FallingBlock" type="KinematicBody2D"]
collision_layer = 4
script = ExtResource( 2 )
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
visible = false
position = Vector2( 4, 4.5 )
shape = SubResource( 1 )
[node name="Sprite" type="Sprite" parent="."]
texture = ExtResource( 1 )
centered = false
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2( 4, 2 )
shape = SubResource( 1 )
[node name="VisibilityNotifier2D" type="VisibilityNotifier2D" parent="."]
visible = false
position = Vector2( 4, 4 )
@ -42,6 +44,12 @@ one_shot = true
[node name="RefreshTimer" type="Timer" parent="."]
wait_time = 2.0
[node name="CrushArea" type="Area2D" parent="."]
[node name="CollisionShape2D" type="CollisionShape2D" parent="CrushArea"]
position = Vector2( 4, 3.5 )
shape = SubResource( 3 )
[connection signal="screen_exited" from="VisibilityNotifier2D" to="." method="_on_VisibilityNotifier2D_screen_exited"]
[connection signal="area_entered" from="Area2D" to="." method="_on_Area2D_area_entered"]
[connection signal="area_exited" from="Area2D" to="." method="_on_Area2D_area_exited"]