Revision as of 18:28, 8 January 2019 by Jvvg (talk | contribs) (more specific category)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Document stub.png This article is a stub. It may be incomplete, unfinished, or have missing parts/sections. If the article can be expanded, please do so! There may be suggestions on its talk page. (June 2017)

This tutorial explains how to make an object slide vertically or horizontally in a scroller. Below is the script you will need:

Note Note: The values below are just used as an example. Adjust the values as necessary to best fit your project.
when green flag clicked
forever
  ...
  go to x: ((scrollX) + (xpos)) y: ((scrollY) + (ypos))
  ...
end
Note Note: The xpos and ypos variables replace the x position and y position blocks in a normal scroller.

If a large costume is selected, it can be made to hide when it's touching the edge by adding this to the forever loop:

...
if <<([abs v] of ((scrollX) + (xpos))) > (240)> or <([abs v] of ((scrollY) + (ypos))) > (180)>> then
hide
...
else
show
...
end
...

The following script will change the 'x pos' relative to the entire scrolling.

when green flag clicked
forever
  repeat (100)
    change [xpos v] by (2.5)
  end
  repeat (100)
    change [xpos v] by (-2.5)
  end
end

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.

See Also