diff --git a/bottle/gravity_from_gyro.gd b/bottle/gravity_from_gyro.gd index 52cc29b..7d91eb0 100644 --- a/bottle/gravity_from_gyro.gd +++ b/bottle/gravity_from_gyro.gd @@ -4,6 +4,8 @@ class_name GravityFromGyro func _physics_process(_delta): var accel_3d = Input.get_accelerometer() + if accel_3d == Vector3.ZERO: # If accelerometer is not supported + accel_3d = Vector3.DOWN * 9.8 + var accel_2d = Vector2(accel_3d.x, -accel_3d.y) / 9.8 PhysicsServer2D.area_set_param(get_viewport().find_world_2d().space, PhysicsServer2D.AREA_PARAM_GRAVITY_VECTOR, accel_2d) - diff --git a/root.tscn b/root.tscn index 19e6525..8118017 100644 --- a/root.tscn +++ b/root.tscn @@ -81,7 +81,6 @@ texture_filter = 1 [node name="TimeSpawner" parent="UI/GameContainer/Game" instance=ExtResource("3_pubxn")] position = Vector2(-24, -490) scene = ExtResource("2_dv01l") -target_parent = NodePath("..") [node name="Timer" type="Timer" parent="UI/GameContainer/Game/TimeSpawner"] autostart = true @@ -89,7 +88,6 @@ autostart = true [node name="ButtonSpawner" parent="UI/GameContainer/Game" instance=ExtResource("3_pubxn")] position = Vector2(24, -490) scene = ExtResource("2_dv01l") -target_parent = NodePath("..") [connection signal="pressed" from="UI/Rows/UpperButtons/SpawnButton" to="UI/GameContainer/Game/ButtonSpawner" method="spawn"] [connection signal="timeout" from="UI/GameContainer/Game/TimeSpawner/Timer" to="UI/GameContainer/Game/TimeSpawner" method="spawn"]