summaryrefslogtreecommitdiff
path: root/Basketball.gd
diff options
context:
space:
mode:
Diffstat (limited to 'Basketball.gd')
-rw-r--r--Basketball.gd15
1 files changed, 9 insertions, 6 deletions
diff --git a/Basketball.gd b/Basketball.gd
index 1082b2d..40d189c 100644
--- a/Basketball.gd
+++ b/Basketball.gd
@@ -2,23 +2,26 @@ extends RigidBody2D
var start_position
var do_reset = false
+var is_reset = true
# 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.transform = Transform2D(0, start_position)
state.linear_velocity = Vector2()
state.angular_velocity = 0
-
- apply_impulse(Vector2(10, 10), Vector2(500, -800))
-
+
do_reset = false
+ is_reset = true
func _input(event):
if event.is_action_pressed("shoot"):
- do_reset = true
+ if is_reset:
+ apply_impulse(Vector2(10, 10), Vector2(500, -800))
+ is_reset = false
+ else:
+ do_reset = true