![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | Godot_Starter |
I have a Playercode:
extends KinematicBody2D
var cooldown = 0
onready var BULLET = preload("res://Bullet.tscn")
func _process(delta):
if Input.is_action_just_pressed("ui_right"):
if cooldown == 0:
var bullet = BULLET.instance()
get_node("/root/World").add_child(bullet)
cooldown = 1
$Cooldown.start()
func _on_Cooldown_timeout():
cooldown = 0
and a Bulletcode:
extends KinematicBody2D
var movement = Vector2(0,0)
var speed = 150
func _physics_process(delta):
movement = Vector2(speed,0)
move_and_collide(movement * delta)
And the Shootingsystem works, but I dont now how I can spawn the Bullets by the Player and not anywhere. So how can I spawn the Bullets by the Player?