Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Geox2 |
So, I used this code:
extends Area2D
export (int) var speed = 750
onready var kill_timer = $KillBulletTimer
var direction := Vector2.ZERO
func _ready() → void:
kill_timer.start()
func _physics_process(delta: float) → void:
move_local_y(speed * delta)
if direction != Vector2.ZERO:
var velocity = direction * speed
global_position += velocity
func set_direction(direction: Vector2):
self.direction = direction
func _on_KillBulletTimer_timeout():
queue_free()
But my bullets go downwards when I shoot. What should I do?