Explorar o código

Disable collisions with balls

DricomDragon %!s(int64=3) %!d(string=hai) anos
pai
achega
07fbfbe0b6
Modificáronse 4 ficheiros con 15 adicións e 3 borrados
  1. 7 0
      godot/project.godot
  2. 1 0
      godot/scenes/Ball.tscn
  3. 5 0
      godot/scenes/main.tscn
  4. 2 3
      godot/scripts/Launcher.gd

+ 7 - 0
godot/project.godot

@@ -38,6 +38,13 @@ window/size/height=400
 window/size/resizable=false
 window/handheld/orientation="portrait"
 
+[layer_names]
+
+2d_physics/layer_1="balls"
+2d_physics/layer_2="walls"
+2d_physics/layer_3="bricks"
+2d_physics/layer_4="detector"
+
 [rendering]
 
 environment/default_environment="res://default_env.tres"

+ 1 - 0
godot/scenes/Ball.tscn

@@ -13,6 +13,7 @@ radius = 5.0
 [node name="Ball" type="RigidBody2D" groups=[
 "ball",
 ]]
+collision_mask = 14
 mode = 2
 physics_material_override = SubResource( 1 )
 gravity_scale = 0.0

+ 5 - 0
godot/scenes/main.tscn

@@ -45,6 +45,7 @@ points = PoolVector2Array( 0, 0, 40, 0, 40, 20, 0, 20 )
 [node name="Root" type="Node"]
 
 [node name="Walls" type="StaticBody2D" parent="."]
+collision_layer = 2
 physics_material_override = SubResource( 1 )
 
 [node name="Left" type="CollisionShape2D" parent="Walls"]
@@ -61,6 +62,8 @@ shape = SubResource( 3 )
 
 [node name="Catcher" type="Area2D" parent="."]
 position = Vector2( 200, 460 )
+collision_layer = 8
+collision_mask = 5
 script = ExtResource( 3 )
 
 [node name="Area" type="CollisionShape2D" parent="Catcher"]
@@ -76,6 +79,8 @@ mode = 2
 tile_set = SubResource( 6 )
 cell_size = Vector2( 40, 20 )
 cell_custom_transform = Transform2D( 40, 0, 0, 20, 0, 0 )
+collision_layer = 4
+collision_mask = 9
 format = 1
 script = ExtResource( 6 )
 

+ 2 - 3
godot/scripts/Launcher.gd

@@ -9,7 +9,7 @@ enum State {
 	WAITING,
 }
 
-const BULLET_SPEED = 600.0
+const BULLET_SPEED = 500.0
 
 var _ballScene = preload("res://scenes/Ball.tscn")
 
@@ -85,5 +85,4 @@ func _on_Grid_has_moved():
 
 
 func _on_Grid_kace_broken():
-	#load_bullet(1)
-	print("Not loading")
+	load_bullet(1)