collision fix
This commit is contained in:
@@ -26,7 +26,6 @@ GameController="*res://game_controller.gd"
|
||||
|
||||
window/size/viewport_width=640
|
||||
window/size/viewport_height=640
|
||||
window/size/mode=3
|
||||
window/stretch/mode="viewport"
|
||||
window/stretch/scale_mode="integer"
|
||||
window/vsync/vsync_mode=0
|
||||
|
||||
@@ -8,7 +8,7 @@ collision_layer = 3
|
||||
collision_mask = 3
|
||||
mass = 5.0
|
||||
contact_monitor = true
|
||||
max_contacts_reported = 4
|
||||
max_contacts_reported = 10
|
||||
script = ExtResource("1_p0ukn")
|
||||
|
||||
[node name="Asteroid" type="Sprite2D" parent="."]
|
||||
@@ -17,5 +17,12 @@ texture = ExtResource("1_u87q6")
|
||||
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="."]
|
||||
polygon = PackedVector2Array(12, -1, 6, -6, 5, -13, -8, -12, -12, -5, -12, 4, -6, 13, -2, 10, 2, 14, 12, 3)
|
||||
|
||||
[node name="Area2D" type="Area2D" parent="."]
|
||||
|
||||
[node name="CollisionPolygon2D2" type="CollisionPolygon2D" parent="Area2D"]
|
||||
polygon = PackedVector2Array(14, -1, 9, -6, 8, -13, 5, -15, -9, -13, -12, -9, -14, 3, -11, 8, -6, 14, -2, 14, 3, 15, 14, 3)
|
||||
|
||||
[connection signal="body_entered" from="." to="." method="_on_body_entered"]
|
||||
[connection signal="body_exited" from="." to="." method="_on_body_exited"]
|
||||
[connection signal="body_entered" from="Area2D" to="." method="_on_area_2d_body_entered"]
|
||||
[connection signal="body_exited" from="Area2D" to="." method="_on_area_2d_body_exited"]
|
||||
|
||||
@@ -8,14 +8,23 @@ collision_layer = 3
|
||||
collision_mask = 3
|
||||
mass = 10.0
|
||||
contact_monitor = true
|
||||
max_contacts_reported = 4
|
||||
max_contacts_reported = 10
|
||||
script = ExtResource("1_ka8bu")
|
||||
|
||||
[node name="Asteroid" type="Sprite2D" parent="."]
|
||||
texture = ExtResource("2_e2m2r")
|
||||
|
||||
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="."]
|
||||
polygon = PackedVector2Array(16, -23, 3, -29, -11, -27, -22, -12, -27, 2, -25, 21, -6, 30, 17, 23, 23, 10, 29, 1, 20, -8)
|
||||
scale = Vector2(0.95, 0.95)
|
||||
polygon = PackedVector2Array(16, -23, 3, -29, -11, -27, -22, -12, -27.3684, 1.05263, -25.2632, 21.0526, -6, 30, 17, 23, 23, 10, 29, 1, 20, -8)
|
||||
|
||||
[node name="Area2D" type="Area2D" parent="."]
|
||||
|
||||
[node name="CollisionPolygon2D2" type="CollisionPolygon2D" parent="Area2D"]
|
||||
scale = Vector2(0.95, 0.95)
|
||||
polygon = PackedVector2Array(34, 0, 22, -11, 17, -25, 2, -33, -12, -30, -26, -14, -31, 2, -28, 24, -6, 34, 19, 25, 26, 12)
|
||||
|
||||
[connection signal="body_entered" from="." to="." method="_on_body_entered"]
|
||||
[connection signal="body_exited" from="." to="." method="_on_body_exited"]
|
||||
[connection signal="body_entered" from="Area2D" to="." method="_on_area_2d_body_entered"]
|
||||
[connection signal="body_exited" from="Area2D" to="." method="_on_area_2d_body_exited"]
|
||||
|
||||
@@ -8,14 +8,23 @@ collision_layer = 3
|
||||
collision_mask = 3
|
||||
mass = 20.0
|
||||
contact_monitor = true
|
||||
max_contacts_reported = 4
|
||||
max_contacts_reported = 10
|
||||
script = ExtResource("1_e451a")
|
||||
|
||||
[node name="Asteroid" type="Sprite2D" parent="."]
|
||||
texture = ExtResource("2_beklf")
|
||||
|
||||
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="."]
|
||||
scale = Vector2(0.95, 0.95)
|
||||
polygon = PackedVector2Array(23, 10, 36, -11, 22, -32, 8, -43, -32, -40, -40, -25, -43, 1, -40, 23, -24, 41, 3, 43, 38, 19)
|
||||
|
||||
[node name="Area2D" type="Area2D" parent="."]
|
||||
|
||||
[node name="CollisionPolygon2D2" type="CollisionPolygon2D" parent="Area2D"]
|
||||
scale = Vector2(0.95, 0.95)
|
||||
polygon = PackedVector2Array(39, 18, 28, 9, 39, -11, 23, -33, 9, -44, -26, -44, -33, -42, -43, -25, -45, 2, -43, 24, -26, 44, -1, 46, 38, 21)
|
||||
|
||||
[connection signal="body_entered" from="." to="." method="_on_body_entered"]
|
||||
[connection signal="body_exited" from="." to="." method="_on_body_exited"]
|
||||
[connection signal="body_entered" from="Area2D" to="." method="_on_area_2d_body_entered"]
|
||||
[connection signal="body_exited" from="Area2D" to="." method="_on_area_2d_body_exited"]
|
||||
|
||||
@@ -8,14 +8,23 @@ collision_layer = 3
|
||||
collision_mask = 3
|
||||
mass = 40.0
|
||||
contact_monitor = true
|
||||
max_contacts_reported = 4
|
||||
max_contacts_reported = 10
|
||||
script = ExtResource("1_pojcu")
|
||||
|
||||
[node name="Asteroid" type="Sprite2D" parent="."]
|
||||
texture = ExtResource("2_gv6mu")
|
||||
|
||||
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="."]
|
||||
polygon = PackedVector2Array(55, 3, 35, -20, 34, -40, 1, -49, -35, -52, -55, -29, -58, -1, -48, 30, -22, 53, 13, 58, 40, 30)
|
||||
scale = Vector2(0.95, 0.95)
|
||||
polygon = PackedVector2Array(55, 3, 35, -20, 34.7368, -43.1579, 1, -49, -34.7368, -54.7368, -55.7895, -30.5263, -58, -1, -46.3158, 33.6842, -23.1579, 55.7895, 13.6842, 61.0526, 42.1053, 32.6316)
|
||||
|
||||
[node name="Area2D" type="Area2D" parent="."]
|
||||
|
||||
[node name="CollisionPolygon2D2" type="CollisionPolygon2D" parent="Area2D"]
|
||||
scale = Vector2(0.95, 0.95)
|
||||
polygon = PackedVector2Array(63.1579, 2.10526, 41, -21, 41.0526, -43.1579, 35.7895, -48.4211, 6.31579, -51.5789, -1.05263, -54.7368, -37.8947, -57.8947, -58.9474, -31.5789, -61.0526, 0, -48.4211, 36.8421, -25.2632, 58.9474, 13.6842, 64.2105, 45.2632, 33.6842)
|
||||
|
||||
[connection signal="body_entered" from="." to="." method="_on_body_entered"]
|
||||
[connection signal="body_exited" from="." to="." method="_on_body_exited"]
|
||||
[connection signal="body_entered" from="Area2D" to="." method="_on_area_2d_body_entered"]
|
||||
[connection signal="body_exited" from="Area2D" to="." method="_on_area_2d_body_exited"]
|
||||
|
||||
@@ -42,6 +42,7 @@ _data = {
|
||||
}
|
||||
|
||||
[node name="CharacterBody2D" type="CharacterBody2D" node_paths=PackedStringArray("animation", "target")]
|
||||
collision_mask = 0
|
||||
collision_priority = 100.0
|
||||
script = ExtResource("1_4cq66")
|
||||
SHOOT_NODE = ExtResource("2_v4325")
|
||||
@@ -60,8 +61,7 @@ libraries = {
|
||||
}
|
||||
|
||||
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="."]
|
||||
polygon = PackedVector2Array(14, 2, 14, -2, -9, -10, -13, -10, -14, -9, -14, 8, -13, 9, -9, 9)
|
||||
one_way_collision_margin = 10.0
|
||||
polygon = PackedVector2Array(14, 0, -12, -10, -12, 9)
|
||||
|
||||
[node name="Node2D" type="Node2D" parent="."]
|
||||
position = Vector2(15, 0)
|
||||
|
||||
@@ -25,6 +25,7 @@ func _process(delta: float) -> void:
|
||||
delay_dup += delta
|
||||
linear_velocity = direction * SPEED
|
||||
|
||||
|
||||
func split():
|
||||
var packed_use: PackedScene
|
||||
|
||||
@@ -68,13 +69,22 @@ func _on_body_entered(body: Node) -> void:
|
||||
body.queue_free()
|
||||
GameController.emit_signal("point_gain", type, global_position)
|
||||
split()
|
||||
elif body is Ship and !body.is_inv():
|
||||
|
||||
|
||||
|
||||
func _on_body_exited(body: Node) -> void:
|
||||
if body is Ship:
|
||||
body.is_currently_hit = false
|
||||
|
||||
|
||||
func _on_area_2d_body_entered(body: Node2D) -> void:
|
||||
if body is Ship and !body.is_inv():
|
||||
body.is_currently_hit = true
|
||||
direction = (global_position - body.global_position).normalized()
|
||||
body.velocity += direction * 10
|
||||
#GameController.emit_signal("player_hit")
|
||||
|
||||
|
||||
func _on_body_exited(body: Node) -> void:
|
||||
if body is Ship:
|
||||
body.is_currently_hit = false
|
||||
func _on_area_2d_body_exited(body: Node2D) -> void:
|
||||
if body is Ship :
|
||||
body.is_currently_hit = false
|
||||
|
||||
Reference in New Issue
Block a user