blob: 3c26fa22a6613c50230dd095717ce21a34fb50f7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
extends ParallaxLayer
export var speed := 20.0
var offset_x = 0.0
var last_camera_x = 0.0
func _ready():
last_camera_x = get_node("../../Camera2D").get_camera_position().x
func _process(delta):
motion_offset = Vector2(offset_x, 0)
var new_camera_x = get_node("../../Camera2D").get_camera_position().x
offset_x -= delta*speed + (new_camera_x - last_camera_x)*-2
last_camera_x = new_camera_x
|