Simple Platformer | Platformer | 

Instructions: Hi \nUse the arrow keys to move and reach the end to go to the next level\nyou can kill the enemies by jumping on them

@Stage\n\nwhen flag clicked\nforever\n    play sound [platformer v] until done\nend\n\n@LEVEL\n\nwhen flag clicked\nshow\ngo to x: (0) y: (0)\nforever\n    switch costume to (level_float)\nend\n\n@player\n\ndefine death animation\nrepeat (15)\n    change [ghost v] effect by (6.7)\nend\nwait (0.35) seconds\nset [ghost v] effect to (0)\n\nwhen flag clicked\nbroadcast (restart v)\nset [level_float v] to [1]\nforever\n    change [y vel. v] by (-1)\n    if <<<key (left arrow v) pressed?> or <mouse down?>> and <(mouse x) < (x position)>> then\n        change [x vel. v] by (-1)\n        switch costume to (2 v)\n    end\n    if <<<key (right arrow v) pressed?> or <mouse down?>> and <(mouse x) < (x position)>> then\n        change [x vel. v] by (1)\n        switch costume to (3 v)\n    end\n    set [x vel. v] to ((x vel.) * (0.85))\n    change x by (x vel.)\n    if <touching color (#cccccc)?> then\n        change y by (1)\n        if <touching color (#cccccc)?> then\n            change y by (1)\n            if <touching color (#cccccc)?> then\n                change y by (1)\n                if <touching color (#cccccc)?> then\n                    change y by (1)\n                    if <touching color (#cccccc)?> then\n                        change y by (1)\n                        if <touching color (#cccccc)?> then\n                            change y by (1)\n                            if <touching color (#cccccc)?> then\n                                change y by (-6)\n                                change x by ((x vel.) * (-1))\n                                set [x vel. v] to [0]\n                                if <key (up arrow v) pressed?> then\n                                    if <(x vel.) = [0]> then\n                                        change [x vel. v] by (-10)\n                                    else\n                                        change [x vel. v] by (10)\n                                    end\n                                    set [y vel. v] to [13]\n                                else\n                                    set [x vel. v] to [0]\n                                end\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\n    change y by (y vel.)\n    if <touching color (#cccccc)?> then\n        change y by ((y vel.) * (-1))\n        set [y vel. v] to [0]\n    end\n    change y by (-1)\n    if <<<touching color (#cccccc)?> and <<key (up arrow v) pressed?> or <mouse down?>>> and <(mouse y) > (y position)>> then\n        set [y vel. v] to [13]\n    end\n    if <<touching color (#ff6666)?> or <(y position) < [-175]>> then\n        death animation\n        broadcast (restart v)\n    end\n    if <touching color (#fff694)?> then\n        change [y vel. v] by (33)\n    end\n    if <(x position) > [240]> then\n        broadcast (level setup v)\n        broadcast (next level v)\n    end\n    if <touching color (#cccccc)?> then\n        set [y vel. v] to ((y vel.) / (2))\n        if <key (up arrow v) pressed?> then\n            change [y vel. v] by (5)\n        end\n    end\n    if <touching (enemies v)?> then\n        set [y vel. v] to [13]\n    end\n    if <touching color (#b2dcff)?> then\n        set [y vel. v] to ((y vel.) / (2))\n        if <key (up arrow v) pressed?> then\n            change [y vel. v] by (5)\n        end\n    end\n    change y by (1)\nend\n\nwhen I receive [level setup v]\nset [x vel. v] to [0]\nset [y vel. v] to [0]\ngo to x: (-187) y: (-121)\n\nwhen I receive [next level v]\nchange [level_float v] by (1)\nbroadcast (setup enemies v)\n\nwhen I receive [restart v]\ngo to [front v] layer\ngo to x: (-187) y: (-121)\nset [y vel. v] to [0]\nset [x vel. v] to [0]\nbroadcast (setup enemies v)\n\n@enemies\n\nwhen I start as a clone\nshow\nforever\n    change [y vel. v] by (-1)\n    if <([x position v] of [player v]) < (x position)> then\n        change [x vel. v] by (-1)\n        switch costume to (2 v)\n    end\n    if <(x position) < ([x position v] of [player v])> then\n        change [x vel. v] by (1)\n        switch costume to (3 v)\n    end\n    set [x vel. v] to ((x vel.) * (0.75))\n    change x by (x vel.)\n    if <touching color (#cccccc)?> then\n        change y by (1)\n        if <touching color (#cccccc)?> then\n            change y by (1)\n            if <touching color (#cccccc)?> then\n                change y by (1)\n                if <touching color (#cccccc)?> then\n                    change y by (1)\n                    if <touching color (#cccccc)?> then\n                        change y by (1)\n                        if <touching color (#cccccc)?> then\n                            change y by (1)\n                            if <touching color (#cccccc)?> then\n                                change y by (-6)\n                                change x by ((x vel.) * (-1))\n                                set [x vel. v] to [0]\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\n    change y by (y vel.)\n    if <touching color (#cccccc)?> then\n        change y by ((y vel.) * (-1))\n        set [y vel. v] to [0]\n    end\n    change y by (-1)\n    if <(([y position v] of [player v]) - (50)) > (y position)> then\n        set [y vel. v] to [4]\n    end\n    if <touching color (#fff694)?> then\n        change [y vel. v] by (33)\n    end\n    if <touching color (#cccccc)?> then\n        set [y vel. v] to ((y vel.) / (2))\n        if <(([y position v] of [player v]) - (50)) > (y position)> then\n            change [y vel. v] by (5)\n        end\n    end\n    if <touching (swing v)?> then\n        delete this clone\n    end\n    if <touching (player v)?> then\n        if <(y position) < ([y position v] of [player v])> then\n            delete this clone\n        else\n            broadcast (restart v)\n        end\n    end\nend\n\ndefine clone at (x) (y)\ngo to x: (x) y: (y)\ncreate clone of (_myself_ v)\n\nwhen I receive [setup enemies v]\nif  then\n    delete this clone\nend\nif <(level_float) = [1]> then\n    clone at [76] [-113]\nend\nif <(level_float) = [2]> then\n    clone at [-102] [-104]\nend\nif <(level_float) = [4]> then\n    clone at [-74] [-120]\nend\nif <(level_float) = [5]> then\n    clone at [50] [-40]\nend\nif <(level_float) = [6]> then\n    clone at [33] [-108]\nend\nif <(level_float) = [7]> then\n    clone at [-10] [-55]\nend\nif <(level_float) = [8]> then\n    clone at [-24] [15]\nend\n\nwhen flag clicked\nhide\n\n@Sprite1\n\nwhen I start as a clone\nshow\nswitch costume to (cloud hitbox v)\ngo to x: (240) y: (pick random (10) to (150))\nset [my costume v] to (pick random (1) to (2))\nswitch costume to (My costume)\nset [ghost v] effect to (pick random (50) to (70))\nrepeat (96)\n    switch costume to (cloud hitbox v)\n    change x by (-5)\n    switch costume to (My costume)\nend\ndelete this clone\n\nwhen flag clicked\nhide\nforever\n    create clone of (_myself_ v)\n    wait (pick random (2) to (4)) seconds\nend\n\n