How to Create a Zoom Effect

Материал из Поле цифровой дидактики

Шаблон:Expand A zoom effect is when a sprite zooms in when it is clicked or held, but when the mouse lets go, it goes back to its normal size. The zoom effect can be used on a sprite or background.

Methods

Method 1

This is the following script to make a sprite zoom in (for a method where the sprite can be moved by the mouse when zoomed in, see Method 2): Шаблон:Note

whenclickedsetsizeto...%foreveriftouchingmousepointer?andmousedown?thenrepeatuntilsize=...Makesurethisnumberislessthanthespritessizelimitorthisscriptwillbreak.changesizeby...Makesurethisnumberislessthanthespritessizelimitorthisscriptwillbreak.endelserepeatuntilsize=...Setthistotheregularsize.changesizeby...Mustbethenumberthatincreasestheimagebutnegative(i.e10becomes-10)endendend

Method 2

This is the following script to make a sprite zoom in and be able to move (for a method where the sprite zooms in but can not be moved, see Method 1):

Шаблон:Note

whenclickedsetsizeto...%gotox:...y:...Setthexandytotheregularxandyposition.foreveriftouchingmousepointer?andmousedown?thenrepeatuntilsize=...Makesurethisnumberislessthanthespritessizelimitorthisscriptwillbreak.changesizeby...Makesurethisnumberislessthanthespritessizelimitorthisscriptwillbreak.endrepeatuntilnotmousedown?gotomousepointerendelserepeatuntilsize=...Setthistotheregularsize.changesizeby...Mustbethenumberthatincreasestheimagebutnegative(i.e10becomes-10)endgotox:...y:...Setthexandytotheregularposition.end