Unity || a platformer (this is my first platformer!


@Stage\n\nwhen flag clicked\nforever\n    play sound [Alan Walker - Unity \(Lyrics\) ft v] until done\nend\n\n@Figur1\n\nwhen flag clicked\nhide\n\ndefine Particle\nset [id v] to [2]\nrepeat (pick random (81) to (127))\n    create clone of (_myself_ v)\nend\n\nwhen I start as a clone\nif <(id) = [2]> then\n    show\n    set [brightness v] effect to (pick random (27) to (50))\n    set [color v] effect to (pick random (Color) to ((Color) + (20)))\n    point in direction (pick random (-180) to (180))\n    set [v v] to (pick random (5.0) to (9.0))\n    set [effekt: y v] to [3]\n    set size to (pick random (0) to (100)) %\n    repeat (5)\n        move (V) steps\n        change y by (Effekt: Y)\n        set [ghost v] effect to (50)\n        stamp\n        set [ghost v] effect to (0)\n        set [v v] to ((V) * (0.9))\n        change [effekt: y v] by (-0.3)\n    end\n    repeat (20)\n        move (V) steps\n        change y by (Effekt: Y)\n        set [v v] to ((V) * (0.9))\n        change [effekt: y v] by (-0.3)\n        change [ghost v] effect by (5)\n    end\n    delete this clone\nend\n\nwhen I start as a clone\nif <(id) = [1]> then\n    repeat (10)\n        change [ghost v] effect by (10)\n    end\n    delete this clone\nend\n\ndefine Firework\nset [id v] to [firework]\ncreate clone of (_myself_ v)\n\nforever\n    Firework\n    wait (pick random (1.00) to (3.00)) seconds\nend\n\nwhen I start as a clone\nif <(id) = [firework]> then\n    erase all\n    set [color v] to (pick random (0) to (200))\n    show\n    point in direction (pick random (-9.0) to (9.0))\n    go to x: (0) y: (-180)\n    set size to (81) %\n    clear graphic effects\n    set [color v] effect to (Color)\n    set [id v] to [1]\n    set [speed v] to (pick random (10.0) to (11.5))\n    start sound [recording2 v]\n    repeat until <[0.3] > (Speed)>\n        move (Speed) steps\n        create clone of (_myself_ v)\n        change [speed v] by (-0.3)\n    end\n    start sound [recording1 v]\n    set [brightness v] effect to (100)\n    set size to (500) %\n    Particle\n    wait (0.01) seconds\n    hide\n    repeat (10)\n        wait (0.01) seconds\n        erase all\n    end\nend\n\nwhen flag clicked\nforever\n    set [color2 v] to (Color)\nend\n\nwhen I receive [firework  v]\nFirework\n\n@Player\n\nwhen I receive [green flag clicked v]\nset size to (40) %\nset rotation style [left-right v]\ngo to x: (-200) y: (100)\nshow\ngo to [front v] layer\nset [speed y v] to [0]\nset [falling? v] to [10]\nforever\n    set [color v] effect to (Color2)\n    switch costume to (costume2 v)\n    if <<(speed y) < [4]> or <<key (w v) pressed?> or <<key (space v) pressed?> or <<key (up arrow v) pressed?> or <<mouse down?> and <(mouse y) > (y position)>>>>>> then\n        change [speed y v] by (-1)\n    else\n        change [speed y v] by (-2)\n    end\n    change y by (speed y)\n    Touch Ground <(speed y) > [0]>\n    if <(wall jump) > [0]> then\n        change [wall jump v] by (-1)\n    else\n        set [speed x v] to ((speed x) * (0.7))\n        if <<key (left arrow v) pressed?> or <<key (a v) pressed?> or <<mouse down?> and <(x position) > (mouse x)>>>> then\n            change [speed x v] by (-1.5)\n        end\n        if <<key (right arrow v) pressed?> or <<key (d v) pressed?> or <<mouse down?> and <(mouse x) > (x position)>>>> then\n            change [speed x v] by (1.5)\n        end\n    end\n    if <(speed x) < [-0.5]> then\n        Walk (-90) (speed x)\n    else\n        if <(speed x) > [0.5]> then\n            Walk (90) (speed x)\n        else\n            set [frame v] to [0]\n        end\n    end\n    if <<key (w v) pressed?> or <<key (space v) pressed?> or <<key (up arrow v) pressed?> or <<mouse down?> and <(mouse y) > (y position)>>>>> then\n        if <<(jump key) = [0]> and <(falling?) < [3]>> then\n            set [speed y v] to [14]\n            set [falling? v] to [6]\n            set [jump key v] to [1]\n        end\n    else\n        set [jump key v] to [0]\n    end\n    if <(y position) < [-180]> then\n        go to x: (-200) y: (100)\n        set [speed y v] to [0]\n    end\n    if <(x position) > [220]> then\n        go to x: (-200) y: (100)\n        broadcast (Next level v)\n    end\n    if <touching (spikes v)?> then\n        broadcast (Die v)\n        repeat (10)\n            change [ghost v] effect by (10)\n        end\n        set [ghost v] effect to (0)\n        go to x: (-200) y: (100)\n    end\n    Set Costume\nend\n\ndefine Walk (direction) (speed)\npoint in direction (direction)\nchange x by (speed)\nset [slope v] to [0]\nrepeat until <<(slope) = [8]> or <not <touching (ground v)?>>>\n    change y by (1)\n    change [slope v] by (1)\nend\nif <(slope) = [8]> then\n    change x by ((0) - (speed))\n    change y by ((0) - (slope))\n    if <<<key (w v) pressed?> or <<key (space v) pressed?> or <<key (up arrow v) pressed?> or <<mouse down?> and <(mouse y) > (y position)>>>>> and <([abs v] of (speed) ) > [3]>> then\n        if <(wall jump) = [0]> then\n            set [speed x v] to ((-1.2) * (speed))\n            set [speed y v] to [11]\n            set [falling? v] to [6]\n            set [wall jump v] to [15]\n        end\n    else\n        set [speed x v] to [0]\n    end\nend\nif <(speed) < [0]> then\n    change [frame v] by ((speed) / (-10))\nelse\n    change [frame v] by ((speed) / (10))\nend\n\ndefine Touch Ground <up?>\nchange [falling? v] by (1)\nrepeat until <not <touching (ground v)?>>\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    set [speed y v] to [0]\nend\n\ndefine Set Costume\nswitch costume to (costume2 v)\n\nwhen I start as a clone\nswitch costume to (costume3 v)\nset [ghost v] effect to (10)\nrepeat (10)\n    change size by (-1)\n    set [color v] effect to (Color2)\n    change [ghost v] effect by (10)\nend\ndelete this clone\n\nwhen I receive [green flag clicked v]\nforever\n    create clone of (_myself_ v)\nend\n\nwhen I receive [next level v]\nset size to (40) %\nset rotation style [left-right v]\ngo to x: (-200) y: (100)\nshow\nset [speed y v] to [0]\nset [falling? v] to [10]\n\nwhen I receive [restart v]\nset size to (40) %\nset rotation style [left-right v]\ngo to x: (-200) y: (100)\nshow\nset [speed y v] to [0]\nset [falling? v] to [10]\n\nwhen flag clicked\nbroadcast (Green Flag clicked v)\n\nwhen I receive [next level v]\nbroadcast (Firework  v)\n\n@Ground\n\nwhen I receive [next level v]\nif <not <(costume [number v]) = [14]>> then\n    next costume\n    next backdrop\nend\n\nwhen flag clicked\ngo to x: (0) y: (0)\n\nwhen I receive [green flag clicked v]\nswitch backdrop to (backdrop1 v)\nswitch costume to (costume1 v)\n\n@Spikes\n\nwhen flag clicked\nswitch costume to (costume2 v)\n\nwhen I receive [next level v]\nif <not <(costume [number v]) = [13]>> then\n    next costume\nend\n\nwhen flag clicked\nforever\n    set [color v] effect to (Color)\nend\n\n@Particles\n\nwhen I start as a clone\nshow\ngo to (player v)\npoint in direction (pick random (-180) to (180))\ngo to [back v] layer\nrepeat until <<(distance to [player v]) > [50]> or <touching (_edge_ v)?>>\n    set [color v] effect to (Color)\n    move (-5) steps\n    set [ghost v] effect to (distance to [player v])\nend\ndelete this clone\n\nwhen flag clicked\nhide\nforever\n    set [color v] effect to (Color)\nend\n\nwhen I receive [green flag clicked v]\nshow\nforever\n    hide\n    create clone of (_myself_ v)\n    create clone of (_myself_ v)\n    create clone of (_myself_ v)\n    create clone of (_myself_ v)\nend\n\n@Light\n\nwhen flag clicked\nforever\n    go to (player v)\n    set [color v] effect to (Color)\nend\n\nwhen flag clicked\nhide\nforever\n    set [color v] effect to (Color)\n    set [ghost v] effect to (0)\nend\n\nwhen I receive [green flag clicked v]\nshow\n\n@Background stuff\n\nwhen I start as a clone\nshow\ngo to [back v] layer\npoint in direction (pick random (-70) to (-100))\ngo to x: (300) y: (pick random (-180) to (180))\nset size to (pick random (350) to (450)) %\nset [brightness v] effect to (pick random (10) to (90))\nset [ghost v] effect to (pick random (90) to (95))\ngo to [back v] layer\nrepeat until <(x position) < [-220]>\n    move (10) steps\nend\ndelete this clone\n\nset size to (pick random (20) to (50)) %\n\nwhen flag clicked\nhide\nforever\n    create clone of (_myself_ v)\nend\n\nnext costume\n\n