2.5D Pen Platformer Engine

Instructions: 日本語説明は下 \n▢How to operate \n△ Operate with arrow key or tap \nThere are hidden passages, so make good use of them! \n⭐＆❤！\n\n▢操作方法 \n△矢印キーまたはタップで操作 \n隠し通路などもあるので上手く駆使してください！\n⭐＆❤！

@Stage\n\nwhen flag clicked\nchange [☁ green flag v] by (1)\nswitch backdrop to (start v)\nclear graphic effects\nshow list [level v]\nhide variable [☁ green flag v]\nhide variable [☁ play v]\nhide variable [☁ 300% v]\nhide variable [☁ 100% v]\nhide variable [level v]\nhide variable [level.completed v]\nhide variable [clones v]\nhide variable [level.1 v]\nhide variable [touch button? v]\nhide variable [size? v]\nhide variable [story v]\nhide variable [easy? v]\nhide variable [normal? v]\nhide variable [hard? v]\nhide variable [touch button? +4 v]\nhide variable [music? v]\nhide variable [sound? v]\nhide variable [game? v]\nhide variable [difficulty? v]\nhide variable [turn? v]\nhide variable [lives? v]\nhide variable [lives 2? v]\nhide variable [wait? v]\nhide variable [touch lives v]\nhide variable [x2 v]\nhide variable [y2 v]\nhide variable [move? v]\nhide variable [ok? v]\nset [game? v] to [Start]\nif <(username) = [mathias1706]> then\n    wait (2) seconds\nelse\n    wait (0.5) seconds\nend\nbroadcast (history v)\nif <(username) = [mathias1706]> then\n    forever\n        wait until <key (down arrow v) pressed?>\n        show variable [☁ green flag v]\n        show variable [☁ play v]\n        show variable [☁ 100% v]\n        show variable [☁ 300% v]\n        wait until <not <key (down arrow v) pressed?>>\n        wait until <key (down arrow v) pressed?>\n        hide variable [☁ green flag v]\n        hide variable [☁ play v]\n        hide variable [☁ 100% v]\n        hide variable [☁ 300% v]\n        wait until <not <key (down arrow v) pressed?>>\n    end\nend\n\nwhen I receive [play v]\n\nwait until <(Game?) = [PLAY]>\nrepeat until <<(Game?) = [menu]> or <(Level) = [21]>>\n    if <(Move?) = [0]> then\n        set [x2 v] to ([x position v] of [player v])\n        set [y2 v] to ([y position v] of [player v])\n    end\nend\n\nwhen I receive [play v]\nwait until <(Game?) = [Play]>\nrepeat until <(Game?) = [menu]>\n    repeat until <(Level.Completed) = [1]>\n        if <(Level.1) = [0]> then\n            switch backdrop to ((length of [level v]) + (5))\n        end\n    end\n    wait until <(Game?) = [Won]>\n    repeat until <(Game?) = [Play]>\n        switch backdrop to ((length of [level v]) + (5))\n    end\nend\n\nwhen I receive [play v]\nwait until <(Game?) = [Play]>\nrepeat until <(Game?) = [menu]>\n    wait until <<not <(item (last) of [level v]) = (join [Level ] (Level))>> or <not <(length of [level v]) = (Level)>>>\n    set [level.1 v] to [1]\n    if <(Level) > (length of [level v])> then\n        set [level v] to (length of [level v])\n        set [level.1 v] to [0]\n    else\n        set [level.1 v] to [1]\n        delete (all) of [level v]\n        repeat until <(length of [level v]) = (Level)>\n            insert (join [Level ] (Level.1)) at (last) of [level v] \n            change [level.1 v] by (1)\n        end\n        set [level.1 v] to [0]\n    end\nend\n\n@Wait\n\nwhen I start as a clone\nif <(Game?) = [menu]> then\n    set size to (80) %\n    go to [front v] layer\n    go [backward v] (30) layers\n    switch costume to (background v)\n    go to x: (0) y: (20)\n    show\n    wait until <(Ok?) = [yes]>\n    repeat until <(Game?) = [Play]>\n        if <(y position) < [-32]> then\n            go to x: (0) y: (20)\n        end\n        change y by (-1)\n        wait (0.09) seconds\n    end\n    delete this clone\nend\n\nwhen I receive [play v]\nset [wait? v] to [yes]\ngo to x: (-600) y: (0)\npoint in direction (90)\nswitch costume to (wait v)\nset size to (100) %\nshow\nrepeat until <(round (x position)) = [-50]>\n    go to [front v] layer\n    change x by (((-50) - (round (x position))) / (9))\nend\nset [game? v] to [Play]\nswitch backdrop to (1 v)\nwait (0.75) seconds\nrepeat until <(round (x position)) < [-510]>\n    go to [front v] layer\n    change x by (((-580) - (round (x position))) / (6))\nend\nset [wait? v] to [no]\nhide\n\nwhen I receive [level completed! v]\nset [wait? v] to [yes]\ngo to x: (-600) y: (0)\npoint in direction (90)\nswitch costume to (wait v)\nset size to (100) %\nshow\nrepeat until <(round (x position)) = [-50]>\n    go to [front v] layer\n    change x by (((-50) - (round (x position))) / (9))\nend\nset [game? v] to [Won]\nwait (1.75) seconds\nset [game? v] to [Play]\nrepeat until <(round (x position)) < [-510]>\n    go to [front v] layer\n    change x by (((-580) - (round (x position))) / (6))\nend\nhide\nset [wait? v] to [no]\nif <(Level) = [21]> then\n    create clone of (_myself_ v)\nend\n\nwhen I start as a clone\nset [turn? v] to [1]\nif <<(Game?) = [Play]> and <(Level) = [21]>> then\n    point in direction (90)\n    go to x: (0) y: (-115)\n    go to [front v] layer\n    go [backward v] (9) layers\n    clear graphic effects\n    set size to (100) %\n    switch costume to (level completed hard v)\n    show\n    wait until <touching (player v)?>\n    repeat until <(round (y position)) = [0]>\n        change y by (((0) - (y position)) / (15))\n    end\n    repeat until <(Turn?) > [50]>\n        set [turn? v] to ((Turn?) * (1.02))\n        turn right (Turn?) degrees\n    end\n    repeat (100)\n        set [turn? v] to ((Turn?) * (1.005))\n        turn right (Turn?) degrees\n    end\n    repeat (200)\n        set [turn? v] to ((Turn?) * (1.005))\n        turn right (Turn?) degrees\n        change [brightness v] effect by (0.25)\n        change [ghost v] effect by (0.5)\n    end\n    hide\n    broadcast (menu v)\n    delete this clone\nend\n\nwhen I start as a clone\nif <<(Game?) = [Play]> and <(Lives?) = [0]>> then\n    go to x: (0) y: (400)\n    point in direction (90)\n    switch costume to (game over! v)\n    set size to (100) %\n    show\n    repeat until <(round (y position)) = [0]>\n        go to [front v] layer\n        change y by (((0) - (round (y position))) / (12))\n    end\n    wait (3) seconds\n    broadcast (menu v)\n    wait until <(Game?) = [MENU]>\n    delete this clone\nend\n\nwhen I receive [play v]\nwait until <(Game?) = [PLAY]>\nwait until <<(Lives?) = [0]> or <(Game?) = [menu]>>\nif <(Lives?) = [0]> then\n    wait (1) seconds\n    create clone of (_myself_ v)\nend\n\nwhen I receive [menu v]\nset [wait? v] to [yes]\ngo to x: (-600) y: (0)\npoint in direction (90)\nswitch costume to (wait v)\nset size to (100) %\nshow\nrepeat until <(round (x position)) = [-50]>\n    change x by (((-50) - (round (x position))) / (9))\n    go to [front v] layer\nend\nset [game? v] to [Menu]\nswitch backdrop to (menu v)\ncreate clone of (_myself_ v)\nwait until <(Ok?) = [yes]>\nrepeat until <(round (x position)) < [-510]>\n    change x by (((-580) - (round (x position))) / (6))\n    go to [front v] layer\nend\nset [wait? v] to [no]\nhide\n\nwhen flag clicked\nset [wait? v] to [No]\nhide\n\nwhen I receive [history v]\nset [story v] to [0]\nrepeat (3)\n    set [wait? v] to [yes]\n    go to x: (-600) y: (0)\n    point in direction (90)\n    switch costume to (wait v)\n    set size to (100) %\n    show\n    change [story v] by (1)\n    repeat until <(round (x position)) = [-50]>\n        change x by (((-50) - (round (x position))) / (8))\n        go to [front v] layer\n    end\n    switch backdrop to (join [Story ] (Story))\n    repeat until <(round (x position)) < [-510]>\n        change x by (((-580) - (round (x position))) / (10))\n        go to [front v] layer\n    end\n    set [wait? v] to [no]\n    hide\n    wait until <not <<key (space v) pressed?> or <<key (right arrow v) pressed?> or <mouse down?>>>>\n    wait until <<key (space v) pressed?> or <<key (right arrow v) pressed?> or <mouse down?>>>\nend\nbroadcast (menu v)\n\n@Player\n\ndefine Controls - Left and Right\nset [x v] to ((X) * (0.7))\nif <<key (left arrow v) pressed?> or <key (a v) pressed?>> then\n    change [x v] by (-1.5)\nend\nif <<key (right arrow v) pressed?> or <key (d v) pressed?>> then\n    change [x v] by (1.5)\nend\n\ndefine Walk (direction) (speed) max steep (max steep)\npoint in direction (direction)\nchange x by (speed)\nchange [frame v] by (([abs v] of (speed) ) / (8))\nset [slope v] to [0]\nGet Touching <(In.Platform) = [1]>\nrepeat until <<(Slope) = (max steep)> or <(Touch) = [0]>>\n    change y by (1)\n    change [slope v] by (1)\n    Get Touching <(In.Platform) = [1]>\nend\nif <(Slope) = (max steep)> then\n    change x by ((0) - (speed))\n    change y by ((0) - (Slope))\n    if <<(Touch) = [1]> and <(In.Platform) = [1]>> then\n        set [in.platform v] to [2]\n        Walk (direction) (speed) max steep (max steep)\n        if <(X) = [0]> then\n            set [in.platform v] to [1]\n        end\n    else\n        if <<<key (up arrow v) pressed?> or <key (w v) pressed?>> and <<([abs v] of (speed) ) > [3.5]> and <(Touch) > [1]>>> then\n            set [x v] to ((-1.2) * (speed))\n            set [y v] to [11]\n            set [falling v] to [6]\n            set [wall.jump v] to [15]\n        else\n            set [x v] to [0]\n        end\n    end\nend\n\ndefine Controls - Jump, Crouch\nif <<key (up arrow v) pressed?> or <key (w v) pressed?>> then\n    if <<(Jump.Key) = [0]> and <(Falling) < [3]>> then\n        if <(Sound?) = [on]> then\n            start sound [Jump v]\n        end\n        set [y v] to [14]\n        set [falling v] to [6]\n        set [jump.key v] to [1]\n    end\nelse\n    set [jump.key v] to [0]\nend\n\ndefine Check Hit Ceiling / Floor <up?>\nGet Touching \nif <(Touch) = [0]> then\n    set [in.platform v] to [1]\nelse\n    if <<up?> and <(Touch) = [1]>> then\n        set [in.platform v] to [2]\n    end\nend\nrepeat until <(Touch) < (In.Platform)>\n    if <up?> then\n        change y by (-1)\n    else\n        change y by (1)\n        set [falling v] to [0]\n    end\n    Get Touching <not <up?>>\n    set [y v] to [0]\nend\n\ndefine Get Touching <check platform?>\nif <<<touching color (#39b54a)?> or <touching color (#000000)?>> or <touching color (#d06454)?>> then\n    set [touch v] to [9]\nelse\n    if <<check platform?> and <touching (platforms v)?>> then\n        set [touch v] to [1]\n    else\n        set [touch v] to [0]\n    end\nend\n\ndefine Gravity\nif <<(y) < [4]> or <<key (up arrow v) pressed?> or <key (w v) pressed?>>> then\n    change [y v] by (-1)\nelse\n    change [y v] by (-2)\nend\nchange y by (y)\nchange [falling v] by (1)\n\nwhen I start as a clone\nwait until <(Game?) = [PLAY]>\nrepeat until <(Game?) = [MENU]>\n    if <<(Game?) = [Won]> and <(Clones) = [0]>> then\n        go to x: (0) y: (0)\n    end\n    if <<(Clones) = [1]> and <not <(Level) = [1]>>> then\n        repeat (5)\n            change [brightness v] effect by (20)\n        end\n        if <(Level) = [21]> then\n            set [clones v] to [0]\n            hide\n            stop all sounds\n            if <(Sound?) = [on]> then\n                play sound [All Level Completed v] until done\n            end\n            if <(Music?) = [on]> then\n                reset timer\n                play sound [2 v] until done\n                set volume to (100) %\n            end\n            delete this clone\n        end\n        wait until <<(Level.Completed) = [1]> and <(Clones) = [0]>>\n    end\nend\n\nwhen I start as a clone\nwait until <(Game?) = [PLAY]>\nrepeat until <(Game?) = [MENU]>\n    hide\n    go to x: (0) y: (0)\n    point in direction (90)\n    go to [front v] layer\n    hide\n    wait until <<(Game?) = [Won]> and <(Clones) = [0]>>\n    set [brightness v] effect to (-100)\n    switch costume to ((Level) + (3))\n    set size to (100) %\n    go to [front v] layer\n    show\n    repeat (5)\n        change [brightness v] effect by (20)\n    end\n    wait (1) seconds\n    repeat (5)\n        change [brightness v] effect by (-20)\n    end\n    set [clones v] to [1]\n    if <(Level) = [21]> then\n        delete this clone\n    end\nend\n\nwhen flag clicked\nhide\nset [music? v] to [On]\nset [sound? v] to [On]\nhide variable [x v]\nhide variable [y v]\nhide variable [falling v]\nhide variable [slope v]\nhide variable [in.platform v]\nhide variable [touch v]\nhide variable [frame v]\nhide variable [jump.key v]\nhide variable [wall.jump v]\nhide variable [speed y v]\nshow list [y v]\ndelete (all) of [y v]\ndelete (all) of [y v]\nrepeat (10)\n    insert [-110] at (last) of [y v] \nend\nrepeat (4)\n    insert [150] at (last) of [y v] \nend\ninsert [0] at (last) of [y v] \nrepeat (5)\n    insert [130] at (last) of [y v] \nend\ninsert [-110] at (last) of [y v] \nshow list [y-2 v]\ndelete (all) of [y-2 v]\ninsert [-105] at (last) of [y-2 v] \nrepeat (3)\n    insert [-92] at (last) of [y-2 v] \nend\ninsert [66] at (last) of [y-2 v] \ninsert [130] at (last) of [y-2 v] \ninsert [61] at (last) of [y-2 v] \nrepeat (4)\n    insert [-92] at (last) of [y-2 v] \nend\ninsert [-105] at (last) of [y-2 v] \ninsert [145] at (last) of [y-2 v] \ninsert [-100] at (last) of [y-2 v] \ninsert [145] at (last) of [y-2 v] \ninsert [-155] at (last) of [y-2 v] \ninsert [68] at (last) of [y-2 v] \nrepeat (2)\n    insert [-100] at (last) of [y-2 v] \nend\ninsert [-105] at (last) of [y-2 v] \n\nwhen I start as a clone\nset size to (50) %\nswitch costume to (arrow1-a v)\nset [ghost v] effect to (100)\ngo to x: (225) y: (item (Level) of [y-2 v])\npoint in direction (90)\nwait until <(Game?) = [Play]>\nshow\nrepeat until <<(Game?) = [MENU]> or <(Lives?) = [0]>>\n    wait until <(Clones) = [1]>\n    show\n    go to [front v] layer\n    clear graphic effects\n    go [backward v] (4) layers\n    set size to (50) %\n    switch costume to (arrow1-a v)\n    go to x: (225) y: (item (Level) of [y-2 v])\n    show\n    repeat until <<<(x position) < [216]> or <(Clones) = [0]>> or <(Lives?) = [0]>>\n        go to x: ((x position) - (1)) y: (y position)\n        wait (0) seconds\n        if <(Level) = [21]> then\n            hide\n        end\n    end\n    if <(Clones) = [1]> then\n        go to x: (215) y: (item (Level) of [y-2 v])\n    end\n    repeat until <<<(x position) > [224]> or <(Clones) = [0]>> or <(Lives?) = [0]>>\n        go to x: ((x position) + (1)) y: (y position)\n        wait (0) seconds\n        if <(Level) = [21]> then\n            hide\n        end\n    end\nend\nwait until <(Game?) = [MENU]>\ndelete this clone\n\nwhen I receive [play v]\nhide\nwait until <(Game?) = [Play]>\ndelete (all) of [level v]\ninsert [Level 1] at (1) of [level v] \ncreate clone of (_myself_ v)\nset [level.completed v] to [0]\nset [clones v] to [1]\nset [level v] to [1]\nset size to (45) %\ngo to x: (-215) y: (-110)\npoint in direction (90)\nclear graphic effects\nshow\nrepeat until <(Game?) = [Menu]>\n    switch costume to (join [Player \(] (join (Difficulty?) [\)]))\n    go to [front v] layer\n    go [backward v] (3) layers\n    show\n    wait until <not <touching (wait v)?>>\n    go to [front v] layer\n    Controls - Jump, Crouch\n    Gravity\n    Check Hit Ceiling / Floor <(y) > [0]>\n    if <(Wall.Jump) > [0]> then\n        change [wall.jump v] by (-1)\n    else\n        Controls - Left and Right\n    end\n    if <(X) < [-0.5]> then\n        Walk (-90) (X) max steep (([ceiling v] of ([abs v] of ((X) * (1.3)) ) ) + (1))\n    else\n        if <(X) > [0.5]> then\n            Walk (90) (X) max steep (([ceiling v] of ([abs v] of ((X) * (1.3)) ) ) + (1))\n        else\n            set [frame v] to [0]\n        end\n    end\n    if <<(x position) > [210]> and <<touching color (#ee2a7b)?> and <(Move?) = [0]>>> then\n        if <(Sound?) = [on]> then\n            start sound [Level Completed v]\n        end\n        wait (0.1) seconds\n        change [level v] by (1)\n        insert (join [Level ] (Level)) at (last) of [level v] \n        set [level.completed v] to [1]\n        set [clones v] to [0]\n        broadcast (level completed! v)\n        wait until <(Game?) = [Won]>\n        go to x: (-215) y: (item (Level) of [y v])\n        point in direction (90)\n        wait until <not <touching (wait v)?>>\n        set [level.completed v] to [0]\n        if <(Level) = [21]> then\n            if <(Difficulty?) = [easy]> then\n                set [easy? v] to [ok]\n            else\n                if <(Difficulty?) = [normal]> then\n                    set [normal? v] to [ok]\n                else\n                    set [hard? v] to [ok]\n                end\n            end\n            go to x: (-215) y: (-140)\n            Check Hit Ceiling / Floor <(y) > [0]>\n            wait (0.5) seconds\n            repeat until <(round (x position)) = [-30]>\n                change x by (((-30) - (round (x position))) / (10))\n            end\n            change [☁ 100% v] by (1)\n            if <<(Easy?) = [ok]> and <<(Normal?) = [ok]> and <(Hard?) = [ok]>>> then\n                change [☁ 300% v] by (1)\n            end\n            wait until <(Game?) = [menu]>\n            hide\n        end\n    end\n    if <<touching color (#767676)?> or <(y position) < [-180]>> then\n        wait (0) seconds\n        if <(Sound?) = [on]> then\n            if <(y position) < [-180]> then\n                start sound [Death v]\n            else\n                start sound [hurt v]\n            end\n        end\n        if <(Lives 2?) = [1]> then\n            if <(Lives?) = [1]> then\n                set [lives? v] to ((Lives?) - (1))\n                repeat (5)\n                    change [ghost v] effect by (20)\n                end\n                wait until <(Game?) = [menu]>\n                hide\n                stop [this script v]\n            else\n                set [lives 2? v] to [3]\n                set [lives? v] to ((Lives?) - (1))\n            end\n        else\n            set [lives 2? v] to ((Lives 2?) - (1))\n        end\n        repeat (5)\n            change [ghost v] effect by (20)\n        end\n        go to x: (-215) y: (item (Level) of [y v])\n        point in direction (90)\n        Check Hit Ceiling / Floor <(y) > [0]>\n        wait (0.2) seconds\n        repeat (5)\n            change [ghost v] effect by (-20)\n        end\n    end\n    if <(X) > [5]> then\n        set [x v] to [5]\n    end\nend\nhide\n\nwhen I receive [play v]\nset [move? v] to [0]\nwait until <(Game?) = [PLAY]>\nrepeat until <<(Game?) = [menu]> or <(Level) = [21]>>\n    wait until <<touching (mouse-pointer v)?> and <mouse down?>>\n    set [move? v] to [1]\n    hide\n    wait until <<not <<touching (mouse-pointer v)?> and <mouse down?>>> or <touching (_edge_ v)?>>\n    go to x: (X2) y: (Y2)\n    set [move? v] to [0]\n    show\nend\n\nwhen I receive [play v]\nwait until <(Game?) = [PLAY]>\nwait (0.2) seconds\nset volume to (0) %\nrepeat (20)\n    change volume by (5)\nend\nrepeat until <(Game?) = [MENU]>\n    if <(Music?) = [ON]> then\n        reset timer\n        set volume to (99) %\n        start sound [1 v]\n        repeat until <<(Game?) = [MENU]> or <(Music?) = [OFF]>>\n            if <<(timer) > [81.6]> and <(volume) = [99]>> then\n                stop all sounds\n                start sound [2 v]\n                reset timer\n                set volume to (100) %\n            end\n            if <(timer) > [121.2]> then\n                stop all sounds\n                start sound [2 v]\n                reset timer\n            end\n        end\n    else\n        stop all sounds\n    end\nend\nrepeat (20)\n    change volume by (-5)\nend\n\n@Buttons\n\nwhen I receive [menu v]\nhide variable [brightness? v]\nhide variable [touch? v]\nset [touch button? v] to [0]\nset [size? v] to [No]\nset [touch? v] to [1]\nset [ok? v] to [NO]\nwait until <(Game?) = [menu]>\nhide\nrepeat (12)\n    create clone of (_myself_ v)\n    change [touch? v] by (1)\nend\nset [ok? v] to [YES]\n\ndefine Button 5 ( Touch? 11 12 )\nstop [other scripts in sprite v]\nset size to (100) %\npoint in direction (90)\nif <(Touch?) = [11]> then\n    if <(Sound?) = [On]> then\n        switch costume to (sound on v)\n    else\n        switch costume to (music off v)\n    end\nelse\n    if <(Music?) = [On]> then\n        switch costume to (music on  v)\n    else\n        switch costume to (music off v)\n    end\nend\nshow\nwait until <(Wait?) = [no]>\nif <(Touch?) = [11]> then\n    if <(Sound?) = [On]> then\n        switch costume to (sound on v)\n    else\n        switch costume to (music off v)\n    end\n    repeat until <(Game?) = [Play]>\n        if <<mouse down?> and <touching (mouse-pointer v)?>> then\n            if <(Sound?) = [on]> then\n                start sound [Button v]\n            end\n            if <(Sound?) = [On]> then\n                set [sound? v] to [Off]\n                switch costume to (sound off v)\n            else\n                set [sound? v] to [On]\n                switch costume to (sound on v)\n            end\n            wait until <not <mouse down?>>\n        end\n        if <(Wait?) = [yes]> then\n            wait until <(Game?) = [Play]>\n        end\n    end\nelse\n    if <(Touch?) = [12]> then\n        if <(Music?) = [On]> then\n            switch costume to (music on  v)\n        else\n            switch costume to (music off v)\n        end\n        repeat until <(Game?) = [Play]>\n            if <<mouse down?> and <touching (mouse-pointer v)?>> then\n                if <(Sound?) = [on]> then\n                    start sound [Button v]\n                end\n                if <(Music?) = [On]> then\n                    set [music? v] to [Off]\n                    switch costume to (music off v)\n                else\n                    set [music? v] to [On]\n                    switch costume to (music on  v)\n                end\n                wait until <not <mouse down?>>\n            end\n            if <(Wait?) = [yes]> then\n                wait until <(Game?) = [Play]>\n            end\n        end\n    end\nend\ndelete this clone\n\ndefine Button 4 ( Touch? 8 9 10 )\nstop [other scripts in sprite v]\nif <<<(Touch?) = [8]> and <(Easy?) = [ok]>> or <<<(Touch?) = [9]> and <(Normal?) = [ok]>> or <<(Touch?) = [10]> and <(Hard?) = [ok]>>>> then\n    set size to (100) %\n    show\n    repeat until <(Game?) = [Play]>\n        if <(costume [number v]) = (Touch Button? +4)> then\n            repeat until <<[110] = (round (x position))> or <not <(Touch Button? +4) = (costume [number v])>>>\n                change x by (((110) - (round (x position))) / (4))\n            end\n        end\n        if <not <(Touch Button? +4) = (costume [number v])>> then\n            repeat until <<[0] = (round (x position))> or <(Touch Button? +4) = (costume [number v])>>\n                change x by (((0) - (round (x position))) / (4))\n            end\n        end\n    end\nend\ndelete this clone\n\nwhen I start as a clone\npoint in direction (90)\nswitch costume to (Touch?)\ngo to [front v] layer\nif <(Touch?) < [4]> then\n    go [backward v] (1) layers\n    go to x: (0) y: ((110) - ((Touch?) * (80)))\n    Button 1 ( Touch? 1 2 3 )\nend\nif <(Touch?) < [7]> then\n    go [backward v] (4) layers\n    go to x: (0) y: ((75) - (((Touch?) - (3)) * (80)))\n    Button 2 ( Touch? 4 5 6 )\nend\nif <(Touch?) = [7]> then\n    go to x: (0) y: (130)\n    go [backward v] (2) layers\n    Buton 3 ( Touch? 7 )\nend\nif <(Touch?) < [11]> then\n    go [backward v] (9) layers\n    go to x: (0) y: ((80) - (((Touch?) - (7)) * (80)))\n    Button 4 ( Touch? 8 9 10 )\nend\nif <(Touch?) < [13]> then\n    go [backward v] (1) layers\n    go to x: ((230) - (((Touch?) - (10)) * (55))) y: (-170)\n    Button 5 ( Touch? 11 12 )\nend\n\ndefine Button 1 ( Touch? 1 2 3 )\nstop [other scripts in sprite v]\nset size to (90) %\nshow\nset [size? v] to [Ok]\nwait until <not <mouse down?>>\nwait until <(Wait?) = [No]>\nrepeat until <(Game?) = [Play]>\n    if <touching (mouse-pointer v)?> then\n        if <(Sound?) = [on]> then\n            start sound [Button v]\n        end\n        set [brightness? v] to [0]\n        set [touch button? v] to ((costume [number v]) + (3))\n        set [touch button? +4 v] to ((costume [number v]) + (7))\n        repeat until <<<<(Game?) = [Play]> or <not <touching (mouse-pointer v)?>>> or <(Brightness?) = [13]>> or <mouse down?>>\n            change [brightness? v] by (((13) - (Brightness?)) / (4))\n            set [brightness v] effect to ((Brightness?) / (2))\n            set size to ((95) + ((Brightness?) / (2))) %\n        end\n    end\n    wait until <<mouse down?> or <<not <touching (mouse-pointer v)?>> or <(Game?) = [Play]>>>\n    if <<mouse down?> and <touching (mouse-pointer v)?>> then\n        if <(costume [number v]) = [1]> then\n            set [difficulty? v] to [Easy]\n            set [lives? v] to [5]\n        end\n        if <(costume [number v]) = [2]> then\n            set [difficulty? v] to [Normal]\n            set [lives? v] to [3]\n        end\n        if <(costume [number v]) = [3]> then\n            set [difficulty? v] to [Hard]\n            set [lives? v] to [1]\n        end\n        set [lives 2? v] to [3]\n        change [☁ play v] by (1)\n        broadcast (play v)\n        wait until <(Game?) = [PLAY]>\n    end\n    if <<not <touching (mouse-pointer v)?>> or <(Brightness?) = [0]>> then\n        set [touch button? v] to [0]\n        set [touch button? +4 v] to [0]\n    end\n    repeat until <<touching (mouse-pointer v)?> or <(Game?) = [play]>>\n        change [brightness? v] by (((0) - (Brightness?)) / (3))\n        set [brightness v] effect to (Brightness?)\n        set size to ((90) + ((Brightness?) / (2))) %\n    end\n    set [touch button? v] to ((costume [number v]) + (3))\n    set [touch button? +4 v] to ((costume [number v]) + (7))\nend\ndelete this clone\n\ndefine Button 2 ( Touch? 4 5 6 )\nstop [other scripts in sprite v]\nset size to (90) %\nshow\nrepeat until <(Game?) = [Play]>\n    if <(Touch Button?) = (costume [number v])> then\n        repeat until <<[-120] = (round (x position))> or <not <(Touch Button?) = (costume [number v])>>>\n            change x by (((-120) - (round (x position))) / (4))\n        end\n    end\n    if <not <(Touch Button?) = (costume [number v])>> then\n        repeat until <<[0] = (round (x position))> or <(Touch Button?) = (costume [number v])>>\n            change x by (((0) - (round (x position))) / (4))\n        end\n    end\nend\ndelete this clone\n\ndefine Buton 3 ( Touch? 7 )\nstop [other scripts in sprite v]\nset size to (100) %\npoint in direction (90)\nshow\nwait until <(Wait?) = [NO]>\nrepeat until <(Game?) = [Play]>\n    if <<mouse down?> and <touching (mouse-pointer v)?>> then\n        if <(Sound?) = [on]> then\n            start sound [Button v]\n        end\n        if <(round (direction)) = [-90]> then\n            repeat until <(round (direction)) = [90]>\n                turn right (((90) - (direction)) / (5)) degrees\n            end\n            point in direction (round (direction))\n            wait until <not <mouse down?>>\n        else\n            repeat until <(round (direction)) = [-90]>\n                turn right (((-90) - (direction)) / (5)) degrees\n            end\n            point in direction (round (direction))\n            wait until <not <mouse down?>>\n        end\n    end\n    if <(Wait?) = [yes]> then\n        wait until <(Game?) = [Play]>\n    end\nend\ndelete this clone\n\nwhen I receive [menu v]\nwait (0.1) seconds\nstop all sounds\nwait until <(Game?) = [MENU]>\nrepeat (20)\n    change volume by (5)\nend\nreset timer\nstart sound [Music 1 v]\nrepeat until <(Game?) = [Play]>\n    if <(timer) > [169]> then\n        reset timer\n        start sound [Music 1 v]\n    else\n        repeat (20)\n            change volume by (5)\n        end\n    end\n    wait until <<<(timer) > [169]> or <(Music?) = [off]>> or <(Game?) = [play]>>\n    if <(Music?) = [off]> then\n        repeat (20)\n            change volume by (-5)\n        end\n        wait until <<(Game?) = [play]> or <(Music?) = [ON]>>\n    end\nend\nrepeat (20)\n    change volume by (-5)\nend\n\nwhen flag clicked\nset [ok? v] to [YES]\nset [easy? v] to [no]\nset [normal? v] to [no]\nset [hard? v] to [no]\nhide\n\n@Lives\n\nwhen I receive [play v]\nset [clone lives? v] to [1]\nwait until <(Game?) = [Play]>\nrepeat (Lives?)\n    create clone of (_myself_ v)\n    change [clone lives? v] by (1)\nend\n\nwhen I start as a clone\nswitch costume to (3 v)\ngo to x: (((250) - ((24) * (Clone Lives?))) - ((1) * (Clone Lives?))) y: (165)\ngo to [front v] layer\ngo [backward v] (6) layers\nset size to (60) %\nshow\nrepeat until <<(Level) = [21]> or <(Game?) = [MENU]>>\n    if <not <(Clone Lives?) > (Lives?)>> then\n        if <(Clone Lives?) = (Lives?)> then\n            switch costume to ((Lives 2?) + (2))\n        else\n            switch costume to (3 v)\n        end\n        set size to (60) %\n    else\n        switch costume to (0 v)\n        repeat (2)\n            change [ghost v] effect by (50)\n        end\n        delete this clone\n    end\nend\ndelete this clone\n\nwhen flag clicked\nhide variable [clone lives? v]\nhide\n\n