BitVenturer || Pixel Platformer
@Stage\n\nwhen flag clicked\nswitch backdrop to (black v)\n\n@Player\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        Collide X - Slope or Wall?\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        Collide Y - Ceiling or Floor\n    end\nend\n\nwhen I receive [tick - player v]\nMoved by Moving Platform\nswitch backdrop to (join [Scene] (SCENE #))\nControls - Up and Down\nControls - Left and Right\nMove - in steps (([abs v] of (speed x) ) + ([abs v] of (speed y) ))\nSet Costume\n\ndefine Controls - Up and Down\nif <<key (space v) pressed?> or <<key (w v) pressed?> or <<key (up arrow v) pressed?> or <(JUMP) > [0]>>>> then\n    if <<(wall slide) > [0]> and <(jumping) = [0]>> then\n        start sound [Jump v]\n        set [jumping v] to [1]\n        set [falling v] to [3]\n        set [wall slide v] to [0]\n        turn right (180) degrees\n        set [speed x v] to (((direction) / (90)) * (7))\n        set [long jump v] to [12]\n    end\n    if <<(falling) < [3]> and <(jumping) = [0]>> then\n        start sound [Jump v]\n        set [jumping v] to [1]\n        set [falling v] to [3]\n    end\n    if <<(jumping) > [0]> and <(jumping) < (JUMP DURATION)>> then\n        change [jumping v] by (1)\n        set [speed y v] to (JUMP FORCE)\n    end\nelse\n    set [jumping v] to [0]\nend\nchange [speed y v] by (GRAVITY)\nif <(wall slide) > [0]> then\n    Check Can Wall Slide\n    if <(speed y) < [0]> then\n        set [speed y v] to ((speed y) * (0.6))\n    end\nend\n\ndefine Controls - Left and Right\nif <(long jump) > [0]> then\n    change [long jump v] by (-1)\n    stop [this script v]\nend\nset [key x v] to (<<key (d v) pressed?> or <<key (right arrow v) pressed?> or <(STICK X) > [0.5]>>> - <<key (a v) pressed?> or <<key (left arrow v) pressed?> or <(STICK X) < [-0.5]>>>)\nif <(KEY X) = [0]> then\n    if <<(falling) > [2]> and <(wall slide) < [1]>> then\n        set [speed x v] to ((speed x) * (0.98))\n        stop [this script v]\n    end\n    if <([abs v] of (speed x) ) < [1]> then\n        set [frame v] to [0]\n        set [speed x v] to [0]\n    else\n        change [frame v] by (0.5)\n    end\nelse\n    change [speed x v] by ((KEY X) * (ACCELERATION))\n    point in direction ((KEY X) * (90))\n    change [frame v] by (1)\nend\nset [speed x v] to ((speed x) * (RESISTANCE))\n\ndefine Reset and Begin Level\nshow\nset [invulnerable v] to [0]\nset [speed x v] to [0]\nset [speed y v] to [0]\nset [falling v] to [99]\nset [long jump v] to [0]\nset [jumping v] to [0]\nset [wall slide v] to [0]\npoint in direction (90)\nBegin Scene # (SPAWN SCENE) go to x, y (SPAWN X) (SPAWN Y)\n\nwhen I receive [game loop v]\nset [ghost v] effect to (0)\nforever\n    broadcast (Tick - First v)\n    broadcast (Tick - Platform 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, y [-235] []\nend\nif <(x position) < [-235]> then\n    Begin Scene # ((SCENE #) + (-1)) go to x, y [235] []\nend\nif <(y position) > [180]> then\n    Begin Scene # ((SCENE #) + (100)) go to x, y [] [-160]\nend\nif <(y position) < [-180]> then\n    Begin Scene # ((SCENE #) + (-100)) go to x, y [] [180]\nend\nif <touching (danger v)?> then\n    broadcast (Lose Life v)\nend\n\ndefine Begin Scene # (scene #) go to x, y (x) (y)\nset [scene # v] to (scene #)\nif <(x) > []> then\n    set x to (x)\nend\nif <(y) > []> then\n    set y to (y)\nend\nbroadcast (Exit Scene v)\nbroadcast (Change Scene v)\nstop [other scripts in sprite v]\nwait (0) seconds\nswitch costume to (hitbox v2 v)\nset rotation style [don't rotate v]\nif <(x) > []> then\n    Fix Collision in Direction [0]\nelse\n    Fix Collision in Direction [90]\nend\nSet Costume\nbroadcast (Game Loop v)\n\nwhen I receive [tick - first v]\nswitch costume to (hitbox v2 v)\nset rotation style [don't rotate v]\nset [platform dx v] to []\nset [platform dy v] to []\n\ndefine Set Costume\nset rotation style [left-right v]\nif <(wall slide) > [0]> then\n    switch costume to (hangon01 v)\n    stop [this script v]\nend\nif <(falling) > [1]> then\n    if <(speed y) > [0]> then\n        switch costume to (jump01 v)\n    else\n        switch costume to (run_j2 v)\n        stop [this script v]\n    end\nend\nif <(frame) > [0]> then\n    switch costume to ((1) + ([floor v] of ((frame) mod (16)) ))\nelse\n    switch costume to (hit angle 0 v)\n    repeat (5)\n        Check touching solid\n        if <(touching) < [1]> then\n            switch costume to ((costume [number v]) + (5))\n            stop [this script v]\n        end\n        next costume\n    end\n    switch costume to (stand v)\nend\n\ndefine Collide X - Slope or Wall?\nCheck Can Wall Slide\nchange y by (1)\nCheck touching solid\nif <(touching) > [0]> then\n    change y by (1)\n    Check touching solid\n    if <(touching) > [0]> then\n        change y by (-2)\n        set x to (last value)\n        set [speed x v] to [0]\n        stop [this script v]\n    end\n    set [speed x v] to ((speed x) * (0.8))\nend\nset [speed x v] to ((speed x) * (0.95))\nSlip\n\ndefine Check touching solid\nif <<<touching (level v)?> or <touching (platform v)?>> or <touching (platform2 v)?>> then\n    set [touching v] to [1]\nelse\n    set [touching v] to [0]\nend\n\ndefine Collide Y - Ceiling or Floor\nset y to (last value)\nif <(speed y) > [0]> then\n    set [speed y v] to [0]\n    stop [this script v]\nend\nif <(falling) > [0]> then\n    set [falling v] to [0]\n    Slip\nend\nset [speed y v] to ((speed y) * (0.8))\n\ndefine Slip\nchange y by (-2)\nchange x by (1)\nCheck touching solid\nif <(touching) < [1]> then\n    set [falling v] to [9]\n    change [speed x v] by (1)\n    stop [this script v]\nend\nchange x by (-2)\nCheck touching solid\nif <(touching) < [1]> then\n    set [falling v] to [9]\n    change [speed x v] by (-1)\n    stop [this script v]\nend\nchange y by (2)\nchange x by (1)\n\ndefine Check Can Wall Slide\nif <(falling) < [2]> then\n    set [wall slide v] to [0]\n    stop [this script v]\nend\nswitch costume to (hitbox wallslide v)\nset rotation style [left-right v]\nCheck touching solid\nset [wall slide v] to (touching)\nswitch costume to (hitbox v2 v)\nset rotation style [don't rotate v]\n\nwhen I receive [lose life v]\nset [invulnerable v] to [1]\nstop [other scripts in sprite v]\nstart sound [Meow v]\nstart sound [Oops v]\nrepeat (5)\n    switch costume to (die-01 v)\n    change [ghost v] effect by (20)\n    wait (0.1) seconds\n    switch costume to (die-02 v)\n    wait (0.1) seconds\nend\nhide\nchange [orbs v] by (-1)\nReset and Begin Level\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 [16]\n    if <(touching) > [0]> then\n        broadcast (Lose Life v)\n    end\nend\n\ndefine Fix Collision in Direction (dir)\nset [temp v] to (direction)\nset [distance v] to [1]\npoint in direction (dir)\nrepeat (128)\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 right (180) degrees\n    change [distance v] by (1)\nend\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 [start game v]\nset [gravity v] to [-1.5]\nset [jump force v] to [12]\nset [jump duration v] to [6]\nset [acceleration v] to [1.5]\nset [resistance v] to [0.8]\nbroadcast (Reset Game v) and wait\nbroadcast (Setup v) and wait\nset [scene # v] to [1]\nset [spawn scene v] to [1]\nset [spawn x v] to [-164]\nset [spawn y v] to [96]\nReset and Begin Level\n\nwhen I receive [player - bounce v]\nset [speed y v] to [10]\n\nwhen flag clicked\nhide\n\n@Level\n\nwhen flag clicked\nhide\ngo to x: (0) y: (0)\ngo to [back v] layer\n\nwhen I receive [change scene v]\nshow\nerase all\nswitch costume to (join [Scene] (SCENE #))\nStamp Outline\nStamp Shadow\n\ndefine Stamp Shadow\nset [brightness v] effect to (-100)\nset [ghost v] effect to (90)\nchange y by (-20)\nstamp\nchange y by (20)\nclear graphic effects\n\ndefine Stamp Outline\nset rotation style [don't rotate v]\nset [brightness v] effect to (-100)\nrepeat (8)\n    move (3) steps\n    stamp\n    move (-3) steps\n    turn right (45) degrees\nend\nclear graphic effects\n\n@Danger\n\nwhen flag clicked\nswitch costume to (blank v)\ngo to x: (0) y: (0)\ngo to [back v] layer\n\nwhen I receive [change scene v]\nswitch costume to (blank v)\nswitch costume to (join [Scene] (SCENE #))\nif <(SCENE #) = [3]> then\n    forever\n        set y to ((3) * ([sin v] of ((timer) * (160)) ))\n    end\nend\n\n@Platform\n\nwhen I receive [change scene v]\ngo to [back v] layer\nhide\nif <(SCENE #) = [3]> then\n    Spawn [platform] at [-50] [-91] dir [90] turn []\nend\nif <(SCENE #) = [6]> then\n    Spawn [Key 1] at [-109] [-8] dir [90] turn []\nend\nif <(SCENE #) = [7]> then\n    Spawn [platform] at [114] [-26] dir [90] turn []\nend\nif <(SCENE #) = [109]> then\n    Spawn [Key 2] at [178] [-77] dir [90] turn []\nend\nif <(SCENE #) = [110]> then\n    Spawn [turn] at [-84] [-115] dir [90] turn [1]\n    Spawn [turn] at [15] [-95] dir [90] turn [-1]\nend\n\ndefine Animate Platform (max x) (max y) (min x) (min y) (wait) (time)\nset size to (100) %\npoint in direction (90)\nforever\n    glide (time) secs to x: (max x) y: (max y)\n    wait (wait) seconds\n    glide (time) secs to x: (min x) y: (min y)\n    wait (wait) seconds\nend\n\nwhen I receive [tick - platform 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 <(turn) > []> then\n    change y by (4)\n    if <touching (player v)?> then\n        Rotation Maths CCW ((0) - (turn))\n    end\nelse\n    if <(new y) > (last y)> then\n        change y by (1)\n    else\n        set y to ((last y) + (1))\n    end\n    if <touching (player v)?> then\n        set [platform dx v] to ((new x) - (last x))\n        set [platform dy v] to ((new y) - (last y))\n    end\nend\ngo to x: (new x) y: (new y)\n\ndefine Door at (x) (y) key (key name)\nshow\nswitch costume to (key name)\ngo to x: (x) y: (y)\nforever\n    wait until <touching (player v)?>\n    if <[collected v] contains (key name)?> then\n        start sound [Buzz Whir v]\n        repeat (24)\n            change y by (4)\n        end\n        wait (1) seconds\n        start sound [Buzz Whir v]\n        repeat (24)\n            change y by (-4)\n        end\n        start sound [Crunch v]\n    else\n        start sound [Low Squeak v]\n    end\n    wait until <not <touching (player v)?>>\nend\n\ndefine Animate - Boss level\ngo to x: (160) y: (28)\nforever\n    glide (3) secs to x: (-154) y: (28)\n    glide (3) secs to x: (160) y: (28)\nend\n\nwhen flag clicked\nhide\n\nwhen flag clicked\nset rotation style [left-right v]\nhide\n\nwhen I receive [exit scene v]\ndelete this clone\n\ndefine Spawn (type) at (x) (y) dir (dir) turn (degress)\nset [turn v] to (degress)\nswitch costume to (type)\ngo to x: (x) y: (y)\npoint in direction (dir)\ncreate clone of (_myself_ v)\n\nwhen I start as a clone\nshow\nif < (costume [name v]) contains [key]?> then\n    Door at (x position) (y position) key (costume [name v])\nend\nif <(SCENE #) = [3]> then\n    Animate Platform [-50] [120] [-50] [-91] [0.3] [3]\nend\nif <(SCENE #) = [7]> then\n    Animate Platform [114] [-166] [114] [-26] [0.3] [2]\nend\nif <(turn) > []> then\n    set rotation style [all around v]\n    forever\n        turn right (turn) degrees\n    end\nend\n\ndefine Rotation Maths CCW (ccw)\nset [dx v] to (([x position v] of [player v]) - (x position))\nset [dy v] to (([y position v] of [player v]) - (y position))\nset [sin v] to ([sin v] of (ccw) )\nset [cos v] to ([cos v] of (ccw) )\nset [platform dx v] to ((((dx) * (cos)) - ((dy) * (sin))) - (dx))\nset [platform dy v] to ((((dx) * (sin)) + ((dy) * (cos))) - (dy))\n\n@Platform2\n\nwhen I receive [change scene v]\nhide\nif <(SCENE #) = [3]> then\n    go to [back v] layer\n    show\n    Animate Platform\nend\nif <(SCENE #) = [108]> then\n    show\n    Animate 2\n    create clone of (_myself_ v)\nend\n\ndefine Animate Platform\nset size to (100) %\npoint in direction (90)\ngo to x: (164) y: (196)\nforever\n    glide (.1) secs to x: (164) y: (105)\n    wait (0.2) seconds\n    glide (0.7) secs to x: (164) y: (210.5)\n    wait (0.3) seconds\nend\n\nwhen I receive [tick - platform 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\ndefine Animate 2\nset size to (70) %\npoint in direction (90)\ngo to x: (73) y: (149)\nforever\n    glide (.1) secs to x: (65) y: (85)\n    wait (0.2) seconds\n    glide (0.7) secs to x: (65) y: (148)\n    wait (0.3) seconds\nend\n\nwhen I start as a clone\nif <(SCENE #) = [108]> then\n    go to [back v] layer\n    show\n    Animate 3\nelse\n    hide\nend\n\ndefine Animate 3\nset size to (70) %\npoint in direction (90)\ngo to x: (73) y: (81)\nforever\n    glide (0.7) secs to x: (135) y: (149)\n    wait (0.3) seconds\n    glide (.1) secs to x: (135) y: (81)\n    wait (0.2) seconds\nend\n\nwhen flag clicked\nhide\n\n@Collectable\n\nwhen I receive [change scene v]\nif <(SCENE #) = (my scene)> then\n    show\nelse\n    hide\nend\n\nwhen I start as a clone\nrepeat until <touching (player v)?>\n    change y by ((0.5) * ([sin v] of (frame) ))\n    change [frame v] by (5)\nend\nset [my scene v] to []\nif <(costume [name v]) = [apple]> then\n    start sound [Pop v]\n    change [orbs v] by (pick random (1) to (5))\nelse\n    if <(costume [name v]) = [Green Flag]> then\n        start sound [Collect v]\n        set [spawn scene v] to (SCENE #)\n        set [spawn x v] to ([x position v] of [player v])\n        set [spawn y v] to ([y position v] of [player v])\n    else\n        if <(costume [name v]) = [Gapple]> then\n            start sound [Pop v]\n            start sound [Collect v]\n            change [orbs v] by (10)\n        else\n            if <(costume [name v]) = [Star]> then\n                broadcast (Player Win v)\n            else\n                start sound [Collect v]\n                add (costume [name v]) to [collected v]\n            end\n        end\n    end\nend\nrepeat (20)\n    change y by (2)\n    change [ghost v] effect by (5)\nend\nhide\n\nwhen I receive [setup v]\ndelete all of [collected v]\nset [frame v] to [0]\nset [orbs v] to [0]\nset [apples v] to [0]\nhide\nPlace [apple] scene [1] xy [-3] [95]\nPlace [apple] scene [1] xy [71] [-35]\nPlace [apple] scene [1] xy [122] [-35]\nPlace [apple] scene [1] xy [175] [-35]\nPlace [apple] scene [2] xy [46] [7]\nPlace [apple] scene [2] xy [46] [60]\nPlace [apple] scene [2] xy [46] [109]\nPlace [apple] scene [3] xy [-50] [68]\nPlace [apple] scene [4] xy [-135] [21]\nPlace [apple] scene [4] xy [-116] [-19]\nPlace [apple] scene [4] xy [-94] [-53]\nPlace [apple] scene [4] xy [-67] [-84]\nPlace [apple] scene [4] xy [-28] [-113]\nPlace [apple] scene [4] xy [14] [-133]\nPlace [apple] scene [105] xy [-139] [72]\nPlace [Key 1] scene [106] xy [-25] [16]\nPlace [Green Flag] scene [2] xy [186] [80]\nPlace [Green Flag] scene [5] xy [3] [-122]\nPlace [Green Flag] scene [6] xy [88] [-8]\nPlace [Gapple] scene [8] xy [-80] [-125]\nPlace [Gapple] scene [108] xy [-181] [95]\nPlace [Green Flag] scene [108] xy [200] [74]\nPlace [Star] scene [111] xy [10] [-9]\n\ndefine Place (costume name) scene (scene) xy (x) (y)\nset [my scene v] to (scene)\nswitch costume to (costume name)\ngo to x: (x) y: (y)\ncreate clone of (_myself_ v)\nset [my scene v] to []\n\nwhen I receive [reset game v]\ndelete this clone\n\n@Splash Screen\n\nwhen flag clicked\nhide\nset [mute sound v] to [0]\nset volume to (50) %\ngo to x: (0) y: (0)\nswitch costume to (title screen v)\ngo to [front v] layer\n\nwhen I receive [start game v]\nhide\nset [mute sound v] to [2]\nstop all sounds\n\nwhen I receive [player win v]\nstop all sounds\nhide variable [lives v]\nhide variable [orbs v]\nhide variable [boss health v]\nhide variable [scene # v]\nswitch costume to (win screen v)\ngo to [front v] layer\nshow\nset [mute sound v] to [1]\nplay sound [Win v] until done\nstop [all v]\n\nwhen I receive [start game v]\nrepeat until <(MUTE SOUND) = [1]>\n    play sound [Kitsune^2 - Rainbow Tylenol v] until done\nend\n\nwhen I receive [main menu v]\nshow\nrepeat until <(MUTE SOUND) = [2]>\n    play sound [O Ji Ji - The Shadow v] until done\nend\n\n@Main Menu\n\nwhen I receive [main menu v]\nwait (0.001) seconds\ngo to [front v] layer\nshow\nhide variable [lives v]\nhide variable [orbs v]\nset size to (10) %\ngo to x: (0) y: (-103)\nforever\n    if <touching (mouse-pointer v)?> then\n        change size by ((0.2) * ((90) - (size)))\n    else\n        change size by ((0.2) * ((80) - (size)))\n    end\nend\n\nwhen flag clicked\nhide\n\nwhen this sprite clicked\nhide\nbroadcast (Start Game v)\n\n@Boss\n\nwhen flag clicked\nswitch costume to (boss1 v)\nset [boss v] to [0]\nset [boss health v] to [6]\nhide variable [boss health v]\nset rotation style [left-right v]\nhide\n\nwhen I receive [change scene v]\nif <(SCENE #) = [109]> then\n    if <(BOSS HEALTH) < [1]> then\n        hide\n    else\n        Spawn [Mr. Sourface] at [2] [-83] dir [90]\n    end\nend\n\nwhen I start as a clone\nshow\nset [speed v] to [2]\nset [speed y v] to [0]\nset [frame v] to [0]\nswitch costume to (boss1 v)\nforever\n    if <<(costume [name v]) = [Boss - Dead]> and <(BOSS HEALTH) < [1]>> then\n        stop [other scripts in sprite v]\n        switch costume to (boss - dead v)\n        wait (1) seconds\n        broadcast (Boss Dead v)\n        delete this clone\n    else\n        switch costume to (hitbox v)\n        set rotation style [don't rotate v]\n        broadcast (Tick - Boss v)\n        change [frame v] by (0.25)\n        switch costume to ((1) + (([floor v] of (frame) ) mod (2)))\n        set rotation style [left-right v]\n        if <<(INVULNERABLE) = [0]> and <touching (player v)?>> then\n            Touching Player\n        end\n    end\nend\n\nwhen I receive [exit scene v]\ndelete this clone\n\ndefine Move - Down\nchange [speed y v] by (-1)\nchange y by (speed y)\nrepeat until <not <touching (level v)?>>\n    change y by (1)\n    set [speed y v] to [0]\nend\n\ndefine Move - Left or Right\nif <(BOSS HEALTH) = [6]> then\n    move (1) steps\nend\nif <(BOSS HEALTH) = [5]> then\n    move (1) steps\nend\nif <(BOSS HEALTH) = [4]> then\n    move (2) steps\nend\nif <(BOSS HEALTH) = [3]> then\n    move (2) steps\nend\nif <(BOSS HEALTH) = [2]> then\n    move (3) steps\nend\nif <(BOSS HEALTH) = [1]> then\n    move (3) steps\nend\nrepeat (4)\n    if <not <<touching (level v)?> or <touching (_edge_ v)?>>> then\n        if <not <<touching (safe zones v)?> or <touching (platform v)?>>> then\n            stop [this script v]\n        end\n    end\n    change y by (1)\nend\nchange y by (-4)\nmove (-2) steps\nturn right (180) degrees\n\ndefine Touching Player\nbroadcast (Player - Bounce v)\nif <([speed y v] of [player v]) < [-2]> then\n    if <(BOSS HEALTH) = [1]> then\n        change [boss health v] by (-1)\n        stop [other scripts in sprite v]\n        switch costume to (boss - dead v)\n        change [boss v] by (1)\n        broadcast (Boss Dead v)\n    else\n        change [boss health v] by (-1)\n        switch costume to (boss - hurt v)\n        create clone of (lemon ball v)\n    end\nelse\n    broadcast (Lose Life v)\nend\n\ndefine Spawn (type) at (x) (y) dir (dir)\ngo to x: (x) y: (y)\npoint in direction (dir)\ncreate clone of (_myself_ v)\n\nwhen I receive [change scene v]\nif <(SCENE #) = [109]> then\n    if <(BOSS HEALTH) < [1]> then\n        broadcast (Hide boss health v)\n    else\n        broadcast (Boss health v)\n    end\nelse\n    broadcast (Hide boss health v)\nend\n\nwhen I receive [tick - boss v]\nMove - Left or Right\nMove - Down\n\nwhen I receive [boss dead v]\nwait (2) seconds\nstop [other scripts in sprite v]\nswitch costume to (boss - dead v)\nforever\n    hide\nend\n\n@Safe Zones\n\nwhen flag clicked\ngo to x: (0) y: (0)\ngo to [back v] layer\nforever\n    set [ghost v] effect to (100)\nend\n\nwhen I receive [change scene v]\nswitch costume to (blank v)\nswitch costume to (join [Scene] (SCENE #))\n\n@Enemy\n\nwhen flag clicked\nset rotation style [left-right v]\nhide\n\nwhen I receive [change scene v]\nif <(SCENE #) = [1]> then\n    if <([x position v] of [player v]) < [0]> then\n        Spawn [Lemon] at [186] [87] dir [-90]\n    else\n        Spawn [Lemon] at [-167] [30] dir [90]\n    end\n    Spawn [Lemon] at [-4] [-43] dir [90]\nend\nif <(SCENE #) = [2]> then\n    Spawn [Lemon] at [45] [-43] dir [90]\nend\nif <(SCENE #) = [4]> then\n    Spawn [Lemon] at [18] [-133] dir [90]\nend\nif <(SCENE #) = [106]> then\n    Spawn [Lemon] at [-38] [-21] dir [90]\nend\nif <(SCENE #) = [6]> then\n    Spawn [Lemon] at [-50] [-30] dir [90]\nend\nif <(SCENE #) = [8]> then\n    Spawn [Lemon] at [174] [-143] dir [-90]\nend\nif <(SCENE #) = [108]> then\n    Spawn [Lemon] at [-39] [-130] dir [90]\n    Spawn [Lemon] at [-168] [-130] dir [90]\nend\n\nwhen I start as a clone\nshow\nset [speed y v] to [0]\nset [frame v] to [0]\nforever\n    switch costume to (hitbox v)\n    set rotation style [don't rotate v]\n    broadcast (Tick - Enemy v)\n    change [frame v] by (0.25)\n    switch costume to ([floor v] of ((1) + ((frame) mod (4))) )\n    set rotation style [left-right v]\n    if <<(INVULNERABLE) = [0]> and <touching (player v)?>> then\n        Touching Player\n    end\nend\n\nwhen I receive [exit scene v]\ndelete this clone\n\ndefine Move - Down\nchange [speed y v] by (-1)\nchange y by (speed y)\nrepeat until <not <touching (level v)?>>\n    change y by (1)\n    set [speed y v] to [0]\nend\n\ndefine Move - Left or Right\nmove (2) steps\nrepeat (4)\n    if <not <<touching (level v)?> or <touching (_edge_ v)?>>> then\n        if <not <<touching (safe zones v)?> or <touching (platform v)?>>> then\n            stop [this script v]\n        end\n    end\n    change y by (1)\nend\nchange y by (-4)\nmove (-2) steps\nturn right (180) degrees\n\ndefine Touching Player\nif <([speed y v] of [player v]) < [-2]> then\n    broadcast (Player - Bounce v)\n    start sound [Squish Pop v]\n    switch costume to (lemon squish v)\n    wait (0.3) seconds\n    repeat (10)\n        change [ghost v] effect by (10)\n    end\n    delete this clone\nend\nbroadcast (Lose Life v)\n\ndefine Spawn (type) at (x) (y) dir (dir)\ngo to x: (x) y: (y)\npoint in direction (dir)\ncreate clone of (_myself_ v)\n\nwhen I receive [tick - enemy v]\nMove - Left or Right\nMove - Down\n\n@Collectable2\n\nwhen I receive [change scene v]\nif <(SCENE #) = (my scene)> then\n    if <(BOSS HEALTH) < [1]> then\n        show\n    else\n        hide\n    end\nelse\n    hide\nend\n\nwhen I start as a clone\nrepeat until <(BOSS) = [1]>\n    hide\nend\nshow\nrepeat until <touching (player v)?>\n    change y by ((0.5) * ([sin v] of (frame) ))\n    change [frame v] by (5)\nend\nset [my scene v] to []\nstart sound [Collect v]\nadd (costume [name v]) to [collected v]\nrepeat (20)\n    change y by (2)\n    change [ghost v] effect by (5)\nend\nhide\n\nwhen I receive [setup v]\ndelete all of [collected v]\nset [frame v] to [0]\nset [orbs v] to [0]\nhide\nPlace [Key 2] scene [109] xy [-24] [-58]\n\ndefine Place (costume name) scene (scene) xy (x) (y)\nset [my scene v] to (scene)\nswitch costume to (costume name)\ngo to x: (x) y: (y)\ncreate clone of (_myself_ v)\nset [my scene v] to []\nhide\n\nwhen I receive [reset game v]\ndelete this clone\n\n@Sprite2\n\nwhen flag clicked\nhide\ngo to x: (-43) y: (41)\n\nwhen I receive [main menu v]\nshow\n\n@Orbs\n\nwhen flag clicked\nhide\n\nwhen I start as a clone\ngo to [front v] layer\nshow\nforever\n    change costume to (letter (index) of (ORBS))\n    change size by ((0.2) * ((100) - (size)))\nend\n\ndefine setup\nhide\nswitch costume to (0 v)\ngo to x: (-178) y: (153)\nset [index v] to [1]\nrepeat (3)\n    create clone of (_myself_ v)\n    change x by (15)\n    change [index v] by (1)\nend\n\ndefine change costume to (costume)\nif <not <(costume) = (costume [name v])>> then\n    switch costume to (costume)\n    set size to (120) %\nend\n\nwhen I receive [start game v]\nsetup\n\n@Sprite3\n\nwhen flag clicked\ngo to x: (0) y: (20)\nhide\nforever\n    switch costume to (join [health-] (BOSS HEALTH))\nend\n\nwhen I receive [boss health v]\nshow\n\nwhen I receive [hide boss health v]\nhide\n\n@Pew Pew Studio\n\nwhen flag clicked\nshow\ngo to [front v] layer\nswitch costume to (pew pew studio v)\nset [ghost v] effect to (100)\nrepeat (50)\n    change [ghost v] effect by (-2)\nend\nwait (0.5) seconds\nnext costume\nstart sound [Pew sound effect v]\nwait (0.3) seconds\nnext costume\nstart sound [Pew sound effect v]\nwait (0.3) seconds\nnext costume\nstart sound [Pew sound effect v]\nwait (0.5) seconds\nbroadcast (Main Menu v)\ngo to [front v] layer\nrepeat (50)\n    go to [front v] layer\n    change [ghost v] effect by (2)\nend\nhide\n\n@lemon ball\n\nwhen flag clicked\nhide\n\nwhen I start as a clone\nset rotation style [don't rotate v]\ngo to [back v] layer\ngo to x: ([x position v] of [player v]) y: (162)\npoint in direction (180)\nshow\nrepeat until <(x position) < [-220]>\n    move (5) steps\n    if <touching (player v)?> then\n        broadcast (Lose Life v)\n    end\n    if <(SCENE #) = [109]> then\n        show\n    else\n        delete this clone\n    end\nend\ndelete this clone\n\nwhen I receive [lose life v]\nstop [other scripts in sprite v]\ndelete this clone\n\nwhen I receive [boss dead v]\nstop [other scripts in sprite v]\ndelete this clone\n\n@Control Stick\n\nwhen flag clicked\nhide\n\nwhen I start as a clone\nshow\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]) < ((size) * (0.65))> then\n        Stick Drag\n    else\n        wait until <not <mouse down?>>\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 [start game v]\nif <(Mobile) = [/]> then\n    show\n    go to x: (-163) y: (-102)\n    go to [front v] layer\n    set [max stick v] to ((size) / (4))\n    set size to (140) %\n    set [base sprite v] to [Control Stick]\n    switch costume to (base v)\n    set [ghost v] effect to (60)\n    create clone of (_myself_ v)\nelse\n    hide\nend\n\n@Option button\n\nwhen I receive [main menu v]\nwait (0.001) seconds\ngo to [front v] layer\nshow\nset size to (10) %\ngo to x: (0) y: (-140)\nforever\n    if <touching (mouse-pointer v)?> then\n        change size by ((0.2) * ((90) - (size)))\n    else\n        change size by ((0.2) * ((80) - (size)))\n    end\nend\n\nwhen flag clicked\nhide\n\nwhen this sprite clicked\nbroadcast (Options v)\n\nwhen I receive [start game v]\nhide\n\n@Options\n\nwhen flag clicked\nhide\n\nwhen I receive [options v]\ngo to [front v] layer\nshow\n\nwhen I receive [back options v]\nhide\n\n@Mobile\n\nwhen flag clicked\nswitch costume to ( v)\nhide\nforever\n    set [mobile v] to (costume [name v])\nend\n\nwhen I receive [options v]\nwait (0) seconds\ngo to [front v] layer\nshow\n\nwhen this sprite clicked\nnext costume\n\nwhen I receive [back options v]\nhide\n\n@Back Button\n\nwhen flag clicked\nset [brightness v] effect to (0)\nhide\nforever\n    wait (0) seconds\n    next costume\n    if <touching (mouse-pointer v)?> then\n        set [brightness v] effect to (35)\n    else\n        set [brightness v] effect to (0)\n    end\nend\n\nwhen I receive [options v]\nwait (0) seconds\ngo to [front v] layer\nshow\n\nwhen this sprite clicked\nbroadcast (Back options v)\nhide\n\n@Jump\n\nwhen flag clicked\nhide\n\nwhen I receive [start game v]\nif <(Mobile) = [/]> then\n    set [jump v] to [0]\n    switch costume to (base v)\n    set [ghost v] effect to (60)\n    show\n    go to x: (163) y: (-102)\n    go to [front v] layer\n    set size to (140) %\nelse\n    hide\nend\n\nwhen this sprite clicked\nset [jump v] to [1]\nwait until <not <mouse down?>>\nset [jump v] to [0]\n\n
---------------------------Halloween---------------------------------------------------------------A-----------------------------------------------------Multiplayer Scrolling Platformer---------------\n\n-------------------------INSTRUCTIONS------------------------\n-Arrow Keys To Move\n-Mobile Tap\n-N To Toggle Names\n-Collect Sweets\n-You Will Get Given A Random Skin\n-There is a Chat\n-click or space to pull the sword from the stone\n-To use the sword you either need to press space or \n click the player\n-Click on the flag icon to see your achievements\n-Click on the location icon to see where you are on the level (even on the mini map you can't see the entire platform layout)\n-n to toggle names\n-To win you must go through the barrier blocking the exit to do this you must collect all 99 sweets and all 5 achievements \n-If you leave a hooded creature in its grave for too long it will escape!!\n-Press the box on the bottom right to toggle cloud