Space - A Platformer 


@Stage\n\nwhen I receive [animation v]\nswitch backdrop to (backdrop2 v)\n\nwhen flag clicked\nswitch backdrop to (backdrop1 v)\n\nwhen I receive [black v]\nswitch backdrop to (backdrop3 v)\nwait (2) seconds\nswitch backdrop to (backdrop4 v)\nforever\n    if <key (space v) pressed?> then\n        broadcast (start v)\n        stop [this script v]\n    end\nend\n\nwhen I receive [start v]\nrepeat (4)\n    wait (0.5) seconds\n    switch backdrop to (backdrop5 v)\n    wait (0.5) seconds\n    switch backdrop to (backdrop4 v)\nend\nwait (1) seconds\nswitch backdrop to (backdrop6 v)\n\nwhen flag clicked\nforever\n    play sound [Chaoz-Fantasy-8-Bit Onacona v] until done\nend\n\n@talker\n\nwhen flag clicked\ngo to x: (-7) y: (10)\nswitch costume to (costume1 v)\nset [ghost v] effect to (100)\nset size to (100) %\nshow\nrepeat (20)\n    change [ghost v] effect by (-5)\nend\nwait (3) seconds\nrepeat (20)\n    change [ghost v] effect by (5)\nend\nswitch costume to (costume2 v)\nwait (1) seconds\nrepeat (20)\n    change [ghost v] effect by (-5)\nend\nwait (3) seconds\nrepeat (20)\n    change [ghost v] effect by (5)\nend\nwait (1) seconds\nswitch costume to (costume3 v)\nrepeat (20)\n    change [ghost v] effect by (-5)\nend\nwait (3) seconds\nrepeat (20)\n    change [ghost v] effect by (5)\nend\nwait (1) seconds\nswitch costume to (costume4 v)\nrepeat (20)\n    change [ghost v] effect by (-5)\nend\nwait (3) seconds\nrepeat (20)\n    change [ghost v] effect by (5)\nend\nwait (1) seconds\nswitch costume to (costume5 v)\nrepeat (20)\n    change [ghost v] effect by (-5)\nend\nwait (3) seconds\nrepeat (20)\n    change [ghost v] effect by (5)\nend\nwait (1) seconds\nhide\nbroadcast (Animation v)\nstop [this script v]\n\n@spaceship crash\n\nwhen flag clicked\nhide\n\nwhen I receive [animation v]\nshow\ngo to [front v] layer\nrepeat (99)\n    next costume\nend\nwait (0.2) seconds\nhide\nbroadcast (spaceship2 v)\n\n@crash\n\nwhen I receive [spaceship2 v]\nshow\nswitch costume to (crash-0 v)\nrepeat (43)\n    next costume\nend\nswitch costume to (crash-42 v)\nwait (1) seconds\nhide\nbroadcast (black v)\n\nwhen flag clicked\nhide\nset size to (200) %\n\n@player\n\nwhen flag clicked\nhide\n\nwhen backdrop switches to [backdrop6 v]\nshow\ngo to x: (-185) y: (7)\nforever\n    if <key (right arrow v) pressed?> then\n        change [xv v] by (1)\n        switch costume to (costume1 v)\n    end\n    if <key (left arrow v) pressed?> then\n        change [xv v] by (-1)\n        switch costume to (costume2 v)\n    end\n    set [xv v] to ((Xv) * (0.9))\n    change x by (Xv)\n    if <touching color (#000000)?> then\n        change y by (1)\n        if <touching color (#000000)?> then\n            change y by (1)\n            if <touching color (#000000)?> then\n                change y by (1)\n                if <touching color (#000000)?> then\n                    change y by (1)\n                    if <touching color (#000000)?> then\n                        change y by (1)\n                        if <touching color (#000000)?> then\n                            change x by ((Xv) * (-1))\n                            if <key (up arrow v) pressed?> then\n                                if <(Xv) > [0]> then\n                                    set [xv v] to [-5]\n                                else\n                                    set [xv v] to [5]\n                                end\n                                set [yv v] to [10]\n                            else\n                                set [xv v] to [0]\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\n    change [yv v] by (-1)\n    change y by (Yv)\n    if <touching color (#000000)?> then\n        change y by ((Yv) * (-1))\n        set [yv v] to [0]\n    end\n    change y by (-1)\n    if <touching color (#000000)?> then\n        if <key (up arrow v) pressed?> then\n            set [yv v] to [15]\n        end\n    end\n    change y by (-1)\nend\n\nwhen flag clicked\nforever\n    if <touching (end v)?> then\n        switch backdrop to (next backdrop v)\n        go to x: (-185) y: (7)\n    end\n    if <touching color (#ff0000)?> then\n        broadcast (back to start v)\n    end\n    if <touching color (#808080)?> then\n        broadcast (back to start v)\n    end\n    if <touching color (#ffff00)?> then\n        set [yv v] to [29]\n    end\n    if <touching color (#00ffff)?> then\n        set [xv v] to [10]\n    end\n    if <touching color (#ff9400)?> then\n        switch backdrop to (backdrop20 v)\n    end\nend\n\nwhen I receive [back to start v]\ngo to x: (-185) y: (7)\n\nwhen backdrop switches to [backdrop20 v]\nhide\nstop [other scripts in sprite v]\nstop [this script v]\n\n@end\n\nwhen flag clicked\nforever\n    go to x: (230) y: (0)\n    set [ghost v] effect to (100)\n    go [backward v] (99) layers\nend\n\n@youwon\n\nwhen flag clicked\nhide\n\nwhen backdrop switches to [backdrop20 v]\nshow\ngo [backward v] (1) layers\ngo to x: (-13) y: (73)\nforever\n    repeat (20)\n        change size by (-5)\n        change [ghost v] effect by (5)\n    end\n    repeat (20)\n        change size by (5)\n        change [ghost v] effect by (-5)\n    end\nend\n\n@Sprite5\n\nwhen flag clicked\nforever\n    show\n    go to [front v] layer\n    set [ghost v] effect to (100)\n    go to x: (0) y: (0)\nend\n\n@Sprite6\n\nwhen flag clicked\nhide\ngo to x: (-126) y: (-146)\nset size to (50) %\ngo to [front v] layer\n\nwhen backdrop switches to [backdrop20 v]\nshow\ngo [backward v] (1) layers\nforever\n    repeat (20)\n        change size by (-2.5)\n        change [ghost v] effect by (5)\n    end\n    repeat (20)\n        change size by (2.5)\n        change [ghost v] effect by (-5)\n    end\nend\n\n