Added collision boxes to level
This commit is contained in:
|
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
@@ -3,15 +3,15 @@
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://cueeywtu6xdbv"
|
||||
path="res://.godot/imported/Fierd.png-092c69452f524e8b881046eb1e338a4a.ctex"
|
||||
path="res://.godot/imported/Field.png-859bbd1d5004670495fd6abbe4d47b71.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://data/images/Fierd.png"
|
||||
dest_files=["res://.godot/imported/Fierd.png-092c69452f524e8b881046eb1e338a4a.ctex"]
|
||||
source_file="res://data/images/Field.png"
|
||||
dest_files=["res://.godot/imported/Field.png-859bbd1d5004670495fd6abbe4d47b71.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
@@ -28,6 +28,7 @@ signal closed()
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
$CollisionShape2D.disabled = state == DoorState.OPENED
|
||||
_play_animation()
|
||||
|
||||
|
||||
|
||||
+14
-1
@@ -91,6 +91,12 @@ func _create_top_door():
|
||||
top_door.position = Vector2i(top_door_x,y)*16
|
||||
add_child(top_door)
|
||||
|
||||
$CollisionBoxTopLeft.shape.size.x = (top_door_x - 1) * 16
|
||||
$CollisionBoxTopLeft.position.x += $CollisionBoxTopLeft.shape.size.x/2 - 8
|
||||
|
||||
$CollisionBoxTopRight.shape.size.x = (20 - top_door_x - 2) * 16
|
||||
$CollisionBoxTopRight.position.x -= $CollisionBoxTopRight.shape.size.x/2 - 8
|
||||
|
||||
|
||||
func _create_bottom_door():
|
||||
const y = 10
|
||||
@@ -100,6 +106,13 @@ func _create_bottom_door():
|
||||
|
||||
bottom_door = DOOR.instantiate()
|
||||
bottom_door.type = Door.DoorType.BOTTOM_DOOR
|
||||
bottom_door.state = Door.DoorState.CLOSED
|
||||
bottom_door.state = Door.DoorState.OPENED
|
||||
bottom_door.position = Vector2i(bottom_door_x,y)*16
|
||||
add_child(bottom_door)
|
||||
|
||||
|
||||
$CollisionBoxBottomLeft.shape.size.x = (bottom_door_x - 1) * 16
|
||||
$CollisionBoxBottomLeft.position.x += $CollisionBoxBottomLeft.shape.size.x/2 - 8
|
||||
|
||||
$CollisionBoxBottomRight.shape.size.x = (20 - bottom_door_x - 2) * 16
|
||||
$CollisionBoxBottomRight.position.x -= $CollisionBoxBottomRight.shape.size.x/2 - 8
|
||||
|
||||
+45
-3
@@ -1,8 +1,8 @@
|
||||
[gd_scene load_steps=7 format=3 uid="uid://c1h0h1viac0gy"]
|
||||
[gd_scene load_steps=13 format=3 uid="uid://c1h0h1viac0gy"]
|
||||
|
||||
[ext_resource type="Script" path="res://level.gd" id="1_t0agp"]
|
||||
[ext_resource type="Texture2D" uid="uid://b6wbb26dayco1" path="res://data/images/Forest.png" id="2_acuqw"]
|
||||
[ext_resource type="Texture2D" uid="uid://cueeywtu6xdbv" path="res://data/images/Fierd.png" id="3_uas50"]
|
||||
[ext_resource type="Texture2D" uid="uid://cueeywtu6xdbv" path="res://data/images/Field.png" id="3_uas50"]
|
||||
|
||||
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_ux773"]
|
||||
texture = ExtResource("2_acuqw")
|
||||
@@ -54,8 +54,50 @@ texture = ExtResource("3_uas50")
|
||||
sources/0 = SubResource("TileSetAtlasSource_ux773")
|
||||
sources/1 = SubResource("TileSetAtlasSource_yfk20")
|
||||
|
||||
[node name="Level" type="Node2D"]
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_5p18l"]
|
||||
size = Vector2(16, 176)
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_5hg31"]
|
||||
size = Vector2(16, 176)
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_j8f03"]
|
||||
size = Vector2(16, 16)
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_0blxn"]
|
||||
size = Vector2(16, 16)
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_tnbqo"]
|
||||
size = Vector2(16, 16)
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_531kt"]
|
||||
size = Vector2(16, 16)
|
||||
|
||||
[node name="Level" type="StaticBody2D"]
|
||||
script = ExtResource("1_t0agp")
|
||||
|
||||
[node name="TileMapLayer" type="TileMapLayer" parent="."]
|
||||
tile_set = SubResource("TileSet_e0bu0")
|
||||
|
||||
[node name="CollisionBoxLeft" type="CollisionShape2D" parent="."]
|
||||
position = Vector2(8, 88)
|
||||
shape = SubResource("RectangleShape2D_5p18l")
|
||||
|
||||
[node name="CollisionBoxRight" type="CollisionShape2D" parent="."]
|
||||
position = Vector2(312, 88)
|
||||
shape = SubResource("RectangleShape2D_5hg31")
|
||||
|
||||
[node name="CollisionBoxTopLeft" type="CollisionShape2D" parent="."]
|
||||
position = Vector2(24, 8)
|
||||
shape = SubResource("RectangleShape2D_j8f03")
|
||||
|
||||
[node name="CollisionBoxTopRight" type="CollisionShape2D" parent="."]
|
||||
position = Vector2(296, 8)
|
||||
shape = SubResource("RectangleShape2D_0blxn")
|
||||
|
||||
[node name="CollisionBoxBottomLeft" type="CollisionShape2D" parent="."]
|
||||
position = Vector2(24, 168)
|
||||
shape = SubResource("RectangleShape2D_tnbqo")
|
||||
|
||||
[node name="CollisionBoxBottomRight" type="CollisionShape2D" parent="."]
|
||||
position = Vector2(296, 168)
|
||||
shape = SubResource("RectangleShape2D_531kt")
|
||||
|
||||
Reference in New Issue
Block a user