summaryrefslogtreecommitdiff
path: root/Basketball.gd
diff options
context:
space:
mode:
authorLogan <logan@cflip.net>2022-09-23 18:30:44 -0600
committerLogan <logan@cflip.net>2022-09-23 18:30:44 -0600
commitf16a77d9137fa458b7af3e0c33361a1218159c1e (patch)
tree05a5daa529409fabe3e2668ee3e97a27bc433c0e /Basketball.gd
parent11b451bcea45f7ac3dc641eaf1d1ef7db6af5efc (diff)
Refactored physics code.
Diffstat (limited to 'Basketball.gd')
-rw-r--r--Basketball.gd7
1 files changed, 3 insertions, 4 deletions
diff --git a/Basketball.gd b/Basketball.gd
index d4abf21..1082b2d 100644
--- a/Basketball.gd
+++ b/Basketball.gd
@@ -1,22 +1,21 @@
extends RigidBody2D
var start_position
-
var do_reset = false
# Called when the node enters the scene tree for the first time.
func _ready():
start_position = position
do_reset = true
-
+
# Override the default physics when we want to manually reset the position and rotation.
func _integrate_forces(state):
if do_reset:
state.transform.origin = start_position
state.linear_velocity = Vector2()
+ state.angular_velocity = 0
- apply_central_impulse(Vector2(500, -800))
- apply_torque_impulse(10000.0)
+ apply_impulse(Vector2(10, 10), Vector2(500, -800))
do_reset = false