aboutsummaryrefslogtreecommitdiffstats
path: root/Bullet.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 /Bullet.gd
parent078392d1d4478e552d362c2e76c2d50a1917f10e (diff)
can shoot now
Diffstat (limited to 'Bullet.gd')
-rw-r--r--Bullet.gd37
1 files changed, 37 insertions, 0 deletions
diff --git a/Bullet.gd b/Bullet.gd
new file mode 100644
index 0000000..311a8b2
--- /dev/null
+++ b/Bullet.gd
@@ -0,0 +1,37 @@
+extends KinematicBody2D
+export (int) var speed = 2000
+
+var velocity = Vector2()
+var target = Vector2.ZERO
+var player = load("")
+var shot = false;
+func get_input():
+ velocity = Vector2()
+ if Input.is_action_pressed("right"):
+ velocity.x += 1
+ if Input.is_action_pressed("left"):
+ velocity.x -= 1
+ if Input.is_action_pressed("down"):
+ velocity.y += 1
+ if Input.is_action_pressed("up"):
+ velocity.y -= 1
+
+ velocity = velocity.normalized() * speed
+
+
+
+
+func _physics_process(delta):
+
+
+
+
+ target = get_global_mouse_position()
+ if(Input.is_action_pressed("click") && shot == false):
+ velocity = global_position.direction_to(target) * speed
+ shot = true
+ velocity = move_and_slide(velocity)
+
+
+
+