diff options
Diffstat (limited to 'KinematicBody2D.gd')
| -rw-r--r-- | KinematicBody2D.gd | 11 |
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) |
