Platformer #Games #All #Trending
@Stage\n\nwhen I receive [change scene v]\nswitch backdrop to (backdrop1 v)\nif <(SCENE #) = [9]> then\n    switch backdrop to (level9 v)\nend\n\n@Player\n\nwhen flag clicked\nset [gravity v] to [-1.5]\nset [jump force v] to [13]\nset [acceleration v] to [2]\nset [resistance v] to [0.8]\nwait (3) seconds\nReset and Begin Level\n\ndefine Move - in 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\ndefine Check Touching Solid\nif <<touching (level v)?> or <touching (platform v)?>> then\n    set [touching v] to [1]\nelse\n    set [touching v] to [0]\nend\n\nwhen I receive [tick - player v]\nControls - Up and Down\nControls - Left and Right\nMove - in steps (([abs v] of (speed x) ) + ([abs v] of (speed y) ))\nchange [speed y v] by (GRAVITY)\n\ndefine Controls - Up and Down\nif <<key (w v) pressed?> or <key (up arrow v) pressed?>> then\n    point in direction (0)\n    if <(Falling) < [3]> then\n        set [speed y v] to (JUMP FORCE)\n    end\nend\n\ndefine Controls - Left and Right\nif <<key (a v) pressed?> or <key (left arrow v) pressed?>> then\n    change [speed x v] by ((0) - (ACCELERATION))\n    point in direction (-90)\nend\nif <<key (d v) pressed?> or <key (right arrow v) pressed?>> then\n    change [speed x v] by (ACCELERATION)\n    point in direction (90)\nend\nset [speed x v] to ((speed x) * (RESISTANCE))\n\ndefine Reset and Begin Level\nset [scene # v] to [1]\nset [speed x v] to [0]\nset [speed y v] to [0]\nset [falling v] to [99]\ngo to x: (-150) y: (55)\nbroadcast (Change Scene v)\nbroadcast (Game Loop v)\n\nwhen I receive [game loop v]\nforever\n    broadcast (Tick - Platforms v)\n    broadcast (Tick - Player v)\n    broadcast (Tick - Last v)\nend\n\nwhen I receive [tick - last v]\nif <(x position) > [235]> then\n    Begin Scene # ((SCENE #) + (1)) go to x: [-235]\nend\nif <(x position) < [-235]> then\n    Begin Scene # ((SCENE #) + (-1)) go to x: [235]\nend\n\ndefine Begin Scene # (scene #) go to x: (x)\nset [scene # v] to (scene #)\nset x to (x)\nbroadcast (Change Scene v)\nstop [other scripts in sprite v]\nwait (0) seconds\nFix Collision in Direction [0]\nbroadcast (Game Loop v)\n\ndefine Fix Collision in Direction (dir)\nset [temp v] to (direction)\nset [distance v] to [1]\npoint in direction (dir)\nrepeat (1000000)\n    Check Touching Solid\n    if <(Touching) < [1]> then\n        point in direction (Temp)\n        stop [this script v]\n    end\n    move (Distance) steps\n    turn left (180) degrees\n    change [distance v] by (1)\nend\n\nwhen flag clicked\nswitch costume to (cube v)\n\nwhen [s v] key pressed\nnext costume\n\ndefine Moved - by Moving Platform\nchange x by (PLATFORM DX)\nchange y by (PLATFORM DY)\nCheck Touching Solid\nif <(Touching) > [0]> then\n    Find Closest Space to (x position) (y position) max [100]\nend\n\nwhen I receive [tick - player v]\nMoved - by Moving Platform\nswitch backdrop to <touching (level v)?>\nControls - Up and Down\nControls - Left and Right\n\ndefine Find Closest Space to (x) (y) max (max)\nset [temp v] to (direction)\nset [distance v] to [1]\npoint in direction (0)\nrepeat (max)\n    repeat (16)\n        go to x: (x) y: (y)\n        move (Distance) steps\n        Check Touching Solid\n        if <(Touching) < [1]> then\n            point in direction (Temp)\n            stop [this script v]\n        end\n        turn right (22.5) degrees\n    end\n    change [distance v] by (1)\nend\ngo to x: (x) y: (y)\npoint in direction (Temp)\n\nwhen I receive [portal v]\ngo to x: (179) y: (159)\n\nwhen backdrop switches to [level9 v]\nforever\n    if <touching (orange portal v)?> then\n        broadcast (Portal v)\n    end\nend\n\nwhen flag clicked\nhide\nwait (3) seconds\nshow\ngo to x: (-150) y: (55)\n\nwhen [space v] key pressed\nnext costume\n\nwhen [down arrow v] key pressed\nnext costume\n\n@Level\n\nwhen flag clicked\ngo to x: (10) y: (1)\ngo to [back v] layer\n\nwhen I receive [change scene v]\nswitch costume to (join [Scene] (SCENE #))\n\nwhen flag clicked\nreset timer\nset [time v] to [0]\nrepeat until <(SCENE #) = [11]>\n    repeat until <[1] < (timer)>\n        if <(SCENE #) = [11]> then\n            stop [this script v]\n        end\n    end\n    change [time v] by (1)\n    reset timer\nend\n\nwhen flag clicked\nhide\nwait (3) seconds\nshow\n\n@Platform\n\ndefine Animate Platform\ngo to x: (-89) y: (81)\nforever\n    glide (3) secs to x: (106) y: (81)\n    wait (3) seconds\n    glide (3) secs to x: (-89) y: (81)\n    wait (3) seconds\nend\n\nwhen I receive [change scene v]\nhide\nif <(SCENE #) = [3]> then\n    show\n    Animate Platform\nend\n\nwhen I receive [tick - platforms v]\nTick (x position) (y position)\nset [last x v] to (x position)\nset [last y v] to (y position)\n\ndefine Tick (new x) (new y)\nif <(new y) > (Last y)> then\n    change y by (1)\nelse\n    set y to ((Last y) + (1))\nend\nif <touching (player v)?> then\n    set [platform dx v] to ((new x) - (Last x))\n    set [platform dy v] to ((new y) - (Last y))\nend\ngo to x: (new x) y: (new y)\n\n@Shortcut\n\nwhen I receive [change scene v]\nhide\nif <(SCENE #) = [6]> then\n    show\nend\n\n@Orange Portal\n\nwhen I receive [change scene v]\nhide\nif <(SCENE #) = [9]> then\n    show\nend\n\n@Blue portal\n\nwhen I receive [change scene v]\nhide\nif <(SCENE #) = [9]> then\n    show\nend\n\n@Timer\n\nwhen flag clicked\nwait (3) seconds\nset [time v] to [0]\nrepeat until <(SCENE #) = [11]>\n    repeat until <[1] < (timer)>\n        if <(SCENE #) = [11]> then\n            stop [this script v]\n        end\n    end\n    change [time v] by (1)\n    reset timer\nend\n\nwhen flag clicked\nreset timer\nforever\n    wait (1) seconds\n    change [time v] by (0)\nend\n\nwhen flag clicked\nhide variable [time v]\nwait (3) seconds\nshow variable [time v]\n\n@Thumbnail\n\nwhen flag clicked\ngo to x: (0) y: (0)\nswitch costume to (costume1 v)\nset size to (100) %\nswitch costume to (thumbnail v)\nforever\n    show\n    set [ghost v] effect to (0)\n    go to [front v] layer\nend\n\nwhen flag clicked\nshow\nwait (2) seconds\nforever\n    hide\nend\n\n@Music\n\nwhen flag clicked\nwait (2) seconds\nforever\n    play sound [Space Melody v] until done\nend\n\n