diff --git a/balls/ball.gd b/balls/ball.gd index ef48d52..b4892ff 100644 --- a/balls/ball.gd +++ b/balls/ball.gd @@ -10,8 +10,8 @@ var _velocity: Vector2 var deg: float func _ready(): - _velocity.x = 200#speed * _speed_mult * _direction.x * delta - _velocity.y = 250#speed * _speed_mult * _direction.y * delta + _velocity.x = 400#speed * _speed_mult * _direction.x * delta + _velocity.y = 450#speed * _speed_mult * _direction.y * delta func _physics_process(delta): @@ -23,9 +23,10 @@ func _physics_process(delta): _invert_x() if (deg >= 135 and deg < 225) or deg < 45 or deg >= 315: _invert_y() - if collide.get_collider() is Block: + print(collide.get_collider()) + if collide.get_collider().get_parent() is Block: print(true) - collide.get_collider().take_damage(strength) + collide.get_collider().get_parent().take_damage(strength) func _invert_x(): _velocity.x *= -1 diff --git a/blocks/block.gd b/blocks/block.gd index 87067d0..1823a59 100644 --- a/blocks/block.gd +++ b/blocks/block.gd @@ -12,7 +12,7 @@ func _update_text(): func take_damage(damage): health -= damage _update_text() - if health < 0: + if health <= 0: die() func die(): diff --git a/scenes/level.tscn b/scenes/level.tscn index df0e5ba..d72d4dd 100644 --- a/scenes/level.tscn +++ b/scenes/level.tscn @@ -84,4 +84,37 @@ floor_stop_on_slope = true [node name="Blocks" type="Node2D" parent="GameContent"] [node name="Block" parent="GameContent/Blocks" instance=ExtResource("7_7fnx3")] -position = Vector2(907, 752) +position = Vector2(932, 753) + +[node name="Block2" parent="GameContent/Blocks" instance=ExtResource("7_7fnx3")] +position = Vector2(629, 242) + +[node name="Block3" parent="GameContent/Blocks" instance=ExtResource("7_7fnx3")] +position = Vector2(1459, 692) + +[node name="Block4" parent="GameContent/Blocks" instance=ExtResource("7_7fnx3")] +position = Vector2(1391, 162) + +[node name="Block5" parent="GameContent/Blocks" instance=ExtResource("7_7fnx3")] +position = Vector2(723, 963) + +[node name="Block6" parent="GameContent/Blocks" instance=ExtResource("7_7fnx3")] +position = Vector2(589, 585) + +[node name="Block7" parent="GameContent/Blocks" instance=ExtResource("7_7fnx3")] +position = Vector2(1156, 909) + +[node name="Block8" parent="GameContent/Blocks" instance=ExtResource("7_7fnx3")] +position = Vector2(1272, 461) + +[node name="Block9" parent="GameContent/Blocks" instance=ExtResource("7_7fnx3")] +position = Vector2(1719, 644) + +[node name="Block10" parent="GameContent/Blocks" instance=ExtResource("7_7fnx3")] +position = Vector2(950, 176) + +[node name="Block11" parent="GameContent/Blocks" instance=ExtResource("7_7fnx3")] +position = Vector2(1603, 907) + +[node name="Block12" parent="GameContent/Blocks" instance=ExtResource("7_7fnx3")] +position = Vector2(1635, 293)