BB8 - A star wars platformer 

Instructions: [Arrow keys] to move\n[R] To restart level\n[S] To skip a level\n-------------------------------------------------------------------------\n.To open some doors roll over the red button\n.do not fall down\n.do not touch the jawa\n.Do not touch the stalactites/ stalagmites   \ngo to the holocron to complete each level\n

@Stage\n\nwhen flag clicked\nforever\n    if <(costume) = [1]> then\n        set [ghost v] effect to (20)\n        switch backdrop to (backdrop1 v)\n        play sound [Star Wars - Cantina Song.mp3 v] until done\n    end\n    if <(costume) = [7]> then\n        set [ghost v] effect to (50)\n        switch backdrop to (backdrop2 v)\n    end\n    if <(costume) = [12]> then\n        set [ghost v] effect to (0)\n        switch backdrop to (backdrop3 v)\n    end\nend\n\n@body\n\nwhen flag clicked\nhide\n\nwhen I receive [start v]\nset [holicron number v] to [0]\ngo to x: (-217) y: (-1)\npoint in direction (90)\nset size to (20) %\nshow\nset rotation style [all around v]\nforever\n    change [yv v] by (-0.5)\n    if <key (right arrow v) pressed?> then\n        change [xv v] by (0.8)\n    end\n    if <key (left arrow v) pressed?> then\n        change [xv v] by (-0.8)\n    end\n    set [xv v] to ((Xv) * (0.9))\n    change x by (Xv)\n    if <<touching (floor v)?> or > then\n        change y by (1)\n        if <<touching (floor v)?> or > then\n            change y by (1)\n            if <<touching (floor v)?> or > then\n                change y by (1)\n                if <<touching (floor v)?> or > then\n                    change y by (1)\n                    if <<touching (floor v)?> or > then\n                        change y by (1)\n                        if <<touching (floor v)?> or > then\n                            change x by ((Xv) * (-1))\n                            change x by (-1)\n                            change y by (-5)\n                            change x by (1)\n                            if <<key (up arrow v) pressed?> and <key (left arrow v) pressed?>> then\n                                set [xv v] to [7]\n                                set [yv v] to [7]\n                            end\n                            if <<key (up arrow v) pressed?> and <key (right arrow v) pressed?>> then\n                                set [xv v] to [-7]\n                                set [yv v] to [7]\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\n    change y by (Yv)\n    if <<touching (floor v)?> or > then\n        change y by ((Yv) * (-1))\n        set [yv v] to [0]\n    end\n    change y by (-1)\n    if <<touching (floor v)?> or > then\n        if <key (up arrow v) pressed?> then\n            set [yv v] to [10]\n        end\n    end\n    change y by (1)\nend\n\nwhen I receive [start v]\nforever\n    turn right ((Xv) * (4)) degrees\nend\n\nwhen flag clicked\nset volume to (0) %\n\nwhen I receive [next v]\ngo to x: (-217) y: (-1)\n\nwhen I receive [start v]\nforever\n    if <[-155] > (y position)> then\n        go to x: (-217) y: (-1)\n    end\nend\n\nwhen I receive [start v]\nset volume to (100) %\nforever\n    play sound [Star Wars - Cantina Song.mp3 v] until done\nend\n\nwhen I receive [start v]\nforever\n    if <touching (jawa v)?> then\n        go to x: (-217) y: (-1)\n    end\nend\n\nwhen I receive [start v]\nforever\n    if <touching (holocron v)?> then\n        if <(costume) = [15]> then\n            change [holicron number v] by (1)\n            broadcast (finish v)\n        end\n        broadcast (next v)\n        change [holicron number v] by (1)\n    end\n    if <key (s v) pressed?> then\n        if <(costume) = [15]> then\n            change [holicron number v] by (1)\n            broadcast (finish v)\n            stop [this script v]\n        end\n        broadcast (next v)\n        wait (0.2) seconds\n    end\n    if <key (r v) pressed?> then\n        go to x: (-217) y: (-1)\n    end\n    if <touching (stalegmite/ stalegtite v)?> then\n        go to x: (-217) y: (-1)\n    end\nend\n\nwhen I receive [finish v]\nforever\n    hide\n    stop [other scripts in sprite v]\nend\n\nwhen I receive [finish v]\nforever\n    hide\nend\n\nwhen I receive [start v]\nforever\n    if <key (s v) pressed?> then\n        change [holicron number v] by (1)\n    end\nend\n\nturn right (15) degrees\n\n@head\n\nwhen flag clicked\nhide\n\nwhen I receive [start v]\npoint in direction (90)\nshow\ngo to x: (-144) y: (10)\nset size to (20) %\nforever\n    if <key (right arrow v) pressed?> then\n        point in direction (-90)\n        change [xv v] by (0.8)\n    end\n    if <key (left arrow v) pressed?> then\n        point in direction (90)\n        change [xv v] by (-0.8)\n    end\n    set [xv v] to ((Xv) * (0.9))\n    change x by (Xv)\n    if <<touching (floor v)?> or <touching (_edge_ v)?>> then\n        change y by (1)\n        if <<touching (floor v)?> or <touching (_edge_ v)?>> then\n            change y by (1)\n            if <<touching (floor v)?> or <touching (_edge_ v)?>> then\n                change y by (1)\n                if <<touching (floor v)?> or <touching (_edge_ v)?>> then\n                    change y by (1)\n                    if <<touching (floor v)?> or <touching (_edge_ v)?>> then\n                        change y by (1)\n                        if <<touching (floor v)?> or <touching (_edge_ v)?>> then\n                            change x by ((Xv) * (-1))\n                            change x by (-1)\n                            change y by (-5)\n                            change x by (1)\n                            if <<key (up arrow v) pressed?> and <key (left arrow v) pressed?>> then\n                                set [xv v] to [7]\n                                set [yv v] to [7]\n                            end\n                            if <<key (up arrow v) pressed?> and <key (right arrow v) pressed?>> then\n                                set [xv v] to [-7]\n                                set [yv v] to [7]\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\n    change y by (Yv)\n    if <<touching (floor v)?> or <touching (_edge_ v)?>> then\n        change y by ((Yv) * (-1))\n        set [yv v] to [0]\n    end\n    change y by (-1)\n    if <<touching (floor v)?> or <touching (_edge_ v)?>> then\n        if <key (up arrow v) pressed?> then\n            set [yv v] to [10]\n        end\n    end\n    change y by (1)\nend\n\nwhen I receive [start v]\nshow\nforever\n    go to (body v)\nend\n\nwhen I receive [finish v]\nforever\n    hide\nend\n\nwhen I receive [finish v]\nforever\n    hide\nend\n\n@floor\n\nwhen flag clicked\nhide\n\nwhen I receive [next v]\nnext costume\nforever\n    if <(costume) = [15]> then\n        stop [this script v]\n    end\nend\n\nwhen I receive [finish v]\nforever\n    hide\nend\n\nwhen I receive [start v]\nswitch costume to (costume1 v)\ngo to x: (0) y: (0)\nshow\nforever\n    set [costume v] to (costume [number v])\nend\n\n@Thumbnail\n\nwhen [space v] key pressed\nhide\n\nwhen flag clicked\nshow\ngo to x: (0) y: (0)\n\nwhen flag clicked\nswitch costume to (costume3 v)\nset volume to (60) %\nforever\n    play sound [Star Wars - The Clone Wars.mp2 v] until done\nend\n\nwhen I receive [start v]\nset volume to (0) %\nstop all sounds\n\nwhen I receive [start v]\nhide\n\nwhen I receive [story v]\nswitch costume to (costume4 v)\nforever\n    repeat until <(costume [number v]) = [4]>\n        if <key (a v) pressed?> then\n            next costume\n            wait (0.5) seconds\n        end\n    end\n    if <key (a v) pressed?> then\n        if <(costume [number v]) = [4]> then\n            broadcast (start v)\n        end\n    end\nend\n\nwhen I receive [finish v]\nshow\nswitch costume to (costume1 v)\nwait (5) seconds\nswitch costume to (costume6 v)\n\n@ThumbnIL Bckground\n\nwhen flag clicked\ngo [backward v] (4) layers\nshow\ngo to x: (0) y: (0)\n\nwhen [space v] key pressed\nhide\n\nwhen I receive [start v]\nhide\n\nwhen I receive [finish v]\nforever\n    hide\nend\n\n@holocron\n\nwhen flag clicked\nhide\n\nwhen I receive [start v]\nswitch costume to (costume2 v)\nset [brightness v] effect to (30)\nforever\n    go to [front v] layer\n    go to x: (70) y: (35)\n    show\nend\n\nwhen I receive [next v]\nnext costume\n\nwhen I receive [finish v]\nforever\n    hide\nend\n\n@start\n\nwhen [space v] key pressed\nhide\n\nwhen flag clicked\nswitch costume to (costume1 v)\nshow\ngo to [front v] layer\ngo to x: (128) y: (134)\nforever\n    if <touching (mouse-pointer v)?> then\n        switch costume to (costume2 v)\n    else\n        switch costume to (costume1 v)\n    end\nend\n\nwhen this sprite clicked\nbroadcast (story v)\n\nwhen I receive [start v]\nhide\n\nwhen I receive [story v]\nhide\n\nwhen I receive [finish v]\nforever\n    hide\nend\n\n@holocron  number\n\nwhen flag clicked\nhide\n\nwhen I receive [start v]\nswitch costume to (costume4 v)\nforever\n    show\nend\n\nset [holicron number v] to [0]\n\nwhen I receive [next v]\nnext costume\n\nwhen I receive [start v]\nforever\n    go to [front v] layer\nend\n\nwhen I receive [finish v]\nforever\n    hide\nend\n\n@moving door\n\nwhen flag clicked\nhide\n\nwhen [space v] key pressed\n\nwhen I receive [start v]\nset [ghost v] effect to (0)\nswitch costume to (costume1 v)\ngo to x: (0) y: (0)\nshow\nforever\n    if <(door) = [1]> then\n        hide\n    else\n        show\n    end\nend\n\nwhen I receive [next v]\nnext costume\n\nwhen I receive [finish v]\nforever\n    hide\nend\n\n@button\n\nwhen flag clicked\nhide\n\nwhen [space v] key pressed\n\nwhen I receive [start v]\nset [color v] effect to (0)\nset [door v] to [0]\nswitch costume to (costume1 v)\ngo to x: (0) y: (0)\nshow\nforever\n    if < or <touching (body v)?>> then\n        broadcast (botton on v)\n        set [door v] to [1]\n    end\nend\n\nwhen I receive [next v]\nset [color v] effect to (0)\nset [door v] to [0]\nnext costume\n\nwhen I receive [botton on v]\nset [color v] effect to (50)\n\ngo [backward v] (4) layers\n\nset [color v] effect to (0)\n\nwhen I receive [finish v]\nforever\n    hide\nend\n\n@jawa\n\nwhen flag clicked\nhide\n\nwhen I receive [next v]\ngo to x: (0) y: (0)\nnext costume\n\nwhen I receive [start v]\ngo to x: (0) y: (0)\nswitch costume to (costume2 v)\nshow\nswitch costume to (costume2 v)\nforever\n    go to [front v] layer\n    if <(costume) = [7]> then\n        step (1) (90) (0) repeat (20)\n        step (-1) (90) (0) repeat (20)\n    end\n    if <(costume) = [8]> then\n        step (1) (90) (0) repeat (20)\n        step (-1) (90) (0) repeat (20)\n    end\n    if <(costume) = [11]> then\n        step (2) (90) (0) repeat (25)\n        step (-2) (90) (0) repeat (25)\n    end\nend\n\nwhen I receive [start v]\nshow\n\ndefine None\nrepeat (repeat)\n    point in direction (point)\n    change x by (steps)\n    change y by (yjump)\nend\n\nwhen I receive [finish v]\nforever\n    hide\nend\n\n@Sprite1\n\nwhen flag clicked\nhide\n\nwhen I receive [start v]\nhide\ngo to x: (0) y: (0)\nforever\n    if <(costume) = [1]> then\n        hide\n    end\n    if <(costume) = [7]> then\n        go [backward v] (20) layers\n        repeat until <(costume) = [12]>\n            create clone of (_myself_ v)\n            wait (0.25) seconds\n        end\n    end\nend\n\nwhen I start as a clone\nshow\ngo to x: (-230) y: (pick random (159) to (-13))\nset [color v] effect to (pick random (0) to (15))\nset [ghost v] effect to (pick random (0) to (20))\nset [brightness v] effect to (pick random (1) to (10))\nset size to (pick random (80) to (120)) %\nforever\n    switch costume to (costume1 v)\n    repeat until <(costume) = [12]>\n        go [backward v] (20) layers\n        repeat until <touching (_edge_ v)?>\n            change x by (pick random (1) to (3))\n            if <(costume) = [12]> then\n                delete this clone\n            end\n            if <(costume) = [1]> then\n                delete this clone\n            end\n        end\n        if <touching (_edge_ v)?> then\n            delete this clone\n        end\n        if <(costume) = [12]> then\n            delete this clone\n        end\n    end\nend\n\nwhen I receive [finish v]\nforever\n    hide\nend\n\nwhen I receive [finish v]\nforever\n    hide\nend\n\n@Sprite2\n\nwhen flag clicked\nhide\n\nwhen I receive [start v]\nhide\ngo to x: (0) y: (0)\nforever\n    if <(costume) = [1]> then\n        hide\n    end\n    if <(costume) = [12]> then\n        go [backward v] (20) layers\n        repeat until <(costume) = [1]>\n            create clone of (_myself_ v)\n            wait (0.25) seconds\n        end\n    end\nend\n\nwhen I start as a clone\nshow\ngo to x: (pick random (-228) to (223)) y: (172)\nset [color v] effect to (pick random (0) to (15))\nset [ghost v] effect to (pick random (0) to (20))\nset [brightness v] effect to (pick random (1) to (10))\nset size to (pick random (80) to (120)) %\nforever\n    switch costume to (costume1 v)\n    repeat until <(costume) = [1]>\n        go [backward v] (20) layers\n        repeat until <touching (_edge_ v)?>\n            change y by (-1)\n            if <(costume) = [1]> then\n                delete this clone\n            end\n        end\n        if <touching (_edge_ v)?> then\n            delete this clone\n        end\n        if <(costume) = [1]> then\n            delete this clone\n        end\n    end\nend\n\nshow\n\nwhen I receive [finish v]\nforever\n    hide\nend\n\n@stalegmite/ stalegtite\n\nwhen flag clicked\nhide\ngo to x: (0) y: (0)\n\nwhen I receive [start v]\nswitch costume to (costume1 v)\nshow\n\nwhen I receive [next v]\nnext costume\n\ngo [backward v] (2) layers\n\nwhen I receive [finish v]\nforever\n    hide\nend\n\nwhen I receive [finish v]\nforever\n    play sound [Star Wars - Return of the Jedi - Victory Celebration - End Title.mp3 v] until done\nend\n\n