diff options
author | cflip <cflip@cflip.net> | 2022-09-23 09:58:24 -0600 |
---|---|---|
committer | cflip <cflip@cflip.net> | 2022-09-23 09:58:24 -0600 |
commit | c46bb2fca39de21df9c4abbdc9cbbf2262e8ace0 (patch) | |
tree | 07318b462082f6ac93abd38640b8a83705c2efb8 | |
parent | c469ff91edca01c5b8a73b9a9b009ca35bda1ff6 (diff) |
Press space to shoot the basketball
This just resets the position and velocity for now
-rw-r--r-- | Sprite.gd | 8 | ||||
-rw-r--r-- | project.godot | 8 |
2 files changed, 16 insertions, 0 deletions
@@ -5,8 +5,11 @@ export var gravity = 15 var angular_speed = PI var velocity = Vector2(500, -800) +var start_position + # Called when the node enters the scene tree for the first time. func _ready(): + start_position = position pass # Replace with function body. # Called every frame. 'delta' is the elapsed time since the previous frame. @@ -16,3 +19,8 @@ func _process(delta): velocity.y += gravity +func _input(event): + if event.is_action_pressed("shoot"): + position = start_position + rotation = 0 + velocity = Vector2(500, -800) diff --git a/project.godot b/project.godot index 8d2e8a4..56cf31e 100644 --- a/project.godot +++ b/project.godot @@ -18,6 +18,14 @@ config/icon="res://icon.png" common/drop_mouse_on_gui_input_disabled=true +[input] + +shoot={ +"deadzone": 0.5, +"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":32,"physical_scancode":0,"unicode":0,"echo":false,"script":null) + ] +} + [physics] common/enable_pause_aware_picking=true |