Sky - forest | Platformer

Instructions: || Instructions ||\n- Use WASD or arrow keys to move,\n- Use the joystick if you are on mobile\n- Avoid danger\n- The Green arrows will help as speed boost\n- Avoid the red arrows as they make you go back!\n- Trampolines make you jump high! 

@Stage\n\nwhen I receive [intro - end v]\nswitch backdrop to (backdrop1 v)\nwait (3) seconds\nforever\n    play sound (pick random (1) to (2)) until done\nend\n\nwhen I receive [intro - end v]\nforever\n    if <(Level) = [10]> then\n        broadcast (confetti v)\n        stop [this script v]\n    end\nend\n\nwhen flag clicked\nswitch backdrop to (intro v)\n\n@Blank\n\n@Player\n\nwhen I start as a clone\nif <(Level) = [10]> then\n    switch costume to (clone v)\n    repeat (11)\n        change [color v] effect by (20)\n        change size by (-7)\n    end\nelse\n    repeat (0)\n        change [ghost v] effect by (2)\n        change size by (-9)\n    end\nend\ndelete this clone\n\nwhen I receive [reset v]\nset [x vel v] to [0]\nset [y vel v] to [0]\nclear graphic effects\nset size to (2) %\npoint in direction (90)\ngo to x: (-216) y: (40)\n\nwhen I receive [next level v]\nbroadcast (Reset v)\n\ndefine Other\nif <touching (bounce v)?> then\n    set [y vel v] to [20]\nend\nif <touching (forward v)?> then\n    set [x vel v] to [24]\nend\nif <touching (backward v)?> then\n    set [x vel v] to [-24]\nend\nif <(x position) > [239]> then\n    start sound [Ding v]\n    broadcast (Next Level v) and wait\n    change [level v] by (1)\nend\nif <<<(y position) < [-170]> or <<touching (lava v)?> or <touching (spikes v)?>>> or <touching (saw v)?>> then\n    start sound [Crunch v]\n    repeat (20)\n        change y by (5)\n        turn right (10) degrees\n        change [ghost v] effect by (5)\n    end\n    wait (0.2) seconds\n    broadcast (Reset v)\nend\n\nwhen I receive [intro - end v]\nshow\nclear graphic effects\nset size to (2) %\npoint in direction (90)\ngo to x: (-216) y: (40)\nset [level v] to [1]\nbroadcast (Next Level v)\nforever\n    Platformer Physics [1.6] [0.85] [-1] [15]\n    Set Costume\n    Other\n    change size by (((110) - (size)) / (10))\nend\n\nwhen I receive [intro - end v]\nforever\n    create clone of (_myself_ v)\nend\n\nwhen flag clicked\nhide\n\ndefine Set Costume\nif <<<key (right arrow v) pressed?> or <key (d v) pressed?>> or <(Stick X) > [0.5]>> then\n    switch costume to (right v)\nelse\n    switch costume to (player v)\n    if <<<key (left arrow v) pressed?> or <key (a v) pressed?>> or <(Stick X) < [-0.5]>> then\n        switch costume to (left v)\n    else\n        switch costume to (player v)\n    end\nend\n\nwhen [r v] key pressed\nbroadcast (Reset v)\n\ndefine Platformer Physics (speed) (friction) (gravity) (jump height)\nchange [y vel v] by (gravity)\nif <<<key (right arrow v) pressed?> or <key (d v) pressed?>> or <(Stick X) > [0.5]>> then\n    change [x vel v] by (speed)\nend\nif <<<key (left arrow v) pressed?> or <key (a v) pressed?>> or <(Stick X) < [-0.5]>> then\n    change [x vel v] by ((speed) * (-1))\nend\nset [x vel v] to ((X vel) * (friction))\nchange x by (X vel)\nif <touching (level v)?> then\n    change y by (1)\nend\nif <touching (level v)?> then\n    change y by (1)\nend\nif <touching (level v)?> then\n    change y by (1)\nend\nif <touching (level v)?> then\n    change y by (1)\nend\nif <touching (level v)?> then\n    change y by (-4)\n    change x by ((X vel) * (-1))\n    if <<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <(Stick Y) > [0.5]>> then\n        if <(X vel) > [0]> then\n            set [x vel v] to [-8]\n        else\n            set [x vel v] to [8]\n        end\n        set [y vel v] to [13]\n    else\n        set [x vel v] to [0]\n    end\nend\nchange y by (Y vel)\nif <touching (level v)?> then\n    change y by ((Y vel) - ((Y vel) * (2)))\n    set [y vel v] to [0]\nend\nchange y by (-1)\nif <<touching (level v)?> and <<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <(Stick Y) > [0.5]>>> then\n    set [y vel v] to (jump height)\nend\nchange y by (1)\n\n@Level\n\nwhen flag clicked\nhide\n\nwhen I receive [intro - end v]\nshow\nforever\n    switch costume to (Level)\nend\n\n@Spikes\n\nwhen I receive [intro - end v]\nshow\nforever\n    if <(costume [name v]) = [level7]> then\n        set [ghost v] effect to (100)\n    else\n        set [ghost v] effect to (0)\n    end\nend\n\nwhen I receive [intro - end v]\nshow\nforever\n    switch costume to (Level)\nend\n\nwhen flag clicked\nhide\n\n@Saw\n\nwhen I receive [intro - end v]\nforever\n    if <not <<<(Level) = [4]> or <(Level) = [6]>> or <(Level) = [8]>>> then\n        hide\n    end\nend\n\nwhen I receive [intro - end v]\nshow\nforever\n    if <(Level) = [4]> then\n        show\n        go to [back v] layer\n        set size to (100) %\n        go to x: (-105) y: (-105)\n        repeat (50)\n            change x by (1)\n            turn right (15) degrees\n        end\n        wait (0.001) seconds\n        repeat (50)\n            change x by (-1)\n            turn right (15) degrees\n        end\n    else\n        if <(Level) = [6]> then\n            show\n            go to [back v] layer\n            set size to (100) %\n            go to x: (-16) y: (-103)\n            repeat (50)\n                change x by (1)\n                turn right (20) degrees\n            end\n            wait (0.001) seconds\n            repeat (50)\n                change x by (-1)\n                turn right (20) degrees\n            end\n        else\n            if <(Level) = [8]> then\n                show\n                go to [back v] layer\n                set size to (95) %\n                go to x: (-15) y: (1)\n                repeat (50)\n                    turn right (19) degrees\n                end\n            else\n                hide\n            end\n        end\n    end\nend\n\nwhen flag clicked\nhide\n\n@Lava\n\nwhen I receive [intro - end v]\nshow\nforever\n    set [magma v] to [0]\n    repeat (10)\n        change [magma v] by (1)\n    end\n    repeat (20)\n        change [magma v] by (-1)\n    end\n    repeat (10)\n        change [magma v] by (1)\n    end\nend\n\nwhen I receive [intro - end v]\nshow\nforever\n    set y to (Magma)\n    switch costume to (Level)\nend\n\nwhen flag clicked\nhide\n\n@Forward\n\nwhen I receive [intro - end v]\nshow\ngo to [back v] layer\nforever\n    if <(Level) = [5]> then\n        show\n        switch costume to (costume1 v)\n        go to x: (79) y: (41)\n    else\n        if <(Level) = [6]> then\n            show\n            switch costume to (costume2 v)\n            go to x: (-29) y: (-13)\n        else\n            hide\n        end\n    end\nend\n\nwhen flag clicked\nhide\n\n@Backward\n\nwhen I receive [intro - end v]\nshow\nforever\n    if <(Level) = [6]> then\n        show\n        go to [back v] layer\n        point in direction (90)\n        go to x: (158) y: (-82)\n    else\n        if <(Level) = [8]> then\n            show\n            go to [back v] layer\n            point in direction (90)\n            go to x: (160) y: (-82)\n        else\n            hide\n        end\n    end\nend\n\nwhen flag clicked\nhide\n\n@Bounce\n\nwhen I receive [intro - end v]\nshow\nforever\n    if <(Level) = [8]> then\n        show\n        go to [back v] layer\n        go to x: (-108) y: (-77)\n    else\n        hide\n    end\nend\n\nwhen I receive [intro - end v]\nforever\n    switch costume to (1 v)\n    if <touching (player v)?> then\n        repeat (14)\n            next costume\n        end\n        switch costume to (1 v)\n    end\nend\n\nwhen flag clicked\nhide\n\n@Clouds\n\nwhen I start as a clone\nshow\nset [ghost v] effect to (pick random (40) to (15))\nswitch costume to (pick random (1) to (2))\nset y to (pick random (100) to (150))\nset [cloud speed v] to [1]\nset x to (-250)\nrepeat until <(x position) > [250]>\n    go to [back v] layer\n    move (cloud speed) steps\nend\ndelete this clone\n\nwhen I receive [intro - end v]\nhide\nforever\n    wait (pick random (1) to (4)) seconds\n    create clone of (_myself_ v)\n    wait (1) seconds\nend\n\n@Sun\n\nwhen I receive [intro - end v]\nshow\ngo to [back v] layer\nset size to (100) %\nforever\n    repeat (50)\n        change size by (((140) - (size)) / (10))\n    end\n    repeat (50)\n        change size by (((size) - (99)) / (-18))\n    end\nend\n\nwhen flag clicked\nhide\n\n@Particles\n\nwhen I start as a clone\nshow\nset [ghost v] effect to (pick random (60) to (80))\nrepeat until <[175] < (y position)>\n    move (pick random (3) to (5)) steps\nend\nrepeat (10)\n    change [ghost v] effect by (10)\nend\ndelete this clone\n\nwhen I receive [intro - end v]\nhide\ngo to [back v] layer\nforever\n    go to x: (pick random (-240) to (240)) y: (-180)\n    set size to (pick random (70) to (130)) %\n    point in direction (pick random (-30) to (30))\n    create clone of (_myself_ v)\n    wait (0.05) seconds\nend\n\n@confetti\n\nwhen flag clicked\nhide\n\nwhen I receive [confetti v]\nstart sound [Firework - Sound Effect \(HD\) v]\nset [screen_max_x v] to [90]\ndelete\nhide\nclone confetti\n\nwhen I start as a clone\nset [color v] to (pick random (0) to (4))\nforever\n    switch costume to ((1) + ((color) * (5)))\n    repeat (4)\n        next costume\n    end\n    repeat (4)\n        switch costume to ((costume [number v]) - (1))\n    end\nend\n\ndefine delete\ndelete this clone\n\nwhen I start as a clone\npoint in direction (pick random (0) to (360))\nset size to (pick random (40) to (80)) %\nclear graphic effects\ngo to [front v] layer\nshow\nset [particle_y_vel v] to (pick random (7) to (11))\nset [y speed v] to ((pick random (-4) to (-10)) / (10))\nset [particle_x_vel v] to ((pick random (50) to (-50)) / (10))\nif <(x position) < [0]> then\n    move with x position* [1.5]\nelse\n    move with x position* [-1.5]\nend\ndelete this clone\n\ndefine clone confetti\nrepeat (40)\n    go to x: ((screen_max_x) - (10)) y: (pick random (-10) to (20))\n    create clone of (_myself_ v)\nend\nrepeat (40)\n    go to x: (() - ((screen_max_x) - (10))) y: (pick random (-10) to (20))\n    create clone of (_myself_ v)\nend\n\ndefine move with x position* (a)\nrepeat (10)\n    change [particle_y_vel v] by (y speed)\n    change y by (particle_y_vel)\n    change x by ((a) * (particle_x_vel))\nend\nrepeat (40)\n    change [particle_y_vel v] by (y speed)\n    change y by (particle_y_vel)\n    change x by ((a) * (particle_x_vel))\nend\nrepeat (20)\n    change y by (particle_y_vel)\n    change x by ((a) * (particle_x_vel))\n    change [ghost v] effect by (5)\nend\n\nwhen I start as a clone\nwait (0) seconds\nforever\n    turn right ((12) * (particle_x_vel)) degrees\n    if <(y position) < [-179]> then\n        delete this clone\n    end\n    go to [front v] layer\nend\n\n@Control Stick\n\nwhen I start as a clone\nswitch costume to (stick v)\ngo [forward v] (1) layers\nset [ghost v] effect to (25)\nforever\n    set [stick power v] to []\n    set [stick x v] to [0]\n    set [stick y v] to [0]\n    repeat until <mouse down?>\n        go to (base sprite)\n    end\n    if <(distance to [mouse-pointer v]) < [60]> then\n        Stick Drag\n    else\n        wait until <not <mouse down?>>\n    end\nend\n\nwhen I start as a clone\nforever\n    if <touching (mouse-pointer v)?> then\n        change size by (((110) - (size)) / (5))\n    else\n        change size by (((100) - (size)) / (5))\n    end\nend\n\ndefine Stick Drag\nrepeat until <not <mouse down?>>\n    go to (mouse-pointer v)\n    point towards (base sprite)\n    turn right (180) degrees\n    set [stick direction v] to (direction)\n    set [stick power v] to (distance to [(base sprite) v])\n    if <(STICK POWER) > (max stick)> then\n        move ((max stick) - (STICK POWER)) steps\n        set [stick power v] to (max stick)\n    end\n    set [stick power v] to ((STICK POWER) / (max stick))\n    set [stick x v] to ((STICK POWER) * ([sin v] of (STICK DIRECTION) ))\n    set [stick y v] to ((STICK POWER) * ([cos v] of (STICK DIRECTION) ))\nend\n\nwhen I receive [intro - end v]\nshow\ngo to [front v] layer\ngo to x: (190) y: (-129)\nset [base sprite v] to [Control Stick]\nset [max stick v] to [25]\nswitch costume to (base v)\nset [ghost v] effect to (60)\ncreate clone of (_myself_ v)\n\nwhen flag clicked\nhide\n\n@Words\n\ndefine Next costume\nrepeat (10)\n    change [ghost v] effect by (10)\nend\nnext costume\nrepeat (10)\n    change [ghost v] effect by (-10)\nend\n\nwhen I receive [intro - end v]\nshow\nforever\n    switch costume to (Level)\nend\n\nwhen I receive [intro - end v]\nforever\n    if <(costume [name v]) = [level10]> then\n        change [color v] effect by (2)\n    else\n        set [color v] effect to (0)\n    end\nend\n\nwhen flag clicked\nhide\n\n@Thumbnail\n\nwhen flag clicked\nforever\n    go to x: (300) y: (300)\n    reset timer\n    hide\n    go to [front v] layer\nend\n\nwhen [timer v] > (0.01)\nrepeat until <<(round (x position)) = [0]> and <(round (y position)) = [0]>>\n    show\n    change x by (((0) - (x position)) / (10))\n    change y by (((0) - (y position)) / (10))\nend\nwait (0.1) seconds\n\n@Intro\n\nwhen I start as a clone\nif <(Clone) = [Particles]> then\n    switch costume to (pick random (29) to (31))\n    set size to (pick random (50) to (150)) %\n    set [ghost v] effect to (pick random (0.) to (5.))\n    set [brightness v] effect to (pick random (-25.) to (100.))\n    go to x: (0) y: (0)\n    point in direction (pick random (-180) to (180))\n    set [x v] to (pick random (10.) to (12.))\n    set [i v] to (pick random (2.) to (9.))\n    go to [front v] layer\n    show\n    repeat until <touching (_edge_ v)?>\n        move (X) steps\n        change y by (I)\n        change [i v] by (-0.4)\n        set [x v] to ((X) * (0.95))\n    end\n    delete this clone\nend\n\ndefine Particles\nset [clone v] to [Particles]\nrepeat (50)\n    create clone of (_myself_ v)\nend\n\nwhen I start as a clone\nif <(Clone) = [Name]> then\n    switch costume to (name v)\n    set size to (50) %\n    clear graphic effects\n    go to [front v] layer\n    go to x: (0) y: (-100)\n    point in direction (0)\n    show\n    repeat (50)\n        go to [front v] layer\n        change size by (((130) - (size)) / (8))\n        change y by (((0) - (y position)) / (8))\n        turn right (((90) - (direction)) / (8)) degrees\n    end\n    set [i v] to [-1]\n    repeat (10)\n        go to [front v] layer\n        change size by (I)\n        change [i v] by (join [-] (([abs v] of (I) ) / (2)))\n        turn right (I) degrees\n    end\n    switch costume to (logo v)\n    repeat (40)\n        go to [front v] layer\n        change size by (((130) - (size)) / (8))\n        turn right (((90) - (direction)) / (8)) degrees\n    end\n    set [i v] to [-1]\n    repeat (20)\n        go to [front v] layer\n        change size by ((I) / (3))\n        change [i v] by (join [-] (([abs v] of (I) ) / (4)))\n        turn right ((I) / (-3)) degrees\n    end\n    delete this clone\nend\n\nwhen flag clicked\nreset timer\nhide\nstart sound [Prismo - Stronger v]\nset volume to (100) %\nclear graphic effects\nset size to (100) %\npoint in direction (90)\ngo to x: (0) y: (0)\nset [clone v] to [Square]\ncreate clone of (_myself_ v)\nwait (1) seconds\nset [clone v] to [Name]\ncreate clone of (_myself_ v)\nwait (0) seconds\nrepeat (2)\n    Spiral spline explosion\n    Particles\n    Rect\n    Spiral spline explosion\nend\nCircle\nrepeat (4)\n    Spiral spline explosion\n    Particles\n    Rect\n    Spiral spline explosion\nend\nCircle\nrepeat (2)\n    Spiral spline explosion\n    Rect\n    Spiral spline explosion\nend\nbroadcast (Intro - end v)\n\nwhen I start as a clone\nif <(Clone) = [Square]> then\n    clear graphic effects\n    show\n    set size to (0) %\n    go to x: (0) y: (300)\n    point in direction (0)\n    switch costume to (square v)\n    repeat (20)\n        change size by (((100) - (size)) / (5))\n        turn right (((90) - (direction)) / (5)) degrees\n        change y by (((0) - (y position)) / (5))\n    end\n    point in direction (90)\n    repeat (12)\n        next costume\n    end\n    repeat (20)\n        switch costume to (blank v)\n        change size by (((2000) - (size)) / (5))\n        switch costume to (square13 v)\n    end\n    wait (3) seconds\n    repeat (20)\n        switch costume to (blank v)\n        change size by (((100) - (size)) / (5))\n        switch costume to (square13 v)\n    end\n    repeat (12)\n        switch costume to ((costume [number v]) - (1))\n        change size by (-5)\n    end\n    set [i v] to [-1]\n    repeat (20)\n        change size by ((I) / (3))\n        change [i v] by (join [-] (([abs v] of (I) ) / (4)))\n        turn right ((I) / (-3)) degrees\n        change y by ((I) / (3))\n    end\n    delete this clone\nend\n\nwhen I start as a clone\nif <(Clone) = [Bursts]> then\n    switch costume to (lineexplosion1 v)\n    clear graphic effects\n    go to [front v] layer\n    go [backward v] (1) layers\n    set [i v] to (pick random (1) to (3))\n    if <(I) = [1]> then\n        set [brightness v] effect to (100)\n    else\n        if <(I) = [2]> then\n            set [brightness v] effect to (25)\n        else\n            set [brightness v] effect to (-25)\n        end\n    end\n    show\n    set [i v] to [20]\n    Animate   x: [0] y: [0] size: [0] rotate: (pick random (-180) to (180)) speed: [1]\n    repeat (2)\n        set [i v] to ((I) * (0.9))\n        move (I) steps\n        Size: [100] speed: [5]\n    end\n    repeat (10)\n        set [i v] to ((I) * (0.9))\n        move (I) steps\n        Size: [100] speed: [5]\n        change [ghost v] effect by (10)\n        next costume\n    end\n    delete this clone\nend\n\ndefine Animate   x: (x) y: (y) size: (s) rotate: (r) speed: (s)\nchange x by (((round (x)) - (round (x position))) / (s))\nchange y by (((round (y)) - (round (y position))) / (s))\nchange size by (((round (s)) - (round (size))) / (s))\nturn right (((round (r)) - (round (direction))) / (s)) degrees\n\ndefine Spiral spline explosion\nset [clone v] to [Bursts]\nrepeat (5)\n    create clone of (_myself_ v)\nend\n\ndefine Size: (s) speed: (spd)\nchange size by (((round (s)) - (round (size))) / (spd))\n\ndefine Rect\nset [clone v] to [Rect]\ncreate clone of (_myself_ v)\n\nwhen I start as a clone\nif <(Clone) = [Rect]> then\n    clear graphic effects\n    show\n    set size to (0) %\n    go to (random position v)\n    point in direction (90)\n    switch costume to (background rect v)\n    repeat until <(round (size)) = [300]>\n        change size by (((300) - (size)) / (15))\n        change [ghost v] effect by (4)\n    end\n    delete this clone\nend\n\nwhen I start as a clone\nif <(Clone) = [Circle]> then\n    clear graphic effects\n    set [brightness v] effect to (100)\n    go to [front v] layer\n    go [backward v] (2) layers\n    show\n    set size to (0) %\n    go to x: (0) y: (0)\n    point in direction (90)\n    switch costume to (circle explosion 1 v)\n    repeat (20)\n        switch costume to (blank v)\n        change size by (((300) - (size)) / (5))\n        switch costume to (circle explosion 1 v)\n    end\n    repeat (20)\n        change [ghost v] effect by (5)\n    end\n    delete this clone\nend\n\ndefine Circle\nset [clone v] to [Circle]\ncreate clone of (_myself_ v)\nwait (0.1) seconds\nset [clone v] to [Circle 2]\ncreate clone of (_myself_ v)\n\nwhen I start as a clone\nif <(Clone) = [Circle 2]> then\n    clear graphic effects\n    set [brightness v] effect to (0)\n    go to [front v] layer\n    go [backward v] (1) layers\n    show\n    set size to (0) %\n    go to x: (0) y: (0)\n    point in direction (90)\n    switch costume to (circle explosion 1 v)\n    repeat (20)\n        switch costume to (blank v)\n        change size by (((300) - (size)) / (5))\n        switch costume to (circle explosion 1 v)\n    end\n    delete this clone\nend\n\n