This article discusses a technique used to make an object slide vertically, horizontally, or both while scrolling. This tutorial explains how to make an object slide in a scroller. Below is the script you will need:
|Tip:||The values below are just used as an example. Adjust the values as necessary to best fit your project.|
when green flag clicked forever set x to ((scrollX) + (xpos)) end when green flag clicked forever repeat (100) change [xpos v] by (2.5) end repeat (100) change [xpos v] by (-2.5) end end
Placing this script into a sprite will make it move back and forth while you are scrolling.
How it Works
The xpos variable determines how far the sprite should be offset from its original position if it were scrolling normally. This script makes it forever slide back and forth. This is similar to a Mario style platformer.