2015-05-16 22:05:56 +02:00
|
|
|
|
|
|
|
extends Sprite
|
|
|
|
|
2015-11-21 16:13:43 +01:00
|
|
|
# Member variables
|
2015-05-16 22:05:56 +02:00
|
|
|
const BEGIN = -113
|
|
|
|
const END = 907
|
2015-11-21 16:13:43 +01:00
|
|
|
const TIME = 5.0 # Seconds
|
|
|
|
const SPEED = (END - BEGIN)/TIME
|
|
|
|
|
|
|
|
export var use_idle = true
|
|
|
|
|
2015-05-16 22:05:56 +02:00
|
|
|
|
|
|
|
func _process(delta):
|
|
|
|
var ofs = get_pos()
|
2015-11-21 16:13:43 +01:00
|
|
|
ofs.x += delta*SPEED
|
|
|
|
if (ofs.x > END):
|
|
|
|
ofs.x = BEGIN
|
2015-05-16 22:05:56 +02:00
|
|
|
set_pos(ofs)
|
2015-11-21 16:13:43 +01:00
|
|
|
|
|
|
|
|
2015-05-16 22:05:56 +02:00
|
|
|
func _fixed_process(delta):
|
|
|
|
var ofs = get_pos()
|
2015-11-21 16:13:43 +01:00
|
|
|
ofs.x += delta*SPEED
|
|
|
|
if (ofs.x > END):
|
|
|
|
ofs.x = BEGIN
|
2015-05-16 22:05:56 +02:00
|
|
|
set_pos(ofs)
|
2015-11-21 16:13:43 +01:00
|
|
|
|
2015-05-16 22:05:56 +02:00
|
|
|
|
|
|
|
func _ready():
|
|
|
|
# Initialization here
|
|
|
|
if (use_idle):
|
|
|
|
set_process(true)
|
|
|
|
else:
|
|
|
|
set_fixed_process(true)
|