How to shoot my bullet upwards

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: 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?

:bust_in_silhouette: Reply From: exuin

Godot’s coordinate system has up as negative y.

enter image description here

Therefore, you should subtract in order for the bullet to go up.