Scrolling Platformer Engine!


@Stage\n\nwhen flag clicked\nswitch backdrop to (backdrop3 v)\n\nwhen I receive [ nest v]\nnext backdrop\n\nwhen I receive [3 2 1 start v]\nswitch backdrop to (backdrop1 v)\n\n@extra assets\n\nwhen flag clicked\nhide\n\n@sprite 1\n\nwhen flag clicked\nhide\n\nwhen I receive [intro end v]\nshow\ngo to [front v] layer\nswitch costume to (costume1 v)\nsay [i got kicked out of the game]\nwait (3) seconds\nsay [help me back in]\nwait (3) seconds\nsay [wait there is no hope]\nwait (1) seconds\nswitch costume to (costume52 v)\nsay [but you ]\nwait (3) seconds\nswitch costume to (costume1 v)\nwait (3) seconds\nsay [you  can get me out] for (2) seconds\nswitch costume to (costume53 v)\nbroadcast ( nest v)\nbroadcast (12121 v)\nbroadcast (121212 v)\n\n@extra assets3\n\nwhen flag clicked\nhide\n\n@extra assets4\n\nwhen flag clicked\nhide\n\n@extra assets5\n\nwhen flag clicked\nhide\n\n@Sprite1\n\nwhen flag clicked\nhide\n\nwhen I receive [intro end v]\nwait (20) seconds\nhide\nswitch costume to (costume3 v)\n\n@post2\n\nrepeat (10)\n\nwhen flag clicked\nforever\n    set [cancel v] to <touching (mouse-pointer v)?>\nend\n\n@cv\n\nrepeat (10)\n\nwhen flag clicked\nforever\n    set [cv v] to <touching (mouse-pointer v)?>\nend\n\n@post\n\nrepeat (10)\n\nwhen flag clicked\nforever\n    set [post v] to <touching (mouse-pointer v)?>\nend\n\n@report3\n\nrepeat (10)\n\nwhen flag clicked\nforever\n    set [copy v] to <touching (mouse-pointer v)?>\nend\n\n@report2\n\nrepeat (10)\n\nwhen flag clicked\nforever\n    set [add v] to <touching (mouse-pointer v)?>\nend\n\n@sb\n\nrepeat (10)\n\nwhen flag clicked\nforever\n    set [sb v] to <touching (mouse-pointer v)?>\nend\n\n@gf\n\nrepeat (10)\n\nwhen flag clicked\nforever\n    set [gf v] to <touching (mouse-pointer v)?>\nend\n\n@love\n\nwhen flag clicked\nforever\n    set [love? v] to <touching (mouse-pointer v)?>\nend\n\n@fave\n\nrepeat (10)\n\nwhen flag clicked\nforever\n    set [fav v] to <touching (mouse-pointer v)?>\nend\n\n@see inside\n\nrepeat (10)\n\nwhen flag clicked\nforever\n    set [see inside v] to <touching (mouse-pointer v)?>\nend\n\n@remix\n\nrepeat (10)\n\nwhen flag clicked\nforever\n    set [remix v] to <touching (mouse-pointer v)?>\nend\n\n@fulls\n\nrepeat (10)\n\nwhen flag clicked\nforever\n    set [fulls v] to <touching (mouse-pointer v)?>\nend\n\n@report\n\nrepeat (10)\n\nwhen flag clicked\nforever\n    set [report v] to <touching (mouse-pointer v)?>\nend\n\n@Figur2\n\nwhen flag clicked\nshow\nswitch costume to (not v)\nforever\n    if <(love?) = [true]> then\n        set [mode v] to [1]\n        set [color v] to [0]\n        costume [love]\n    else\n        if <(fav) = [true]> then\n            set [mode v] to [1]\n            set [color v] to [15]\n            costume [fave]\n        else\n            if <(see inside) = [true]> then\n                set [mode v] to [1]\n                set [color v] to [120]\n                costume [see inside]\n            else\n                if <(fulls) = [true]> then\n                    set [mode v] to [1]\n                    set [color v] to [120]\n                    costume [full]\n                else\n                    if <(remix) = [true]> then\n                        set [mode v] to [1]\n                        set [color v] to [52]\n                        costume [re]\n                    else\n                        if <(pfp) = [true]> then\n                            set [mode v] to [1]\n                            set [color v] to [52]\n                            costume [lo]\n                        else\n                            if <(report) = [true]> then\n                                set [mode v] to [1]\n                                set [color v] to [120]\n                                costume [report]\n                            else\n                                if <(gf) = [true]> then\n                                    set [mode v] to [1]\n                                    set [color v] to [52]\n                                    costume [gf]\n                                else\n                                    if <(sb) = [true]> then\n                                        set [mode v] to [1]\n                                        set [color v] to [0]\n                                        costume [stop]\n                                    else\n                                        if <(add) = [true]> then\n                                            set [mode v] to [1]\n                                            set [color v] to [120]\n                                            costume [add]\n                                        else\n                                            if <(copy) = [true]> then\n                                                set [mode v] to [1]\n                                                set [color v] to [120]\n                                                costume [copy]\n                                            else\n                                                if <(post) = [true]> then\n                                                    set [mode v] to [1]\n                                                    set [color v] to [120]\n                                                    costume [post]\n                                                else\n                                                    if <(cv) = [true]> then\n                                                        set [mode v] to [1]\n                                                        set [color v] to [120]\n                                                        costume [cv]\n                                                    else\n                                                        if <(cancel) = [true]> then\n                                                            set [mode v] to [1]\n                                                            set [color v] to [120]\n                                                            costume [cancel]\n                                                        else\n                                                            set [mode v] to [0]\n                                                            set [color v] to [0]\n                                                            costume [not]\n                                                        end\n                                                    end\n                                                end\n                                            end\n                                        end\n                                    end\n                                end\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\n\ndefine costume (check)\nif <not <(costume [name v]) = (check)>> then\n    repeat (4)\n        change [ghost v] effect by (25)\n    end\n    switch costume to (check)\n    repeat (4)\n        change [ghost v] effect by (-25)\n    end\nend\n\n@pfp\n\nrepeat (10)\n\nwhen flag clicked\nforever\n    set [pfp v] to <touching (mouse-pointer v)?>\nend\n\n@Figur1\n\nwhen flag clicked\nset [mode v] to [0]\ncreate clone of (_myself_ v)\nset [ghost v] effect to (90)\nset size to (5) %\nwait (0) seconds\nforever\n    show\n    go to x: (0) y: (50)\n    if <(mode) = [0]> then\n        change size by (((size) - (100)) / (-10))\n        switch costume to (kostüm1 v)\n    end\n    if <(mode) = [1]> then\n        set size to ((([cos v] of ((timer) * (100)) ) * (40)) + (100)) %\n        switch costume to (kostüm2 v)\n        set [color v] effect to (color)\n    end\nend\n\nwhen I start as a clone\nset [ghost v] effect to (90)\nset size to (40) %\nwait (0) seconds\nforever\n    show\n    go to x: (0) y: (50)\n    if <(mode) = [0]> then\n        change size by (((size) - (65)) / (-10))\n        switch costume to (kostüm1 v)\n    end\n    if <(mode) = [1]> then\n        set [color v] effect to (color)\n        set size to ((([sin v] of ((timer) * (100)) ) * (40)) + (100)) %\n        switch costume to (kostüm2 v)\n    end\nend\n\nwhen flag clicked\nset [report.yes? v] to [0]\nforever\n    if <(report) = [1]> then\n        show variable [☁ bad people who were about to report my project \(don't take this seriously! you are not a bad person\) v]\n        if <(report.yes?) = [0]> then\n            set [report.yes? v] to [1]\n            change [☁ bad people who were about to report my project \(don't take this seriously! you are not a bad person\) v] by (1)\n        end\n    else\n        hide variable [☁ bad people who were about to report my project \(don't take this seriously! you are not a bad person\) v]\n    end\nend\n\n@intro\n\nwhen [m v] key pressed\nstop all sounds\n\nwhen [p v] key pressed\nplay sound [Coffin Dance Remix Bass Boost Song With Original Video v] until done\n\nwhen I receive [start intro v]\nshow\nswitch costume to (intro v)\nstart sound [Coffin Dance Remix Bass Boost Song With Original Video v]\nrepeat (86)\n    wait (0.0001) seconds\n    next costume\n    broadcast (3 2 1 START v)\nend\nbroadcast (intro end v)\nhide\n\nwhen flag clicked\nhide\n\n@enemy \n\nwhen flag clicked\nswitch costume to (costume1 v)\nhide\n\nwhen I receive [intro end v]\nhide\nwait (20) seconds\nshow\n\nwhen I receive [next level v]\nrepeat until <(costume [number v]) = [4]>\n    next costume\nend\nif <(costume [number v]) = [4]> then\n    broadcast (moving ghost  v)\nend\n\nwhen flag clicked\nif <touching (improved3 v)?> then\n    broadcast (dead 2 v)\n    broadcast (dead v)\nend\n\n@EXIT\n\nwhen I receive [intro end v]\nshow\nif <touching (improved3 v)?> then\n    broadcast (nextlevel2 v)\n    broadcast (next lvel 3 v)\nend\n\nwhen flag clicked\nhide\n\n@Improved3\n\ndefine Controls - Left and Right\nset [speed x v] to ((speed x) * (0.7))\nif <key (left arrow v) pressed?> then\n    change [speed x v] by (-1.5)\nend\nif <key (right arrow v) pressed?> then\n    change [speed x v] by (1.5)\nend\n\ndefine Walk (direction) (speed) max step (step)\npoint in direction (direction)\nchange x by (speed)\nchange [frame v] by (([abs v] of (speed) ) / (8))\nset [improved2: slope v] to [0]\nGet Touching <(in platforrm) = [1]>\nrepeat until <<(Improved2: slope) = (step)> or <(touch) = [0]>>\n    change y by (1)\n    change [improved2: slope v] by (1)\n    Get Touching <(in platforrm) = [1]>\nend\nif <(Improved2: slope) = (step)> then\n    change x by ((0) - (speed))\n    change y by ((0) - (Improved2: slope))\n    if <<(touch) = [1]> and <(in platforrm) = [1]>> then\n        set [in platforrm v] to [2]\n        Walk (direction) (speed) max step (step)\n        if <(speed x) = [0]> then\n            set [in platforrm v] to [1]\n        end\n    else\n        if <<<key (up arrow v) pressed?> and <([abs v] of (speed) ) > [3.5]>> and <(touch) > [1]>> then\n            set [speed x v] to ((-1.2) * (speed))\n            set [improved2: speed y v] to [11]\n            set [falling? v] to [6]\n            set [wall jump v] to [15]\n        else\n            set [speed x v] to [0]\n        end\n    end\nend\n\ndefine Check Hit Ceiling / Floor <up?>\nGet Touching \nif <(touch) = [0]> then\n    set [in platforrm v] to [1]\nelse\n    if <<up?> and <(touch) = [1]>> then\n        set [in platforrm v] to [2]\n    end\nend\nrepeat until <(touch) < (in platforrm)>\n    if <up?> then\n        change y by (-1)\n    else\n        change y by (1)\n        set [falling? v] to [0]\n    end\n    Get Touching <not <up?>>\n    set [improved2: speed y v] to [0]\nend\n\ndefine Get Touching <check platform?>\nif <touching (ground v)?> then\n    set [touch v] to [9]\nelse\n    if <<check platform?> and <touching (ground v)?>> then\n        set [touch v] to [1]\n    else\n        set [touch v] to [0]\n    end\nend\n\ndefine Reset Level\nset size to (25) %\nset rotation style [left-right v]\ngo to x: (-197) y: (-78)\nreset timer\nshow\nset [speed x v] to [0]\nset [improved2: speed y v] to [0]\nset [falling? v] to [10]\nset [in platforrm v] to [1]\nset [frame v] to [0]\nset [wall jump v] to [0]\n\nwhen flag clicked\nif <touching (exit v)?> then\n    broadcast (next level v)\nend\n\nwhen flag clicked\ngo to x: (-166) y: (-118)\n\nwhen I receive [12121 v]\nshow\nif <<(Title) > [0]> and <(Full) < [12]>> then\n    hide\n    stop [this script v]\nend\nReset Level\nforever\n    switch costume to (hitbox v)\n    if <<(Improved2: speed y) < [4]> or <key (w v) pressed?>> then\n        change [improved2: speed y v] by (-1)\n    else\n        change [improved2: speed y v] by (-2)\n    end\n    if <key (up arrow v) pressed?> then\n        if <<(Improved2: jump key) = [0]> and <(falling?) < [3]>> then\n            set [improved2: speed y v] to [21]\n            set [falling? v] to [6]\n            set [improved2: jump key v] to [1]\n        end\n    else\n        set [improved2: jump key v] to [0]\n    end\n    if <key (down arrow v) pressed?> then\n        set [in platforrm v] to [2]\n    end\n    change y by (Improved2: speed y)\n    change [falling? v] by (1)\n    Check Hit Ceiling / Floor <(Improved2: speed y) > [0]>\n    if <(y position) < [-189]> then\n        Reset Level\n    end\n    if <(wall jump) > [0]> then\n        change [wall jump v] by (-1)\n    else\n        Controls - Left and Right\n    end\n    if <(speed x) < [-0.5]> then\n        Walk (-90) (speed x) max step (([ceiling v] of ([abs v] of ((speed x) * (1.3)) ) ) + (1))\n    else\n        if <(speed x) > [0.5]> then\n            Walk (90) (speed x) max step (([ceiling v] of ([abs v] of ((speed x) * (1.3)) ) ) + (1))\n        else\n            set [frame v] to [0]\n        end\n    end\n    if <(falling?) < [6]> then\n        if <(frame) = [0]> then\n            switch costume to (stand_1 v)\n        else\n            switch costume to ([floor v] of ((4) + ((frame) mod (8))) )\n        end\n    else\n        if <(Improved2: speed y) > [0]> then\n            switch costume to (jump_1 v)\n        else\n            switch costume to (fall_1 v)\n        end\n    end\n    if <touching (exit v)?> then\n        broadcast (next level v)\n        go to x: (-197) y: (-78)\n    end\n    broadcast (tick v) and wait\nend\n\nwhen flag clicked\nhide\n\nwhen I receive [dead 3 v]\nhide\n\nwhen flag clicked\nforever\n    if <<touching (enemy  v)?> or <<touching (sprite3 v)?> or <<key (r v) pressed?> or <touching (sprite2 v)?>>>> then\n        go to x: (-203) y: (-128)\n        broadcast (dead 3 v)\n        broadcast (dead 4 v)\n    end\nend\n\n@ground\n\nwhen I receive [next level v]\nnext costume\n\nwhen flag clicked\nswitch costume to (costume1 v)\n\nwhen flag clicked\nhide\n\nwhen I receive [12121 v]\nshow\n\nwhen flag clicked\nif <(costume [number v]) = [7]> then\n    broadcast (tnner v)\nend\n\n@Sprite2\n\nwhen I receive [moving ghost  v]\nshow\nforever\n    set rotation style [left-right v]\n    glide (1) secs to x: (159) y: (-71)\n    point in direction (90)\n    wait (1) seconds\n    point in direction (-90)\n    glide (1) secs to x: (-174) y: (-87)\nend\n\nwhen flag clicked\nforever\n    next costume\nend\n\nwhen flag clicked\nhide\n\n@Sprite3\n\nwhen flag clicked\nforever\n    glide (0.1) secs to x: (48) y: (70)\n    glide (1) secs to x: (50) y: (-39)\nend\n\nwhen flag clicked\nhide\n\nwhen I receive [tnner v]\nshow\n\n@thumbnail\n\nwhen flag clicked\nshow\ngo to x: (11) y: (25)\ngo to [front v] layer\nset size to (100) %\nset [ghost v] effect to (100)\n\n@Headphone warning\n\nwhen flag clicked\nhide\nswitch costume to (costume1 v)\ncreate clone of (_myself_ v)\nset size to (2) %\nshow\nrepeat (49)\n    change size by (2)\nend\nwait until <<(timer) = [5]> or <(timer) > [5]>>\nhide\nbroadcast (start intro v)\n\nwhen I start as a clone\nhide\ngo to [front v] layer\nset [ghost v] effect to (0)\nset size to (2) %\nswitch costume to (costume2 v)\nshow\nrepeat (45)\n    change size by (2)\nend\nreset timer\nrepeat until <<(timer) = [5]> or <(timer) > [5]>>\n    repeat (25)\n        change [ghost v] effect by (-4)\n    end\n    repeat (25)\n        change [ghost v] effect by (4)\n    end\nend\ndelete this clone\n\n