summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcflip <cflip@cflip.net>2022-09-24 14:42:50 -0600
committercflip <cflip@cflip.net>2022-09-24 14:42:50 -0600
commit9b0fd35c5863c00b65185aae65c61c17c58cd56f (patch)
treea75c01b06c82b8a801e97f61d320ba23ed47afe1
parent2a8564b5b2576d34c91c5cc559ca40bb7db1d28e (diff)
Add left/right movement to basketball
-rw-r--r--scripts/basketball.gd6
1 files changed, 6 insertions, 0 deletions
diff --git a/scripts/basketball.gd b/scripts/basketball.gd
index a2f724f..33431f9 100644
--- a/scripts/basketball.gd
+++ b/scripts/basketball.gd
@@ -7,6 +7,7 @@ var waiting_for_shoot = true
var power = 100
var spin_rotation = 0
var spin_speed = -1
+var move_speed = 300
func _ready():
start_position = position
@@ -36,6 +37,11 @@ func _integrate_forces(state):
func _process(delta):
if waiting_for_shoot:
spin_rotation += spin_speed * delta
+ if Input.is_action_pressed("ui_left"):
+ start_position.x -= move_speed * delta
+ if Input.is_action_pressed("ui_right"):
+ start_position.x += move_speed * delta
+ start_position.x = clamp(start_position.x, 0, 1024)
if Input.is_action_pressed("ui_up"):
if power < 200: