diff --git a/2d/motion/car.png b/2d/motion/car.png new file mode 100644 index 00000000..7ea973ce Binary files /dev/null and b/2d/motion/car.png differ diff --git a/2d/motion/engine.cfg b/2d/motion/engine.cfg new file mode 100644 index 00000000..064de6b3 --- /dev/null +++ b/2d/motion/engine.cfg @@ -0,0 +1,4 @@ +[application] + +name="Motion Test" +main_scene="res://motion.scn" diff --git a/2d/motion/motion.gd b/2d/motion/motion.gd new file mode 100644 index 00000000..8f8f56a8 --- /dev/null +++ b/2d/motion/motion.gd @@ -0,0 +1,38 @@ + +extends Sprite + + +export var use_idle=true + +# member variables here, example: +# var a=2 +# var b="textvar" +const BEGIN = -113 +const END = 907 +const TIME = 5.0 # seconds +const SPEED = (END-BEGIN)/TIME + +func _process(delta): + var ofs = get_pos() + ofs.x+=delta*SPEED + if (ofs.x>END): + ofs.x=BEGIN + set_pos(ofs) + +func _fixed_process(delta): + var ofs = get_pos() + ofs.x+=delta*SPEED + if (ofs.x>END): + ofs.x=BEGIN + set_pos(ofs) + + +func _ready(): + # Initialization here + if (use_idle): + set_process(true) + else: + set_fixed_process(true) + pass + + diff --git a/2d/motion/motion.scn b/2d/motion/motion.scn new file mode 100644 index 00000000..6c5b5307 Binary files /dev/null and b/2d/motion/motion.scn differ