From Test-Scratch-Wiki

Revision as of 04:52, 1 April 2018 by Dnowba (talk | contribs) (Created page with "{{:Eng:Making Objects Move in Scrollers/translate}} This article discusses a technique used to make an object slide vertically, horizontally, or both while scrolling. This tut...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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:

Warning Tip: The values below are just used as an example. Adjust the values as necessary to best fit your 专案.
當 @greenflag 被點擊
重複無限次 
  x 設為 ((scrollX) + (xpos))
end

當 @greenflag 被點擊
重複無限次 
  重複 (100) 次 
    變數 [xpos v] 改變 (2.5)
  end
  重複 (100) 次 
    變數 [xpos v] 改變 (-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 变量 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.

参见

Cookies help us deliver our services. By using our services, you agree to our use of cookies.