aboutsummaryrefslogtreecommitdiffstats
path: root/KinematicBody2D.gd
diff options
context:
space:
mode:
authorLeightonGinty <leightonginty@gmail.com>2022-10-29 16:37:26 +0100
committerLeightonGinty <leightonginty@gmail.com>2022-10-29 16:37:26 +0100
commit4c0bd4f0ab32a2489130d04b08c39d008c8c9961 (patch)
tree75d2c138b24bb09ab15ce7f1204b69cfe7a40abe /KinematicBody2D.gd
parent078392d1d4478e552d362c2e76c2d50a1917f10e (diff)
can shoot now
Diffstat (limited to 'KinematicBody2D.gd')
-rw-r--r--KinematicBody2D.gd11
1 files changed, 10 insertions, 1 deletions
diff --git a/KinematicBody2D.gd b/KinematicBody2D.gd
index dad1eb5..a1a3770 100644
--- a/KinematicBody2D.gd
+++ b/KinematicBody2D.gd
@@ -1,7 +1,7 @@
extends KinematicBody2D
export (int) var speed = 200
-
+var spawn_object = load("res://Bullet.tscn")
var velocity = Vector2()
func get_input():
@@ -17,5 +17,14 @@ func get_input():
velocity = velocity.normalized() * speed
func _physics_process(delta):
+
+
+
get_input()
velocity = move_and_slide(velocity)
+ if Input.is_action_just_pressed("click"):
+ var obj = spawn_object.instance()
+ obj.position = get_position()
+ obj.position.x -= 500
+ obj.position.y -= 250
+ add_child(obj)