aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Bullet.gd7
-rw-r--r--KinematicBody2D.gd2
2 files changed, 4 insertions, 5 deletions
diff --git a/Bullet.gd b/Bullet.gd
index 3d850a1..e547bef 100644
--- a/Bullet.gd
+++ b/Bullet.gd
@@ -9,12 +9,11 @@ var screen_size
func _ready():
screen_size = get_viewport_rect().size
+ target = get_global_mouse_position()
+ velocity = global_position.direction_to(target) * speed
+ position += velocity * 0.05
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)
for i in get_slide_count():
var collision = get_slide_collision(i)
diff --git a/KinematicBody2D.gd b/KinematicBody2D.gd
index 96484f3..3bbb3a9 100644
--- a/KinematicBody2D.gd
+++ b/KinematicBody2D.gd
@@ -2,7 +2,7 @@ extends Area2D
signal hit
var screen_size
-export (int) var speed = 200
+export (int) var speed = 500
var spawn_object = load("res://Bullet.tscn")
var velocity = Vector2()
onready var globals = get_node("/root/Global")