diff options
Diffstat (limited to 'demos/2d/motion')
-rw-r--r-- | demos/2d/motion/engine.cfg | 1 | ||||
-rw-r--r-- | demos/2d/motion/icon.png | bin | 0 -> 2621 bytes | |||
-rw-r--r-- | demos/2d/motion/motion.gd | 35 | ||||
-rw-r--r-- | demos/2d/motion/motion.scn | bin | 2845 -> 2738 bytes |
4 files changed, 16 insertions, 20 deletions
diff --git a/demos/2d/motion/engine.cfg b/demos/2d/motion/engine.cfg index 261111904c..6e660572d6 100644 --- a/demos/2d/motion/engine.cfg +++ b/demos/2d/motion/engine.cfg @@ -2,6 +2,7 @@ name="Motion Test" main_scene="res://motion.scn" +icon="res://icon.png" [display] diff --git a/demos/2d/motion/icon.png b/demos/2d/motion/icon.png Binary files differnew file mode 100644 index 0000000000..9e64961d3c --- /dev/null +++ b/demos/2d/motion/icon.png diff --git a/demos/2d/motion/motion.gd b/demos/2d/motion/motion.gd index 8f8f56a889..f9bbd6f90d 100644 --- a/demos/2d/motion/motion.gd +++ b/demos/2d/motion/motion.gd @@ -1,38 +1,33 @@ extends Sprite - -export var use_idle=true - -# member variables here, example: -# var a=2 -# var b="textvar" +# Member variables const BEGIN = -113 const END = 907 -const TIME = 5.0 # seconds -const SPEED = (END-BEGIN)/TIME +const TIME = 5.0 # Seconds +const SPEED = (END - BEGIN)/TIME + +export var use_idle = true + func _process(delta): var ofs = get_pos() - ofs.x+=delta*SPEED - if (ofs.x>END): - ofs.x=BEGIN + 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 + 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/demos/2d/motion/motion.scn b/demos/2d/motion/motion.scn Binary files differindex 6c5b5307ac..6e19356674 100644 --- a/demos/2d/motion/motion.scn +++ b/demos/2d/motion/motion.scn |