Draw (platformer)
@Stage\n\nwhen flag clicked\nforever\n    reset timer\nend\n\nwhen [timer v] > (0.5)\nbroadcast (message1 v)\nerase all\n\n@player\n\ndefine quick up\nchange y by (1)\nif <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                end\n            end\n        end\n    end\nend\nchange y by (-1)\n\ndefine check tilt\nchange y by (-1)\nswitch costume to (check tilt l v)\nif <<touching color (#000000)?> or <touching color (#003fff)?>> then\n    switch costume to (check tilt r v)\n    if <not <<touching color (#000000)?> or <touching color (#003fff)?>>> then\n        set [costume v] to [19]\n    else\n        set [costume v] to [2]\n    end\nelse\n    switch costume to (check tilt r v)\n    if <<touching color (#000000)?> or <touching color (#003fff)?>> then\n        set [costume v] to [20]\n    else\n        set [costume v] to [2]\n    end\nend\nchange y by (1)\n\ndefine costumes\nif <not <(player xVel) = [0]>> then\n    if <(player xVel) > [0]> then\n        point in direction (90)\n    else\n        point in direction (-90)\n    end\nend\nif <(player mode) = [running]> then\n    if <([abs v] of (player xVel) ) < [2]> then\n        set [costume v] to ((round ([abs v] of (player xVel) )) + (2))\n    else\n        change [costume timer v] by (1)\n        if <(costume timer) > [1]> then\n            set [costume timer v] to [0]\n            change [costume v] by (1)\n            if <(costume) > [8]> then\n                set [costume v] to [5]\n            end\n        end\n    end\nelse\n    if <(player mode) = [sliding to stop]> then\n        if <([abs v] of (player xVel) ) > [3.5]> then\n            set [costume v] to [10]\n        else\n            if <([abs v] of (player xVel) ) < [0.1]> then\n                set [costume v] to [12]\n            else\n                set [costume v] to [11]\n            end\n        end\n    else\n        if <(player mode) = [sliding to turn]> then\n            if <([abs v] of (player xVel) ) > [3]> then\n                set [costume v] to [10]\n            else\n                if <([abs v] of (player xVel) ) < [0.15]> then\n                    set [costume v] to [12]\n                else\n                    set [costume v] to [13]\n                end\n            end\n        else\n            if <(player mode) = [jump far]> then\n                if <(costume timer) < [2]> then\n                    change [costume timer v] by (1)\n                    set [costume v] to [14]\n                else\n                    set [costume v] to [15]\n                end\n            else\n                if <<(player mode) = [falling]> or <(player mode) = [jump]>> then\n                    set [costume v] to [16]\n                end\n            end\n        end\n    end\nend\n\ndefine air left and right\nif <<key (d v) pressed?> or <key (right arrow v) pressed?>> then\n    if <(player xVel) > [3.5]> then\nelse\n    if <(player xVel) < [-3.5]> then\nend\n\ndefine ramp down\nif <([abs v] of (player xVel) ) > [2]> then\n    change y by (-1)\n    if <not <touching color (#000000)?>> then\n        change y by (-1)\n        if <not <touching color (#000000)?>> then\n            change y by (-1)\n            if <not <touching color (#000000)?>> then\n                change y by (-1)\n                if <not <touching color (#000000)?>> then\n                    change y by (3)\n                end\n            end\n        end\n    end\n    change y by (1)\nend\n\ndefine left and right\nif <<key (d v) pressed?> or <key (right arrow v) pressed?>> then\n    if <(player yVel) > [0]> then\n        if <([abs v] of (player xVel) ) > [2]> then\n            set [player mode v] to [jump far]\n        else\n            set [player mode v] to [jump]\n        end\n    else\n        if <(player xVel) < [0]> then\n            set [player mode v] to [sliding to turn]\n            set [player xvel v] to ((player xVel) * (0.7))\n            if <(player xVel) > [-0.1]> then\n                set [player xvel v] to [0]\n            end\n        else\n            change [player xvel v] by (((4) - (player xVel)) / (5))\n            set [player mode v] to [running]\n        end\n    end\nelse\n    if <<key (a v) pressed?> or <key (left arrow v) pressed?>> then\n        if <(player yVel) > [0]> then\n            if <([abs v] of (player xVel) ) > [2]> then\n                set [player mode v] to [jump far]\n            else\n                set [player mode v] to [jump]\n            end\n        else\n            if <(player xVel) > [0]> then\n                set [player mode v] to [sliding to turn]\n                set [player xvel v] to ((player xVel) * (0.7))\n                if <(player xVel) < [0.1]> then\n                    set [player xvel v] to [0]\n                end\n            else\n                change [player xvel v] by (((-4) - (player xVel)) / (5))\n                set [player mode v] to [running]\n            end\n        end\n    else\n        set [player xvel v] to ((player xVel) * (0.9))\n        if <([abs v] of (player xVel) ) < [0.75]> then\n            set [player xvel v] to ((player xVel) * (0.8))\n            if <([abs v] of (player xVel) ) < [0.05]> then\n                set [player xvel v] to [0]\n            end\n        end\n        if <([abs v] of (player xVel) ) > [3]> then\n            set [player mode v] to [sliding to stop]\n        else\n            if <([abs v] of (player xVel) ) < [3]> then\n                if <<([abs v] of (player xVel) ) < [0.05]> and <(player mode) = [sliding to stop]>> then\n                    set [player mode v] to [standing]\n                    set [player xvel v] to ((player xVel) * (0.9))\n                else\n                    if <not <(player mode) = [sliding to stop]>> then\n                        if <([abs v] of (player xVel) ) < [1.5]> then\n                            set [player mode v] to [standing]\n                        else\n                            set [player mode v] to [short slide]\n                            set [costume v] to [10]\n                        end\n                        set [player xvel v] to ((player xVel) * (0.9))\n                    end\n                end\n            end\n        end\n    end\nend\n\ndefine sense ledge <sense for wall jump>\nswitch costume to (sense ledge touch v)\nif <touching color (#000000)?> then\n    switch costume to (sense ledge no touch v)\n    if <not <touching color (#000000)?>> then\n        switch costume to (sense ledge touch v)\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 (-3)\n                        stop [this script v]\n                    end\n                end\n            end\n        end\n        change y by (-1)\n        set [player mode v] to [climbing ledge]\n        set [player yvel v] to [0]\n        set [costume v] to [23]\n    else\n        if <sense for wall jump> then\n            switch costume to (hitbox v)\n            change y by (-1)\n            if <not <touching color (#000000)?>> then\n                if <(direction) > [0]> then\n                    if <<key (d v) pressed?> or <key (right arrow v) pressed?>> then\n                        set [player mode v] to [wall hold]\n                        set [costume v] to [36]\n                        set [player xvel v] to [0]\n                        set [player yvel v] to [0]\n                        change y by (-0.5)\n                        if <<key (w v) pressed?> or <key (up arrow v) pressed?>> then\n                            set [player yvel v] to [3.5]\n                            set [player xvel v] to [-3]\n                            set [player mode v] to [jump far]\n                        end\n                    end\n                else\n                    if <<key (a v) pressed?> or <key (left arrow v) pressed?>> then\n                        set [player mode v] to [wall hold]\n                        set [costume v] to [36]\n                        set [player xvel v] to [0]\n                        set [player yvel v] to [0]\n                        change y by (-0.5)\n                        if <<key (w v) pressed?> or <key (up arrow v) pressed?>> then\n                            set [player yvel v] to [3.5]\n                            set [player xvel v] to [3]\n                            set [player mode v] to [jump far]\n                        end\n                    end\n                end\n            end\n            change y by (1)\n        end\n    end\nend\nswitch costume to (hitbox v)\n\nwhen flag clicked\ngo to x: (-215) y: (-100)\nshow\ngo to [front v] layer\nset [costume v] to [2]\nset [costume timer v] to [0]\nset [player mode v] to [standing]\nset [level v] to [1]\nforever\n    if <(player mode) = [climbing ledge]> then\n        if <(costume [number v]) = [23]> then\n            move (2) steps\n        end\n        next costume\n        if <(costume [number v]) = [34]> then\n            move (5) steps\n            change y by (15)\n            switch costume to (stand v)\n            set [player mode v] to [standing]\n        end\n    else\n        change y by (player yVel)\n        switch costume to (hitbox v)\n        if <<touching color (#000000)?> or <touching color (#003fff)?>> then\n            if <(player yVel) > [0]> then\n                change y by ((0) - (player yVel))\n                set [player yvel v] to [-0.5]\n            else\n                quick up\n            end\n        end\n        change y by (-1)\n        if <<touching color (#000000)?> or <touching color (#003fff)?>> then\n            set [player yvel v] to [0]\n            if <<(player mode) = [falling]> or <<(player mode) = [jump far]> or <(player mode) = [jump]>>> then\n                if <<<key (a v) pressed?> or <key (left arrow v) pressed?>> or <<key (d v) pressed?> or <key (right arrow v) pressed?>>> then\n                    set [player mode v] to [running]\n                else\n                    set [player mode v] to [standing]\n                end\n            end\n            if <<key (w v) pressed?> or <key (up arrow v) pressed?>> then\n                set [player yvel v] to (([abs v] of ((player xVel) / (3)) ) + (3))\n                set [costume timer v] to [0]\n                if <([abs v] of (player xVel) ) > [2]> then\n                    set [player mode v] to [jump far]\n                else\n                    set [player mode v] to [jump]\n                end\n            end\n        else\n            change [player yvel v] by (-0.25)\n            if <(player yVel) < [-0.5]> then\n                set [player mode v] to [falling]\n            end\n        end\n        change y by (1)\n        if <<<(player mode) = [falling]> or <(player mode) = [jump far]>> or <(player mode) = [jump]>> then\n            air left and right\n        else\n            left and right\n        end\n        change x by (player xVel)\n        if <not <(player xVel) = [0]>> then\n            if <<touching color (#000000)?> or <touching color (#003fff)?>> then\n                change y by (1)\n                if <<touching color (#000000)?> or <touching color (#003fff)?>> then\n                    change y by (1)\n                    if <<touching color (#000000)?> or <touching color (#003fff)?>> then\n                        change y by (1)\n                        if <<touching color (#000000)?> or <touching color (#003fff)?>> then\n                            change y by (-3)\n                            change x by ((0) - (player xVel))\n                            set [player xvel v] to ((player xVel) / (2))\n                            change x by (player xVel)\n                            if <<touching color (#000000)?> or <touching color (#003fff)?>> then\n                                change x by ((0) - (player xVel))\n                            end\n                            change x by ((player xVel) / (2))\n                            if <<touching color (#000000)?> or <touching color (#003fff)?>> then\n                                change x by ((0) - ((player xVel) / (2)))\n                            end\n                            set [player xvel v] to [0]\n                            sense ledge \n                        end\n                    end\n                end\n            else\n                ramp down\n            end\n            costumes\n        else\n            if <<(player mode) = [falling]> or <(player mode) = [jump]>> then\n                set [costume v] to [16]\n            else\n                if <(player mode) = [standing]> then\n                    check tilt\n                end\n            end\n        end\n        switch costume to (costume)\n    end\n    if <touching color (#ffff00)?> then\n        broadcast (2 v)\n        change [level v] by (1)\n    end\n    if <touching color (#003fff)?> then\n        set [player yvel v] to (([abs v] of ((player xVel) / (3)) ) + (9))\n        set [costume timer v] to [0]\n        set [player mode v] to [jump]\n    end\n    if <<key (r v) pressed?> or <touching color (#ff0000)?>> then\n        go to x: (-215) y: (-100)\n        show\n        go to [front v] layer\n        set [costume v] to [2]\n        set [costume timer v] to [0]\n        set [player mode v] to [standing]\n        set [player yvel v] to [0]\n        erase all\n    end\nend\n\nwhen [r v] key pressed\n\nset [level v] to [4]\n\nwhen I receive [message1 v]\nhide\n\nwhen I receive [2 v]\ngo to x: (-215) y: (-100)\nshow\ngo to [front v] layer\nset [costume v] to [2]\nset [costume timer v] to [0]\nset [player mode v] to [standing]\nerase all\n\nwhen flag clicked\nforever\n    set [player distance to mouse v] to (distance to [mouse-pointer v])\nend\n\nwhen flag clicked\nset drag mode [not draggable v]\n\nwhen flag clicked\nhide variable [costume v]\nhide variable [costume timer v]\nhide variable [level v]\nhide variable [player distance to mouse v]\nhide variable [player mode v]\nhide variable [player xvel v]\nhide variable [player yvel v]\n\n@terrain\n\nwhen flag clicked\ngo to x: (0) y: (0)\nshow\nforever\n    switch costume to (level)\nend\n\nwhen I receive [message1 v]\nhide\n\nwhen [e v] key pressed\nchange [level v] by (1)\nbroadcast (2 v)\n\nwhen [q v] key pressed\nchange [level v] by (-1)\nbroadcast (2 v)\n\nwhen flag clicked\nforever\n    if <[1] > (level)> then\n        set [level v] to [28]\n    end\n    if <(level) > [28]> then\n        set [level v] to [1]\n    end\nend\n\n@Sprite1\n\nwhen flag clicked\npen up\nerase all\nset pen color to (#000000)\nset pen size to (5)\nwait (2) seconds\nforever\n    if <mouse down?> then\n        go to (mouse-pointer v)\n        repeat until <not <mouse down?>>\n            player distance to mouse checker\n            go to (mouse-pointer v)\n        end\n    end\n    if <<[15] < (level)> and <(level) < [28]>> then\n        set pen color to (#013fff)\n    else\n        set pen color to (#000000)\n    end\n    repeat until <not <(level) = [28]>>\n        go to (mouse-pointer v)\n        if <mouse down?> then\n            pen down\n            change colour at end\n        else\n            pen up\n        end\n    end\n    pen up\nend\n\nwhen [space v] key pressed\nerase all\n\ndefine change colour at end\ngo to (mouse-pointer v)\nif <(x position) > [0]> then\n    set pen color to (#013fff)\nend\nif <(x position) < [0]> then\n    set pen color to (#000000)\nend\n\nif  then\nend\n\ndefine player distance to mouse checker\nif <[31] > (player distance to mouse)> then\n    go to (mouse-pointer v)\n    pen up\n    go to (mouse-pointer v)\nelse\n    go to (mouse-pointer v)\n    pen down\n    go to (mouse-pointer v)\nend\n\n@Sprite2\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\nset [ghost v] effect to (0)\n\n
Hi :D\n\nW,A,S,D to move.\nMouse to draw.\nSpace to clear.\nR to restart the level.\n'E' to skip a level 'Q' to go back\n\nBlue is bouncy.\nRed will make you restart the level.