Making Objects Move in Scrollers: различия между версиями
Материал из Поле цифровой дидактики
(Made a level 3 heading into a level 2 heading.) |
Patarakin (обсуждение | вклад) |
||
(не показаны 3 промежуточные версии этого же участника) | |||
Строка 1: | Строка 1: | ||
{{ | {{Scripting Tutorials | ||
|Description=Как организовать скроллинг в Scratch | |||
|Field_of_knowledge=Математика | |||
}} | |||
This tutorial explains how to make an '''object move in a [[scroller]]'''. | This tutorial explains how to make an '''object move in a [[scroller]]'''. | ||
Строка 6: | Строка 8: | ||
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. Below is the script that is needed: | 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. Below is the script that is needed: | ||
<scratchblocks> | <scratchblocks> | ||
Строка 16: | Строка 17: | ||
end | end | ||
</scratchblocks> | </scratchblocks> | ||
If a large [[costume]] is selected, it can be made to hide when it's touching the edge by adding this to the [[Forever (block)|forever loop]]: | If a large [[costume]] is selected, it can be made to hide when it's touching the edge by adding this to the [[Forever (block)|forever loop]]: | ||
<scratchblocks> | <scratchblocks> | ||
Строка 47: | Строка 48: | ||
* [[Scrolling Platformer Tutorial]] | * [[Scrolling Platformer Tutorial]] | ||
* [[Simulating Gravity]] | * [[Simulating Gravity]] | ||
[[Category:Scripting Tutorials]] | [[Category:Scripting Tutorials]] | ||
Текущая версия на 17:35, 10 ноября 2023
Описание | Как организовать скроллинг в Scratch |
---|---|
Область знаний | Математика |
Область использования (ISTE) | |
Возрастная категория |
|
Поясняющее видео | |
Близкие рецепту понятия | |
Среды и средства для приготовления рецепта: |
This tutorial explains how to make an object move in a scroller.
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. Below is the script that is needed:
when green flag clicked forever ... go to x: ((scrollX) + (xpos)) y: ((scrollY) + (ypos)) ... end
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