Lost woods | A Platformer
@Stage\n\nwhen I receive [start v]\nswitch backdrop to (backdrop1 v)\nset volume to (100) %\nforever\n    play sound [fairy haloes v] until done\nend\n\n@Sprite1\n\ndefine ground\nrepeat until <touching (sprite3 v)?>\n    change y by (-1)\nend\nchange y by (1)\n\nwhen flag clicked\nbroadcast (start v)\nforever\n    if <(walljump?) < [0.1]> then\n        if <(round ((Yv) / (2))) = [0]> then\n            if <[0] < (round (Xv))> then\n                switch costume to (costume2 v)\n            else\n                if <(round (Xv)) < [0]> then\n                    switch costume to (costume6 v)\n                else\n                    switch costume to (costume1 v)\n                end\n            end\n        else\n            if <(Yv) < [0]> then\n                if <[0] < (round (Xv))> then\n                    switch costume to (costume9 v)\n                else\n                    if <(round (Xv)) < [0]> then\n                        switch costume to (costume7 v)\n                    else\n                        switch costume to (costume8 v)\n                    end\n                end\n            else\n                if <[0] < (round (Xv))> then\n                    switch costume to (costume3 v)\n                else\n                    if <(round (Xv)) < [0]> then\n                        switch costume to (costume5 v)\n                    else\n                        switch costume to (costume4 v)\n                    end\n                end\n            end\n        end\n    else\n        if <<key (right arrow v) pressed?> and <not <key (left arrow v) pressed?>>> then\n            switch costume to (costume3 v)\n        else\n            if <<key (left arrow v) pressed?> and <not <key (right arrow v) pressed?>>> then\n                switch costume to (costume5 v)\n            else\n                switch costume to (costume4 v)\n            end\n        end\n    end\nend\n\nswitch costume to (costume1 v)\n\nwhen flag clicked\nwait (1) seconds\nforever\n    wait until <(walljump?) = [2]>\n    set [walljump? v] to [1]\n    repeat until <<(walljump?) < [0.1]> or <[1] < (walljump?)>>\n        change [walljump? v] by (-0.1)\n    end\nend\n\nwhen I receive [start v]\nshow\ngo to x: (-200) y: (-100)\nset [xv v] to [0]\nset [yv v] to [0]\nset [frame v] to [0]\nforever\n    if <key (right arrow v) pressed?> then\n        change [xv v] by (0.9)\n    end\n    if <key (left arrow v) pressed?> then\n        change [xv v] by (-0.9)\n    end\n    set [xv v] to ((Xv) * (0.9))\n    change x by (Xv)\n    if <touching (sprite3 v)?> then\n        change y by (1)\n        if <touching (sprite3 v)?> then\n            change y by (1)\n            if <touching (sprite3 v)?> then\n                change y by (1)\n                if <touching (sprite3 v)?> then\n                    change y by (1)\n                    if <touching (sprite3 v)?> then\n                        change y by (1)\n                        if <touching (sprite3 v)?> then\n                            change x by ((Xv) * (-1))\n                            change y by (-5)\n                            if <key (up arrow v) pressed?> then\n                                set [walljump? v] to [2]\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    if <(Yv) < [-15]> then\n        set [yv v] to ((Yv) * (0.95))\n    end\n    if <<(walljump?) > [0.1]> and <((frame) mod (2)) = [1]>> then\n        create clone of (_myself_ v)\n    end\n    change y by (Yv)\n    if <touching (sprite3 v)?> then\n        change y by ((Yv) * (-1))\n        if <(Yv) < [-1]> then\n            ground\n        end\n        set [yv v] to [0]\n    end\n    change y by (-1)\n    if <touching (sprite3 v)?> then\n        if <key (up arrow v) pressed?> then\n            set [yv v] to [13]\n        end\n    end\n    change y by (1)\n    if <[250] < (x position)> then\n        if <(level) < [16]> then\n            change [level v] by (1)\n            broadcast (new level v)\n            if <(level) = [12]> then\n                go to x: (-200) y: (90)\n            else\n                go to x: (-200) y: (-100)\n            end\n        else\n            set x to (250)\n        end\n    end\n    if <<(y position) < [-200]> or <touching (sprite2 v)?>> then\n        broadcast (die v)\n        if <(level) = [12]> then\n            go to x: (-200) y: (90)\n        else\n            go to x: (-200) y: (-100)\n        end\n    end\n    if <(x position) < [-240]> then\n        set x to (-240)\n    end\n    change [frame v] by (1)\nend\n\nwhen I start as a clone\nset [brightness v] effect to (100)\nrepeat (10)\n    change [ghost v] effect by (10)\nend\ndelete this clone\n\nchange [level v] by (1)\nbroadcast (new level v)\n\nchange [level v] by (-1)\nbroadcast (new level v)\n\n@Sprite2\n\nwhen flag clicked\nset [level v] to [1]\nset [scrollx v] to [0]\nswitch costume to (level)\ngo to x: (0) y: (0)\n\nwhen I receive [new level v]\nswitch costume to (level)\nshow\n\n@Sprite3\n\nwhen flag clicked\nset [level v] to [1]\nhide\n\nwhen I receive [start v]\nswitch costume to (level)\nshow\n\nchange [level v] by (-1)\n\nwhen I receive [new level v]\nswitch costume to (level)\n\n@text\n\nwhen flag clicked\nhide\n\nwhen I receive [start v]\nset [brightness v] effect to (10)\nswitch costume to (level)\nshow\n\nwhen I receive [new level v]\nswitch costume to (level)\n\n@Sprite6\n\nwhen flag clicked\nforever\n    set [ghost v] effect to (100)\n    go to [front v] layer\nend\n\n