The Orb 2 - Platformer


@Stage\n\nwhen I receive [new level v]\nswitch costume to (0 v)\nif <(Level) > [11]> then\n    switch costume to (join [L] (Level))\nend\n\n@Player\n\nwhen I start as a clone\nset [start x v] to (pick random (3) to (10))\nset [start y v] to (pick random (-90) to (90))\nset [x speed v] to ((start x) * ([sin v] of (start y) ))\nset [y speed v] to ((start x) * ([cos v] of (start y) ))\nset [brightness v] effect to (pick random (-10) to (10))\nif <(costume [name v]) = [Particle]> then\n    repeat (25)\n        change [y speed v] by (-1)\n        change [ghost v] effect by (4)\n        change x by (x speed)\n        change y by (y speed)\n    end\nelse\n    set [x speed v] to ((0.1) * (x speed))\n    set [y speed v] to ((0.1) * (y speed))\n    repeat (40)\n        change [ghost v] effect by (2.5)\n        change size by (5)\n        change x by (x speed)\n        change y by (y speed)\n    end\nend\ndelete this clone\n\ndefine Spawn Particles\nswitch costume to (particle v)\nrepeat (20)\n    create clone of (_myself_ v)\nend\nswitch costume to (smoke v)\nrepeat (5)\n    create clone of (_myself_ v)\nend\nswitch costume to (player v)\n\nwhen I receive [new level v]\ndelete this clone\n\nwhen I receive [start v]\nset [level v] to [1]\nset [win v] to [0]\nbroadcast (New Level v) and wait\nswitch costume to (player v)\ngo to x: (0) y: (0)\npoint in direction (90)\nset [x speed v] to [0]\nset [y speed v] to [0]\nforever\n    set rotation style [don't rotate v]\n    if <<key (right arrow v) pressed?> or <<mouse down?> and <(x position) < (mouse x)>>> then\n        change [x speed v] by (2)\n    end\n    if <<key (left arrow v) pressed?> or <<mouse down?> and <(mouse x) < (x position)>>> then\n        change [x speed v] by (-2)\n    end\n    set [x speed v] to ((x speed) * (0.8))\n    change x by (x speed)\n    turn right ((x speed) * ((360) / ((41) * (3.14159)))) degrees\n    if <<touching (ground v)?> or <touching (extra ground v)?>> then\n        change y by (1)\n        if <<touching (ground v)?> or <touching (extra ground v)?>> then\n            change y by (1)\n            if <<touching (ground v)?> or <touching (extra ground v)?>> then\n                change y by (1)\n                if <<touching (ground v)?> or <touching (extra ground v)?>> then\n                    change y by (1)\n                    if <<touching (ground v)?> or <touching (extra ground v)?>> then\n                        change y by (1)\n                        if <<touching (ground v)?> or <touching (extra ground v)?>> then\n                            change y by (1)\n                            if <<touching (ground v)?> or <touching (extra ground v)?>> then\n                                change y by (-6)\n                                change x by ((0) - (x speed))\n                                turn right (((0) - (x speed)) * ((360) / ((41) * (3.14159)))) degrees\n                                set [x speed v] to ((x speed) * (0.5))\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\n    if <<(Jump Counter) > [0]> and <<key (up arrow v) pressed?> or <<mouse down?> and <((y position) + (20)) < (mouse y)>>>> then\n        set [y speed v] to [15]\n        set [jump counter v] to [0]\n    end\n    change [jump counter v] by (-1)\n    change [y speed v] by (-1)\n    set [y speed v] to ((y speed) * (0.95))\n    change y by (y speed)\n    if <<touching (ground v)?> or <touching (extra ground v)?>> then\n        change y by ((0) - (y speed))\n        if <(y speed) < [0]> then\n            set [jump counter v] to [4]\n            if <<key (up arrow v) pressed?> or <<mouse down?> and <((y position) + (20)) < (mouse y)>>> then\n                set [y speed v] to [15]\n                set [jump counter v] to [0]\n            else\n                set [y speed v] to ((y speed) * (0.5))\n            end\n        else\n            set [y speed v] to ((y speed) * (0.5))\n        end\n    end\n    change x by (Change x)\n    if <<touching (ground v)?> or <touching (extra ground v)?>> then\n        change x by ((0) - (Change x))\n    end\n    set [change x v] to [0]\n    change y by (Change y)\n    if <<touching (ground v)?> or <touching (extra ground v)?>> then\n        change y by ((0) - (Change y))\n    end\n    set [change y v] to [0]\n    if <(x position) > [225]> then\n        change [level v] by (1)\n        set x to (-225)\n        set [start x v] to (x position)\n        set [start y v] to (y position)\n        broadcast (New Level v) and wait\n    end\n    if <(x position) < [-225]> then\n        change [level v] by (-1)\n        set x to (225)\n        set [start x v] to (x position)\n        set [start y v] to (y position)\n        broadcast (New Level v) and wait\n    end\n    if <<(y position) < [-175]> or <touching (danger v)?>> then\n        Spawn Particles\n        set [x speed v] to [0]\n        set [y speed v] to [0]\n        go to x: (start x) y: (start y)\n    end\n    set rotation style [all around v]\nend\n\n@Ground\n\nwhen I receive [new level v]\nswitch costume to (Level)\n\n@Effect\n\n@Decorations\n\nwhen I start as a clone\nshow\nforever\n    if <(letter (1) of (costume [name v])) = [V]> then\n        Decoration decrease % [0.98] player effect [-0.01] reset factor [0.02]\n    end\n    if <(letter (1) of (costume [name v])) = [G]> then\n        Decoration decrease % [0.95] player effect [0.06] reset factor [0.2]\n    end\n    if <(costume [name v]) = [Smoke]> then\n        change x by (pick random (-0.75) to (0.75))\n        change y by (2)\n        change [ghost v] effect by (1)\n        change size by (2)\n        change [place v] by (1)\n        if <(Place) = [100]> then\n            set x to (Start x)\n            change y by (-200)\n            set [ghost v] effect to (pick random (0) to (10))\n            set size to (pick random (20) to (40)) %\n            set [place v] to [0]\n            if <<(Win) = [1]> and <(Level) = [14]>> then\n                delete this clone\n            end\n        end\n        if <touching (player v)?> then\n            change [ghost v] effect by (2)\n        end\n    end\n    if <(costume [name v]) = [Orb]> then\n        change [speed v] by (4)\n        set [brightness v] effect to ((4) * ([sin v] of (speed) ))\n        if <<(Win) = [0]> and <touching (player v)?>> then\n            set [win v] to [1]\n            broadcast (Win v)\n        end\n    end\nend\n\ndefine Decoration decrease % (decrease %) player effect (player effect) reset factor (reset factor)\nset [speed v] to ((speed) * (decrease %))\nif <touching (player v)?> then\n    change [speed v] by ((player effect) * ([x speed v] of [player v]))\nend\nif <(direction) > [90.5]> then\n    change [speed v] by ((0) - (reset factor))\nend\nif <(direction) < [89.5]> then\n    change [speed v] by (reset factor)\nend\nturn right (speed) degrees\n\nwhen I receive [new level v]\nif <[0] = [0]> then\n    delete this clone\nend\nClone\n\ndefine Clone\npoint in direction (90)\nset [speed v] to [0]\nif <(Level) = [1]> then\n    switch costume to (vchain 1 v)\n    go to x: (-100) y: (135)\n    repeat (2)\n        create clone of (_myself_ v)\n        change x by (25)\n    end\n    go to x: (100) y: (135)\n    repeat (3)\n        create clone of (_myself_ v)\n        change x by (15)\n    end\nend\nif <(Level) = [2]> then\n    switch costume to (vchain 3 v)\n    go to x: (-100) y: (148)\n    repeat (2)\n        create clone of (_myself_ v)\n        change x by (200)\n    end\nend\nif <(Level) = [3]> then\n    switch costume to (vchain 2 v)\n    go to x: (-55) y: (97)\n    repeat (2)\n        create clone of (_myself_ v)\n        change x by (110)\n    end\nend\nif <(Level) = [4]> then\n    switch costume to (vchain 3 v)\n    go to x: (-54) y: (98)\n    create clone of (_myself_ v)\n    go to x: (-129) y: (137)\n    repeat (2)\n        create clone of (_myself_ v)\n        change x by (150)\n    end\nend\nif <(Level) = [5]> then\n    switch costume to (vchain 1 v)\n    go to x: (-87.5) y: (135)\n    repeat (2)\n        create clone of (_myself_ v)\n        change x by (25)\n    end\n    go to x: (62.5) y: (135)\n    repeat (2)\n        create clone of (_myself_ v)\n        change x by (25)\n    end\n    Smoke x: [-75] y: [-150]\n    Smoke x: [75] y: [-150]\nend\nif <(Level) = [6]> then\n    switch costume to (vchain 3 v)\n    go to x: (-175) y: (147)\n    create clone of (_myself_ v)\n    switch costume to (vchain 2 v)\n    go to x: (-97) y: (-28)\n    repeat (2)\n        create clone of (_myself_ v)\n        change x by (25)\n    end\n    switch costume to (vchain 1 v)\n    go to x: (45) y: (147)\n    repeat (2)\n        create clone of (_myself_ v)\n        change x by (30)\n    end\n    go to x: (196) y: (53)\n    repeat (2)\n        create clone of (_myself_ v)\n        change x by (24)\n    end\nend\nif <(Level) = [7]> then\n    switch costume to (vchain 3 v)\n    go to x: (-185) y: (54)\n    create clone of (_myself_ v)\n    switch costume to (vchain 2 v)\n    go to x: (-120) y: (147)\n    create clone of (_myself_ v)\n    go to x: (50) y: (115)\n    create clone of (_myself_ v)\n    switch costume to (vchain 1 v)\n    go to x: (170) y: (75)\n    create clone of (_myself_ v)\nend\nif <(Level) = [8]> then\n    switch costume to (vchain 1 v)\n    go to x: (-20) y: (70)\n    repeat (2)\n        create clone of (_myself_ v)\n        change x by (40)\n    end\n    Smoke x: [-150] y: [-150]\n    Smoke x: [0] y: [-150]\n    Smoke x: [150] y: [-150]\nend\nif <(Level) = [9]> then\n    Smoke x: [0] y: [0]\n    switch costume to (vchain 2 v)\n    go to x: (-50) y: (115)\n    repeat (2)\n        create clone of (_myself_ v)\n        change x by (100)\n    end\nend\nif <(Level) = [10]> then\n    switch costume to (vchain 1 v)\n    go to x: (-53) y: (114)\n    repeat (2)\n        create clone of (_myself_ v)\n        change x by (106)\n    end\nend\nif <(Level) = [11]> then\n    switch costume to (vchain 1 v)\n    go to x: (-165) y: (67)\n    create clone of (_myself_ v)\n    go to x: (-62) y: (109)\n    create clone of (_myself_ v)\n    go to x: (57) y: (117)\n    create clone of (_myself_ v)\n    go to x: (170) y: (153)\n    create clone of (_myself_ v)\nend\nif <(Level) = [12]> then\n    switch costume to (grass 1 v)\n    go to x: (-115) y: (-80)\n    repeat (3)\n        repeat (3)\n            create clone of (_myself_ v)\n            next costume\n        end\n        switch costume to (grass 1 v)\n        change x by (75)\n    end\n    go to x: (172) y: (-80)\n    repeat (3)\n        create clone of (_myself_ v)\n        next costume\n    end\n    switch costume to (vine 1 v)\n    go to x: (139) y: (142)\n    repeat (2)\n        create clone of (_myself_ v)\n        change x by (65)\n    end\nend\nif <(Level) = [13]> then\n    switch costume to (grass 1 v)\n    go to x: (-172) y: (-80)\n    repeat (3)\n        create clone of (_myself_ v)\n        next costume\n    end\n    switch costume to (vine 1 v)\n    go to x: (-9) y: (142)\n    repeat (4)\n        create clone of (_myself_ v)\n        change x by (-65)\n    end\nend\nif <(Level) = [14]> then\n    switch costume to (orb v)\n    go to x: (40) y: (-45)\n    point in direction (130)\n    create clone of (_myself_ v)\n    point in direction (90)\n    Smoke x: [-7] y: [-100]\n    Smoke x: [-97] y: [-50]\n    Smoke x: [83] y: [-50]\nend\n\ndefine Smoke x: (x) y: (y)\nif <not <<(Win) = [1]> and <(Level) = [14]>>> then\n    set size to (20) %\n    switch costume to (smoke v)\n    go to x: (x) y: (y)\n    set [ghost v] effect to (0)\n    set [place v] to [0]\n    set [start x v] to (x)\n    repeat (20)\n        create clone of (_myself_ v)\n        change [place v] by (5)\n        change y by (10)\n        change [ghost v] effect by (8)\n        change size by (10)\n    end\n    set size to (100) %\nend\nswitch costume to (stack v)\ngo to x: (x) y: (y)\nset [ghost v] effect to (0)\nset [place v] to [0]\nset [start x v] to [0]\ncreate clone of (_myself_ v)\n\n@Danger\n\nwhen I receive [new level v]\nif <[0] = [0]> then\n    delete this clone\nend\nClone\n\ndefine Clone\npoint in direction (90)\nset [speed v] to [0]\nif <(Level) = [7]> then\n    switch costume to (blade 2 v)\n    go to x: (0) y: (-200)\n    point in direction (-90)\n    create clone of (_myself_ v)\n    point in direction (90)\nend\nif <(Level) = [8]> then\n    switch costume to (blade 2 v)\n    go to x: (-150) y: (-200)\n    point in direction (-90)\n    repeat (3)\n        create clone of (_myself_ v)\n        change x by (150)\n        turn left (120) degrees\n    end\n    point in direction (90)\nend\nif <(Level) = [10]> then\n    switch costume to (blade 3 v)\n    go to x: (-159) y: (-200)\n    point in direction (-90)\n    repeat (4)\n        create clone of (_myself_ v)\n        change x by (106)\n        turn left (-90) degrees\n    end\n    point in direction (90)\nend\n\nwhen I start as a clone\nshow\nset [origin x v] to (x position)\nset [origin y v] to (y position)\nset [origin direction v] to (direction)\nforever\n    if <(costume [name v]) = [Gear 1]> then\n        if <(Level) = [6]> then\n            change [origin direction v] by (2)\n            go to x: ((origin x) + (([sin v] of (origin direction) ) * (150))) y: ((origin y) + (([cos v] of (origin direction) ) * (150)))\n            turn right (-4) degrees\n        end\n    end\n    if <(Level) = [7]> then\n        if <(origin direction) > [90]> then\n            hide\n            if <(origin direction) > [270]> then\n                show\n                change [origin direction v] by (-360)\n            end\n        end\n        change [origin direction v] by (4)\n        go to x: (origin x) y: ((origin y) + (([cos v] of (origin direction) ) * (285)))\n        turn right (-10) degrees\n    end\n    if <(Level) = [8]> then\n        if <(origin direction) > [90]> then\n            hide\n            if <(origin direction) > [270]> then\n                show\n                change [origin direction v] by (-360)\n            end\n        end\n        change [origin direction v] by (6)\n        go to x: (origin x) y: ((origin y) + (([cos v] of (origin direction) ) * (100)))\n        turn right (-10) degrees\n    end\n    if <(Level) = [10]> then\n        if <(origin direction) > [90]> then\n            hide\n            if <(origin direction) > [270]> then\n                show\n                change [origin direction v] by (-360)\n            end\n        end\n        change [origin direction v] by (4)\n        go to x: (origin x) y: ((origin y) + (([cos v] of (origin direction) ) * (200)))\n        turn right (-10) degrees\n    end\nend\n\n@Environment Interactables\n\nwhen I receive [new level v]\nif <[0] = [0]> then\n    delete this clone\nend\ndelete all of [gears v]\nClone\nbroadcast (Clone Extra Ground v) and wait\n\ndefine Clone\npoint in direction (90)\nif <(Level) = [3]> then\n    Put Gear at x: [0] y: [100] rotation speed: [-4]\n    Put Gear at x: [0] y: [-30] rotation speed: [4]\nend\nif <(Level) = [4]> then\n    Put Gear at x: [200] y: [50] rotation speed: [4]\n    Put Gear at x: [155] y: [-15] rotation speed: [-4]\n    Put Gear at x: [110] y: [-80] rotation speed: [4]\nend\nif <(Level) = [5]> then\n    Put Gear at x: [-150] y: [-30] rotation speed: [4]\n    Put Gear at x: [0] y: [-30] rotation speed: [-4]\n    Put Gear at x: [150] y: [-30] rotation speed: [4]\nend\nif <(Level) = [6]> then\n    Put Gear at x: [-180] y: [-180] rotation speed: [2]\n    Put Gear at x: [-20] y: [-180] rotation speed: [3]\n    Put Gear at x: [140] y: [-100] rotation speed: [-4]\n    Put Gear at x: [-20] y: [-20] rotation speed: [5]\n    Put Gear at x: [140] y: [60] rotation speed: [-6]\nend\nif <(Level) = [7]> then\n    Put Gear at x: [-75] y: [0] rotation speed: [4]\n    Put Gear at x: [75] y: [-80] rotation speed: [4]\nend\nif <(Level) = [8]> then\n    Put Gear at x: [-75] y: [-30] rotation speed: [-6]\n    Put Gear at x: [75] y: [-30] rotation speed: [-6]\nend\nif <(Level) = [9]> then\n    Put Gear at x: [-150] y: [-20] rotation speed: [-5]\n    Put Gear at x: [-40] y: [-140] rotation speed: [-5]\n    turn right (22.5) degrees\n    Put Gear at x: [150] y: [-20] rotation speed: [5]\n    Put Gear at x: [40] y: [-140] rotation speed: [5]\n    point in direction (90)\nend\n\ndefine Put Gear at x: (x) y: (y) rotation speed: (speed)\nadd (x) to [gears v]\nadd (y) to [gears v]\nset [speed v] to (speed)\ngo to x: (x) y: (y)\nswitch costume to (gear 1 v)\ncreate clone of (_myself_ v)\n\nwhen I start as a clone\nshow\nforever\n    turn right (Speed) degrees\n    if <(distance to [player v]) < [64]> then\n        set [change x v] to ((Speed) * ((([y position v] of [player v]) - (y position)) / (distance to [player v])))\n        set [change y v] to ((Speed) * (((x position) - ([x position v] of [player v])) / (distance to [player v])))\n    end\nend\n\n@Thumbnail\n\nwhen flag clicked\nswitch costume to (intro v)\nshow\nif <(Text) = [0]> then\n    wait (1) seconds\n    Clone [Line 1]\n    wait (1) seconds\n    Clone [Line 2]\n    wait (3) seconds\n    Clone [Line 3]\n    wait (1) seconds\n    Clone [Line 4]\n    wait (3) seconds\n    Clone [Line 5]\n    wait (2) seconds\n    Clone [Line 6]\n    set [text v] to [1]\n    wait (4) seconds\nend\nbroadcast (Start v)\nswitch costume to (thumbnail v)\nwait (0.5) seconds\nstart sound [Seven Years In Tibet - Theme - John Williams v]\nrepeat (50)\n    change [ghost v] effect by (2)\nend\n\nwhen I start as a clone\nset [ghost v] effect to (100)\ngo [forward v] (1) layers\nrepeat (20)\n    change [ghost v] effect by (-5)\nend\n\ndefine Clone (line)\nswitch costume to (line)\ncreate clone of (_myself_ v)\nswitch costume to (intro v)\n\nwhen I receive [start v]\ndelete this clone\n\nwhen I receive [win v]\nswitch costume to (win 1 v)\nrepeat (20)\n    change [ghost v] effect by (-5)\nend\n\nwhen I receive [new level v]\nif <(Win) = [1]> then\n    if <(Level) = [14]> then\n        switch costume to (win 1 v)\n    else\n        switch costume to (win 2 v)\n    end\nend\n\n@Extra Ground\n\nwhen I receive [clone extra ground v]\nClone\n\nwhen I start as a clone\nset [ghost v] effect to (100)\nshow\n\ndefine Clone\nif <[0] = [0]> then\n    delete this clone\nend\nset [gear v] to [0]\nrepeat ((length of [gears v]) / (2))\n    go to x: (item ((Gear) + (1)) of [gears v]) y: (item ((Gear) + (2)) of [gears v])\n    create clone of (_myself_ v)\n    change [gear v] by (2)\nend\n\n