浏览代码

:tada: Add collision against icon props

DricomDragon 1 年之前
父节点
当前提交
c2248b4608
共有 2 个文件被更改,包括 22 次插入3 次删除
  1. 17 2
      godot/component/props/godot_logo/godot_logo.tscn
  2. 5 1
      godot/component/ships/BiBiShip.tscn

+ 17 - 2
godot/component/props/godot_logo/godot_logo.tscn

@@ -1,6 +1,21 @@
-[gd_scene load_steps=2 format=3 uid="uid://cqdewtd1yr4cn"]
+[gd_scene load_steps=4 format=3 uid="uid://cqdewtd1yr4cn"]
 
 [ext_resource type="Texture2D" uid="uid://diymsf2qlhkbe" path="res://icon.svg" id="1_mexma"]
 
-[node name="GodotLogo" type="Sprite2D"]
+[sub_resource type="PhysicsMaterial" id="PhysicsMaterial_jopk8"]
+bounce = 0.46
+
+[sub_resource type="RectangleShape2D" id="RectangleShape2D_hyykr"]
+size = Vector2(120, 120)
+
+[node name="Body" type="StaticBody2D"]
+collision_layer = 3
+collision_mask = 3
+physics_material_override = SubResource("PhysicsMaterial_jopk8")
+
+[node name="GodotLogo" type="Sprite2D" parent="."]
 texture = ExtResource("1_mexma")
+
+[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
+position = Vector2(1, 0)
+shape = SubResource("RectangleShape2D_hyykr")

+ 5 - 1
godot/component/ships/BiBiShip.tscn

@@ -1,8 +1,11 @@
-[gd_scene load_steps=37 format=3 uid="uid://dlkwtp1gl45r"]
+[gd_scene load_steps=38 format=3 uid="uid://dlkwtp1gl45r"]
 
 [ext_resource type="Texture2D" uid="uid://duw5x0fjt8jak" path="res://component/ships/NihilAce_spaceship_building_pack_32x32.png" id="1_4y72e"]
 [ext_resource type="Script" path="res://component/ships/ship.gd" id="1_8hr01"]
 
+[sub_resource type="PhysicsMaterial" id="PhysicsMaterial_g1gqc"]
+bounce = 0.1
+
 [sub_resource type="TileMapPattern" id="TileMapPattern_uebyg"]
 tile_data = PackedInt32Array(0, 851968, 3, 65536, 851968, 4, 1, 917504, 3, 65537, 917504, 4)
 
@@ -631,6 +634,7 @@ radius = 29.2746
 collision_layer = 2
 collision_mask = 2
 mass = 400.0
+physics_material_override = SubResource("PhysicsMaterial_g1gqc")
 linear_damp = 0.5
 script = ExtResource("1_8hr01")