18 lines
422 B
GDScript
18 lines
422 B
GDScript
extends Sprite2D
|
|
|
|
@export var speed = -10
|
|
var y_pos
|
|
# Called when the node enters the scene tree for the first time.
|
|
func _ready():
|
|
y_pos = position.y
|
|
|
|
|
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
|
func _process(delta):
|
|
var cameraPos = get_parent().get_screen_center_position()
|
|
var velocity = Vector2(speed,0)
|
|
global_position.y = 150
|
|
var motion = velocity * delta
|
|
|
|
position += motion
|