aboutsummaryrefslogtreecommitdiffstats
path: root/Bullet.gd
blob: b2058ba75c25a149d8370bce3065710a238f8b35 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
extends KinematicBody2D
export (int) var speed = 2000

var velocity = Vector2()
var target = Vector2.ZERO
#var player = load("")
var shot = false;


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)