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