У вас нет прав на выполнение действия «редактирование этой страницы» по следующей причине:
Текст:
{{Wiki Standards|date=July 2022|Not formal enough}} A '''parallax''' is a [[project]] on which the user controls a background by moving their mouse. Mostly these projects are created so the user can relax and view the sunset or anything else. Sometimes people just like to show off their art in a parallax project.{{citation needed|date=June 2021}} ==Making a Parallax== When creating a parallax, the art must be broken up into different [[sprite]]s, and the sprites must be layered to create an image. Once the sprites have been created, use the following [[script]] to create the parallax effect: <scratchblocks> When green flag clicked forever go to x((mouse x)/(. . .::grey)) y: ((mouse y) / (. . .::grey))// where the amount variable is how much the sprite moves with 1 being going to mouse x and mouse y and infinity staying at 0,0. end </scratchblocks> A handy parallax [[My Blocks|custom block]] can be made using the following code: <scratchblocks> define Parallax (amount) go to x((mouse x)/(amount)) y: ((mouse y) / (amount)) </scratchblocks> To use this parallax engine, put the following code in the back sprite <scratchblocks> When green flag clicked forever Parallax [20]::custom end </scratchblocks> And then in the middle sprite <scratchblocks> When green flag clicked forever Parallax [10]::custom end </scratchblocks> And in the front sprite <scratchblocks> When green flag clicked forever Parallax [5]::custom end </scratchblocks> ==Parallax Effect On Moving Sprite== Sometimes a parallax effect on a moving sprite is desired. This could be used for things like a bird moving across the sky, a sprite walking across the screen, etc. Here's what the custom block looks like: <scratchblocks> define Parallax (amount) (x) (y) go to x(((mouse x)/(amount)) + (x)) y: (((mouse y) / (amount)) + (y)) </scratchblocks> And here's an example of how it can be used: <scratchblocks> when green flag clicked set [x v] to [240] set [y v] to [0] set [speed v] to [2] Parallax [20] (x) (y)::custom change [x v] by ((speed) * [-1]) repeat until <(x position) \< [-240]> Parallax [20] (x) (y)::custom change [x v] by ((speed) * [-1]) </scratchblocks> This code would make a sprite start on the right side of the screen and move to the left side. == See Also == * [[Art Projects]] [[Category:Scripting Tutorials]]
Записать страницу Отменить