platformis (platformer)
@Stage\n\nwhen flag clicked\nforever\n    if <(level#) > [29]> then\n        switch backdrop to (bg4 v)\n    else\n        if <(level#) > [19]> then\n            switch backdrop to (bg3 v)\n        else\n            if <(level#) > [12]> then\n                switch backdrop to (bg2 v)\n            else\n                switch backdrop to (bg1 v)\n            end\n        end\n    end\nend\n\nwhen flag clicked\nrepeat (2)\n    set volume to (80) %\nend\nforever\n    play sound [Souleye - Pushing onwards \(radio v] until done\nend\n\n@player\n\nwhen flag clicked\nrepeat (2)\n    set [jump animation v] to [0]\n    set [walk animation v] to [0]\n    set [resistance v] to [0.8]\n    set [acceleration v] to [2]\n    set [gravity v] to [2]\n    set [jump force v] to [16]\n    set [gravity v] to [1]\nend\nswitch costume to (cube v)\nReset and Begin\n\ndefine move on steps (steps)\nchange [falling v] by (1)\nrepeat (steps)\n    set [last value v] to (x position)\n    change x by ((speed x) / (steps))\n    check touching solid\n    if <(touching) > [0]> then\n        set x to (last Value)\n        set [speed x v] to [0]\n    end\n    set [last value v] to (y position)\n    change y by ((speed y) / (steps))\n    check touching solid\n    if <(touching) > [0]> then\n        set y to (last Value)\n        if <(speed y) < [0]> then\n            set [falling v] to [0]\n        end\n        set [speed y v] to [0]\n    end\nend\n\nwhen I receive [tick-player v]\nControls Up and Down\nControls Left and Right\nmove on steps (([abs v] of (speed y) ) + ([abs v] of (speed x) ))\n\ndefine Controls Up and Down\nif <<key (up arrow v) pressed?> or <key (space v) pressed?>> then\n    set [jump animation v] to [1]\n    broadcast (animation up-down v)\n    if <(falling) < [3]> then\n        set [speed y v] to (jump force)\n    end\nend\nchange [speed y v] by ((0) - (Gravity))\n\ndefine Controls Left and Right\nset [left right keybind v] to (<key (right arrow v) pressed?> - <key (left arrow v) pressed?>)\nchange [speed x v] by ((left right keybind) * (acceleration))\nset [speed x v] to ((speed x) * (resistance))\nif <key (left arrow v) pressed?> then\n    broadcast (animation left v)\n    set [walk animation v] to [1]\nelse\n    if <key (right arrow v) pressed?> then\n        broadcast (animation right v)\n        set [walk animation v] to [1]\n    else\n        set [walk animation v] to [0]\n    end\nend\n\ndefine Reset and Begin\nrepeat (2)\n    set [level# v] to [1]\n    set [speed y v] to [0]\n    set [speed x v] to [0]\n    set [falling v] to [99]\n    go to x: (-150) y: (55)\nend\nbroadcast (Game Loop v)\nbroadcast (Change Level v)\n\nwhen I receive [game loop v]\nforever\n    broadcast (Tick-Last v)\n    broadcast (Tick-Player v)\n    if <(level#) > [29]> then\n        set size to (100) %\n        set [resistance v] to [0.8]\n        set [acceleration v] to [2]\n        set [gravity v] to [0.1]\n        set [jump force v] to [5.5]\n        set [gravity v] to [0.1]\n    else\n        if <<(level#) = [12]> or <<(level#) = [21]> or <(level#) = [19]>>> then\n            set [acceleration v] to [1]\n            set [jump force v] to [12]\n            set size to (50) %\n        else\n            if <(level#) = [5]> then\n                set size to (75) %\n            else\n                set size to (100) %\n                set [resistance v] to [0.8]\n                set [acceleration v] to [2]\n                set [gravity v] to [2]\n                set [jump force v] to [16]\n                set [gravity v] to [1]\n            end\n        end\n    end\nend\n\nwhen I receive [tick-last v]\nif <<(x position) < [-235]> and <<(level#) = [15]> or <(level#) = [14]>>> then\n    change [level# v] by (-1)\n    broadcast (Change Level v)\n    set x to (200)\n    set y to (-90)\nelse\n    if <(x position) > [235]> then\n        change y by (200)\n        set x to (-220)\n        change [level# v] by (1)\n        broadcast (Change Level v)\n    end\n    if <(x position) < [-235]> then\n        change y by (240)\n        set x to (235)\n        change [level# v] by (-1)\n        broadcast (Change Level v)\n    end\n    if <(y position) < [-176]> then\n        set y to (240)\n        set x to (171)\n        change [level# v] by (1)\n        broadcast (Change Level v)\n    end\nend\n\ndefine Damage check\nforever\n    if <touching (wheel v)?> then\n        broadcast (Damaged v)\n    end\nend\n\nwhen I receive [damaged 2 v]\ngo to x: (170) y: (90)\n\nwhen I receive [animation left v]\nif <<(jump animation) = [0]> and <(walk animation) = [1]>> then\n    if <key (left arrow v) pressed?> then\n        switch costume to (cube left 1 v)\n        wait (0.07) seconds\n        switch costume to (cube left 2 v)\n        wait (0.07) seconds\n        switch costume to (cube left 3 v)\n        wait (0.07) seconds\n    else\n        switch costume to (cube left 3 v)\n        wait (0.07) seconds\n        switch costume to (cube left 2 v)\n        wait (0.07) seconds\n        switch costume to (cube left 1 v)\n        wait (0.07) seconds\n        switch costume to (cube v)\n    end\nelse\n    set [walk animation v] to [0]\nend\n\nwhen I receive [animation right v]\nif <<(jump animation) = [0]> and <(walk animation) = [1]>> then\n    if <key (right arrow v) pressed?> then\n        switch costume to (cube right 1 v)\n        wait (0.07) seconds\n        switch costume to (cube right 2 v)\n        wait (0.07) seconds\n        switch costume to (cube right 3 v)\n        wait (0.07) seconds\n    else\n        switch costume to (cube right 3 v)\n        wait (0.07) seconds\n        switch costume to (cube right 2 v)\n        wait (0.07) seconds\n        switch costume to (cube right 1 v)\n        wait (0.07) seconds\n        switch costume to (cube v)\n    end\nelse\n    set [walk animation v] to [0]\nend\n\ndefine Jump check\nforever\n    if <touching (jump paddle v)?> then\n        broadcast (Jumped v)\n    end\nend\n\nwhen I receive [jumped v]\nif <not <(level#) = [19]>> then\n    set [speed y v] to ((jump force) + (6))\nelse\n    set [speed y v] to ((jump force) + (12))\nend\n\nwhen flag clicked\nJump check\n\nwhen flag clicked\nDamage check\n\ndefine check touching solid\nif <<touching (level v)?> or <touching (moving platform v)?>> then\n    broadcast (touch v)\n    set [touching v] to [1]\nelse\n    set [touching v] to [0]\nend\n\nwhen I receive [animation up-down v]\nif <<(jump animation) = [1]> and <(walk animation) = [0]>> then\n    switch costume to (cubeup1 v)\n    wait (0.05) seconds\n    switch costume to (cubeup2 v)\n    wait (0.05) seconds\n    switch costume to (cubeup3 v)\n    wait (0.05) seconds\n    switch costume to (cubeup4 v)\n    wait (0.05) seconds\n    switch costume to (cubeup5 v)\n    wait (0.05) seconds\n    switch costume to (cubeup6 v)\n    wait (0.05) seconds\n    switch costume to (cubeup7 v)\n    wait (0.08) seconds\n    switch costume to (cubedown1 v)\n    wait (0.05) seconds\n    switch costume to (cubedown2 v)\n    wait (0.05) seconds\n    switch costume to (cubedown3 v)\n    wait (0.05) seconds\n    switch costume to (cubedown4 v)\n    wait (0.05) seconds\n    switch costume to (cubedown5 v)\n    wait until <(touching) = [1]>\n    wait (0.01) seconds\n    switch costume to (cube v)\n    repeat until <not <touching (level v)?>>\n        change y by (1)\n    end\n    set [jump animation v] to [0]\nelse\n    set [jump animation v] to [0]\nend\n\nwhen flag clicked\nforever\n    if <<touching (level v)?> or <touching (moving platform v)?>> then\n        repeat until <not <touching (moving platform v)?>>\n            change y by (5)\n        end\n        repeat until <not <touching (level v)?>>\n            change y by (1)\n        end\n    end\nend\n\nwhen I receive [damaged v]\ngo to x: (-235) y: (90)\n\nwhen I receive [damaged 3 v]\ngo to x: (-65) y: (90)\n\nchange [level# v] by (1)\n\n@wheel\n\nwhen flag clicked\nrepeat (2)\n    set size to (50) %\n    hide\nend\nforever\n    if <(level#) = [5]> then\n        switch costume to (costume1 v)\n        turn right (5) degrees\n        show\n        set size to (50) %\n        go to x: (-143) y: (0)\n    else\n        if <(level#) = [6]> then\n            switch costume to (costume1 v)\n            show\n            set size to (300) %\n            go to x: (13) y: (163)\n            turn right (-5) degrees\n        else\n            if <(level#) = [25]> then\n                switch costume to (costume2 v)\n                show\n                set size to (145) %\n                go to x: (-30) y: (0)\n                turn right (-4) degrees\n            else\n                hide\n            end\n        end\n    end\nend\n\nset [level# v] to [39]\nbroadcast (Change Level v)\n\nshow\n\nset size to (100) %\n\nswitch costume to (costume2 v)\n\n@moving platform\n\nwhen flag clicked\nrepeat (2)\n    set size to (100) %\n    hide\nend\nforever\n    if <(level#) = [7]> then\n        go to [front v] layer\n        switch costume to (costume1 v)\n        show\n        go to x: (-19) y: (-100)\n        repeat until <not <(level#) = [7]>>\n            glide (3) secs to x: (-88) y: (-100)\n            wait (1) seconds\n            glide (3) secs to x: (52) y: (-100)\n            wait (1) seconds\n        end\n    else\n        if <(level#) = [8]> then\n            go to [front v] layer\n            switch costume to (costume1 v)\n            show\n            go to x: (-19) y: (-100)\n            repeat until <not <(level#) = [8]>>\n                glide (3) secs to x: (-88) y: (-100)\n                wait (1) seconds\n                glide (3) secs to x: (52) y: (-100)\n                wait (1) seconds\n            end\n        else\n            if <(level#) = [9]> then\n                go to [front v] layer\n                switch costume to (costume1 v)\n                show\n                go to x: (-19) y: (-100)\n                repeat until <not <(level#) = [9]>>\n                    glide (3) secs to x: (-88) y: (-100)\n                    wait (1) seconds\n                    glide (3) secs to x: (52) y: (-100)\n                    wait (1) seconds\n                end\n            else\n                if <<(level#) = [22]> or <<(level#) = [23]> or <(level#) = [24]>>> then\n                    go to [back v] layer\n                    switch costume to (costume2 v)\n                    show\n                    go to x: (-19) y: (-100)\n                    repeat until <<not <(level#) = [22]>> and <<not <(level#) = [23]>> and <not <(level#) = [24]>>>>\n                        glide (2.3) secs to x: (-88) y: (-170)\n                        wait (1) seconds\n                        glide (2.3) secs to x: (86) y: (31)\n                        wait (1) seconds\n                    end\n                else\n                    hide\n                end\n            end\n        end\n    end\nend\n\nhide\n\n@jump paddle\n\nwhen flag clicked\nrepeat (3)\n    hide\nend\nforever\n    if <(level#) = [10]> then\n        set size to (150) %\n        go to x: (62) y: (-132)\n        show\n    else\n        if <(level#) = [11]> then\n            set size to (150) %\n            go to x: (-79) y: (-132)\n            show\n        else\n            if <(level#) = [19]> then\n                set size to (100) %\n                go to x: (-25) y: (-145)\n                show\n            else\n                hide\n            end\n        end\n    end\nend\n\nset size to (50) %\n\nturn right (5) degrees\n\nshow\nset size to (300) %\ngo to x: (13) y: (163)\nturn right (-5) degrees\n\nif <(level#) = [6]> then\n\n@level\n\nwhen flag clicked\ngo to x: (0) y: (0)\ngo to [back v] layer\n\nwhen I receive [change level v]\nswitch costume to (join [level] (level#))\n\n@spikes\n\nwhen I receive [change level v]\nrepeat (2)\n    switch costume to (join [spike] (level#))\nend\n\nwhen flag clicked\nrepeat (2)\n    switch costume to (spike1 v)\n    go to x: (0) y: (0)\n    go to [back v] layer\nend\nDamage check\n\ndefine Damage check\nforever\n    if <<touching (player v)?> and <not <<(costume [number v]) = [20]> or <(costume [number v]) = [14]>>>> then\n        broadcast (Damaged v)\n    else\n        if <<touching (player v)?> and <(costume [number v]) = [14]>> then\n            broadcast (Damaged 2 v)\n        else\n            if <<touching (player v)?> and <(costume [number v]) = [20]>> then\n                broadcast (Damaged 3 v)\n            end\n        end\n    end\nend\n\nswitch costume to (spike3 v)\n\nshow\n\ngo to [front v] layer\n\n@heart\n\nwhen flag clicked\nrepeat (2)\n    go to x: (36) y: (28)\n    hide\nend\nforever\n    if <touching (player v)?> then\n        broadcast (Change Level v)\n        change [level# v] by (1)\n    end\n    if <(level#) = [38]> then\n        show\n    else\n        hide\n    end\nend\n\n@text\n\nwhen flag clicked\nrepeat (2)\n    go to x: (0) y: (0)\n    hide\nend\nforever\n    if <(level#) = [39]> then\n        show\n    else\n        hide\n    end\nend\n\nif <touching (player v)?> then\n    broadcast (Change Level v)\n    change [level# v] by (1)\nend\n\n@thumbnail\n\nwhen flag clicked\nrepeat (2)\n    hide\nend\n\nshow\n\n@mobile button\n\nwhen flag clicked\nswitch costume to (off v)\nforever\n    if <(level#) = [1]> then\n        show\n    else\n        hide\n    end\n    if <(costume [number v]) = [1]> then\n        broadcast (mobile off v)\n        set [mobile v] to [0]\n    else\n        broadcast (mobile on v)\n        set [mobile v] to [1]\n    end\nend\n\nwhen this sprite clicked\nnext costume\n\nhide\n\n@left button\n\nwhen flag clicked\nrepeat (2)\n    go to x: (-180) y: (-130)\n    hide\nend\nControls\n\nwhen I receive [mobile on v]\ngo to [front v] layer\nshow\n\nwhen I receive [mobile off v]\nhide\n\nwhen this sprite clicked\nrepeat until <(mobile touch) = [0]>\n    set [left right keybind v] to [-1]\n    change [speed x v] by (((left right keybind) * (acceleration)) * (1.2))\n    set [speed x v] to (((speed x) * (resistance)) * (1.2))\n    broadcast (animation left v)\n    set [walk animation v] to [1]\nend\nset [walk animation v] to [0]\n\ndefine Controls\nforever\n    if <mouse down?> then\n        set [mobile touch v] to [1]\n    else\n        set [mobile touch v] to [0]\n    end\nend\n\n@Right button\n\nwhen flag clicked\nrepeat (2)\n    go to x: (-80) y: (-130)\n    hide\nend\nControls\n\nwhen I receive [mobile on v]\ngo to [front v] layer\nshow\n\nwhen I receive [mobile off v]\nhide\n\nwhen this sprite clicked\nrepeat until <(mobile touch) = [0]>\n    set [left right keybind v] to [1]\n    change [speed x v] by (((left right keybind) * (acceleration)) * (1.2))\n    set [speed x v] to (((speed x) * (resistance)) * (1.2))\n    broadcast (animation right v)\n    set [walk animation v] to [1]\nend\nset [walk animation v] to [0]\n\ndefine Controls\nforever\n    if <mouse down?> then\n        set [mobile touch v] to [1]\n    else\n        set [mobile touch v] to [0]\n    end\nend\n\n@Up button\n\nwhen flag clicked\nrepeat (2)\n    go to x: (170) y: (-130)\n    hide\nend\nControls\n\nwhen I receive [mobile on v]\ngo to [front v] layer\nshow\n\nwhen I receive [mobile off v]\nhide\n\nwhen this sprite clicked\nrepeat until <(mobile touch) = [0]>\n    if <mouse down?> then\n        set [jump animation v] to [1]\n        broadcast (animation up-down v)\n        if <(falling) < [3]> then\n            set [speed y v] to (jump force)\n        end\n    end\n    change [speed y v] by ((0) - (Gravity))\nend\n\ndefine Controls\nforever\n    if <mouse down?> then\n        set [mobile touch v] to [1]\n    else\n        set [mobile touch v] to [0]\n    end\nend\n\nwhen flag clicked\nforever\n    change [falling v] by (1)\n    wait (0.07) seconds\nend\n\nwhen I receive [touch v]\nset [falling v] to [0]\n\n
AD- walk\nSpace Uparrow- jump