Platformer


@Stage\n\nwhen flag clicked\nforever\nend\n\nplay sound [Dance Slow Mo v] until done\n\n@Player\n\nforever\n    if <key (w v) pressed?> then\n        change y by (30)\n    end\nend\n\nwhen I receive [player bounce v]\nset [speed y v] to [10]\n\nwhen I receive [start game v]\nset [gravity v] to [-1]\nset [jump force v] to [10]\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 [lives v] to [3]\nset [spawn scene v] to [-102]\nset [spawn x v] to [162]\nset [spawn y v] to [0]\nReset and Begin Level\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 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\nwhen flag clicked\nbroadcast (Main Menu v)\n\nchange y by (() - (speed y))\nstop [all v]\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\ndefine Check Touching Solid\nif <<touching (level v)?> or <touching (platform v)?>> then\n    set [touching v] to [1]\n    stop [this script v]\nend\nset [touching v] to [0]\nset [hit costume v] to (costume [name v])\nif <(hit costume) = [hitbox v2]> then\n    switch costume to (hitbox feet v)\nend\nif <touching (jump through platform v)?> then\n    if <(jump through) < [1]> then\n        change y by (-6)\n        if <(hit costume) = [hitbox v2]> then\n            switch costume to (hitbox feet2 v)\n        end\n        if <touching (jump through platform v)?> then\n            set [touching v] to [1]\n        else\n            set [jump through v] to [1]\n        end\n        change y by (6)\n    end\nelse\n    set [jump through v] to [0]\nend\nswitch costume to (hit costume)\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\nMove - in steps (([abs v] of (speed x) ) + ([abs v] of (speed y) ))\nSet Costume\n\ndefine Controls - Up and Down\nif <<key (w v) pressed?> or <key (up arrow v) pressed?>> then\n    if <<(wall slide) > [0]> and <(jumping) = [0]>> then\n        start sound [Low Whoosh 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 [High Whoosh 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?>> - <<key (a v) pressed?> or <key (left arrow v) pressed?>>)\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    if <not <(direction) = ((KEY X) * (90))>> then\n        set [wall slide v] to [0]\n    end\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\nset [invulnerable v] to [0]\nset [speed x v] to [0]\nset [speed y v] to [0]\nset [falling v] to [99]\nset [wall slide v] to [0]\nset [jumping v] to [0]\nset [long jump 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 - Platforms v)\n    broadcast (Tick - Player v)\n    broadcast (Tick - Last v)\nend\n\nwhen I receive [tick - last v]\nif <(x position) > [230]> then\n    Begin Scene # ((SCENE #) + (1)) go to x, y: [-230] []\nend\nif <(x position) < [-230]> then\n    Begin Scene # ((SCENE #) - (1)) go to x, y: [230] []\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 Collisions in Direction [0]\nelse\n    Fix Collisions in Direction [90]\nend\nSet Costume\nbroadcast (Game Loop v)\n\ndefine Fix Collisions in Direction (dir)\nset [temp v] to (direction)\nset [distance v] to [1]\npoint in direction (dir)\nrepeat (200)\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\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) > [0]> then\n    if <(speed y) > [0]> then\n        switch costume to (jump01 v)\n    else\n        switch costume to (run_j2 v)\n    end\n    stop [this script v]\nend\nif <(frame) > [0]> then\n    switch costume to ((1) + ([floor v] of ((frame) mod (16)) ))\nelse\n    switch costume to (stand v)\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\nend\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 [Oops v]\nrepeat (10)\n    change [ghost v] effect by (10)\nend\nwait (0.5) seconds\nchange [lives v] by (-1)\nif <(LIVES) > [0]> then\n    Reset and Begin Level\nelse\n    broadcast (Game Over v)\nend\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 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\nFind Closest Space to (x position) (y position) max [100]\n\n@Level\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\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\nwhen flag clicked\ngo to x: (0) y: (0)\ngo to [back v] layer\n\nwhen I receive [change scene v]\nswitch costume to (join [Scene] (SCENE #))\nerase all\n\nswitch costume to (scene3 v)\nset [scene # v] to [3]\n\nStamp Shadow\nStamp Outline\n\nwhen flag clicked\nerase all\n\nset [scene # v] to [-99]\n\nset [scene # v] to [3]\n\n@Jump Through Platform\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\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\nwhen flag clicked\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 #))\nerase all\n\nswitch costume to (scene3 v)\nset [scene # v] to [3]\n\nStamp Shadow\nStamp Outline\n\nwhen flag clicked\nerase all\n\nset [scene # v] to [-99]\n\n@Enemy\n\nwhen flag clicked\nset rotation style [left-right v]\nhide\n\nwhen I receive [change scene v]\nif <(SCENE #) = [0]> then\n    Spawn [WobbleBob] at [40] [-23] dir [90]\nend\nif <(SCENE #) = [202]> then\n    Spawn [WobbleBob] at [94] [34] 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 (enemy3 v)\n    set rotation style [don't rotate v]\n    Move - Left and Right\n    Move - Down\n    change [frame v] by (0.3)\n    switch costume to ((1) + (([floor v] of (frame) ) mod (8)))\n    set rotation style [left-right v]\n    if <<touching (player v)?> and <(INVULNERABLE) = [0]>> 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)?> or <touching (jump through platform v)?>>>\n    change y by (1)\n    set [speed y v] to [0]\nend\n\ndefine Move - Left and Right\nmove (1) 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            if <not <touching (jump through platform v)?>> then\n                stop [this script v]\n            end\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]) < [-3]> then\n    broadcast (Player Bounce v)\n    start sound [Squawk v]\n    switch costume to (enemy 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\nif <([x position v] of [player v]) < [0]> then\n    Spawn [WobbleBob] at [94] [34] dir [-90]\nelse\n    Spawn [WobbleBob] at [94] [34] dir [-90]\nend\n\n@Danger\n\nwhen flag clicked\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 #) = [302]> then\n    forever\n        set y to ((10) * ([sin v] of ((timer) * (100)) ))\n    end\nend\n\n@Platform\n\nwhen I receive [change scene v]\nhide\nif <(SCENE #) = [302]> then\n    Spawn [costume5] at [-82] [-116] dir [90] turn []\nend\nif <(SCENE #) = [102]> then\n    Spawn [costume4] at [164] [-113] dir [90] turn []\nend\nif <(SCENE #) = [301]> then\n    Spawn [costume2] at [154] [-30] dir [90] turn []\nend\nif <(SCENE #) = [3]> then\n    Spawn [costume3] at [46] [-112] dir [90] turn []\nend\nif <(SCENE #) = [304]> then\n    Spawn [Key 1] at [-175] [-86] dir [0] turn []\nend\nif <(SCENE #) = [-2]> then\n    Spawn [Rota] at [-50] [-180] dir [90] turn [-2]\n    Spawn [Rota2] at [30] [-50] dir [90] turn [2]\n    Spawn [Rota3] at [130] [20] dir [90] turn [5]\nend\nif <(SCENE #) = [-1]> then\n    Spawn [Rota4] at [-100] [0] dir [90] turn [1]\nend\nif <(SCENE #) = [2]> then\n    Spawn [Key 2] at [-200] [-23] dir [0] turn []\nend\n\ndefine Animate Platform\nswitch costume to (costume1 v)\ngo to x: (-82) y: (-116)\nshow\nwait (1) seconds\nforever\n    glide (1.6) secs to x: (-82) y: (0)\n    wait (0.5) seconds\n    glide (2.8) secs to x: (115) y: (-116)\n    glide (6) secs to x: (-82) y: (-116)\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 <(turn) > []> then\n    change y by (4)\n    if <touching (player v)?> then\n        Rotation Maths CCW (() - (turn))\n    end\nelse\n    if <(new y) > (y position)> 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 Animate 2\nswitch costume to (costume1 v)\ngo to x: (164) y: (-113)\nshow\nforever\n    glide (4) secs to x: (164) y: (60)\n    glide (4) secs to x: (164) y: (-113)\nend\n\ndefine Animate 3\nswitch costume to (costume2 v)\ngo to x: (154) y: (-30)\nshow\nforever\n    glide (2) secs to x: (14) y: (-30)\n    glide (2) secs to x: (154) y: (-30)\nend\n\ndefine Animate 4\nswitch costume to (costume1 v)\ngo to x: (46) y: (-112)\nshow\nforever\n    set size to (100) %\n    glide (2) secs to x: (46) y: (0)\n    glide (2) secs to x: (-150) y: (0)\n    glide (1) secs to x: (-150) y: (-112)\n    wait (1) seconds\n    glide (1) secs to x: (-150) y: (0)\n    glide (4) secs to x: (170) y: (0)\n    glide (4) secs to x: (170) y: (110)\n    wait (1) seconds\n    glide (1) secs to x: (250) y: (110)\n    wait (1) seconds\n    go to x: (46) y: (-112)\nend\n\nrepeat (10)\n    change size by (-10)\nend\nhide\nwait (3) seconds\nset size to (100) %\nshow\n\nwhen flag clicked\ngo to [back v] layer\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 (18)\n            change y by (4)\n        end\n        wait (1) seconds\n        start sound [Buzz Whir v]\n        repeat (18)\n            change y by (-4)\n        end\n        start sound [Crunch v]\n    else\n        start sound [Low Squeak v]\n        wait until <not <touching (player v)?>>\n    end\nend\n\ndefine Animate 5\nshow\nswitch costume to (costume1 v)\npoint in direction (90)\nforever\n    glide (1) secs to x: (x position) y: ((y position) - (155))\n    wait (0.5) seconds\n    glide (1) secs to x: (x position) y: ((y position) + (155))\n    wait (0.5) seconds\nend\n\nset size to (100) %\nglide (2) secs to x: (46) y: (0)\nglide (2) secs to x: (-150) y: (0)\nglide (1) secs to x: (-150) y: (-112)\nwait (1) seconds\nglide (1) secs to x: (-150) y: (0)\nglide (4) secs to x: (170) y: (0)\nglide (4) secs to x: (170) y: (110)\nwait (1) seconds\nglide (1) secs to x: (250) y: (110)\nwait (1) seconds\ngo to x: (46) y: (-112)\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 (degrees)\nset [turn v] to (degrees)\ngo to x: (x) y: (y)\npoint in direction (dir)\nswitch costume to (type)\ncreate clone of (_myself_ v)\n\nwhen I start as a clone\nshow\ngo to [back v] layer\nif < (costume [name v]) contains [Key]?> then\n    Door at (x position) (y position) key (costume [name v])\nend\nif <(costume [name v]) = [costume1]> then\n    Animate 5\nend\nif <(costume [name v]) = [costume2]> then\n    Animate 3\nend\nif <(costume [name v]) = [costume3]> then\n    Animate 4\nend\nif <(costume [name v]) = [costume4]> then\n    Animate 2\nend\nif <(costume [name v]) = [costume5]> then\n    Animate Platform\nend\nif <(turn) > []> then\n    set rotation style [all around v]\n    forever\n        turn right (turn) degrees\n    end\nend\n\nglide (1) secs to x: (x position) y: ((y position) + (155))\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\nif <(SCENE #) = [-98]> then\n    Spawn [Rota3] at [-70] [-100] dir [90] turn [15]\nend\nif <(SCENE #) = [-98]> then\n    Spawn [Rota3] at [15] [-80] dir [90] turn [15]\nend\nif <(SCENE #) = [-98]> then\n    Spawn [Rota3] at [100] [-60] dir [90] turn [15]\nend\nif <(SCENE #) = [-98]> then\n    Spawn [Rota3] at [185] [-40] dir [90] turn [15]\nend\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]) = [bananas]> then\n    start sound [Bite v]\n    change [bananas v] by (1)\nelse\n    if <(costume [name v]) = [Yellow Flag]> then\n        start sound [Car Horn v]\n        set [spawn scene v] to (SCENE #)\n        set [spawn x v] to (x position)\n        set [spawn y v] to (y position)\n    else\n        start sound [Wand v]\n        add (costume [name v]) to [collected v]\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 [bananas v] to [0]\nhide\nPlace [bananas] scene [1] xy [-99] [-37]\nPlace [bananas] scene [1] xy [-195] [36]\nPlace [bananas] scene [1] xy [-99] [115]\nPlace [bananas] scene [102] xy [45] [42]\nPlace [bananas] scene [202] xy [-95] [-70]\nPlace [bananas] scene [302] xy [-80] [0]\nPlace [bananas] scene [302] xy [-80] [-55]\nPlace [Key 1] scene [304] xy [140] [10]\nPlace [Yellow Flag] scene [101] xy [-65] [-80]\nPlace [Yellow Flag] scene [301] xy [-93] [15]\nPlace [Yellow Flag] scene [304] xy [-89] [-56]\nPlace [Yellow Flag] scene [97] xy [-80] [-140]\nPlace [Key 2] scene [-102] xy [20] [70]\nPlace [bananas] scene [-3] xy [22.5] [150]\nPlace [bananas] scene [-3] xy [22.5] [100]\nPlace [bananas] scene [-3] xy [22.5] [50]\nPlace [bananas] scene [-3] xy [22.5] [0]\nPlace [bananas] scene [-3] xy [22.5] [-50]\nPlace [bananas] scene [-3] xy [22.5] [-100]\nPlace [bananas] scene [-3] xy [22.5] [-150]\nPlace [bananas] scene [-103] xy [210] [90]\nPlace [bananas] scene [-98] xy [50] [-50]\nPlace [bananas] scene [-98] xy [80] [-20]\nPlace [bananas] scene [-98] xy [110] [10]\nPlace [bananas] scene [-98] xy [80] [40]\nPlace [bananas] scene [-98] xy [50] [70]\nPlace [bananas] scene [-98] xy [20] [40]\nPlace [bananas] scene [-98] xy [-10] [10]\nPlace [bananas] scene [-98] xy [20] [-20]\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\nwhen flag clicked\nhide variable [bananas v]\n\n@Splash Screen\n\nwhen flag clicked\ngo to x: (0) y: (0)\nswitch costume to (main menu v)\ngo to [front v] layer\nshow\n\nwhen I receive [game over v]\ngo to x: (0) y: (0)\nswitch costume to (game over v)\ngo to [front v] layer\nshow\nbroadcast (Main Menu v)\n\nwhen I receive [start game v]\nhide\n\n@Main Menu\n\nwhen I receive [main menu v]\nwait (0.1) seconds\nset size to (10) %\ngo to [front v] layer\nshow\ngo to x: (0) y: (-90)\nforever\n    if <touching (mouse-pointer v)?> then\n        change size by ((0.2) * ((110) - (size)))\n    else\n        change size by ((0.2) * ((100) - (size)))\n    end\nend\n\nwhen flag clicked\nhide\n\nwhen this sprite clicked\nhide\nbroadcast (Start Game v)\n\n@Lives\n\nwhen flag clicked\nset size to (80) %\nhide\ngo to x: (-220) y: (160)\nset [number v] to [1]\nrepeat (3)\n    create clone of (_myself_ v)\n    change [number v] by (1)\n    change x by (30)\nend\n\nwhen I start as a clone\nshow\nset [ghost v] to [0]\nforever\n    if <(LIVES) < (number)> then\n        change [ghost v] by ((0.2) * ((100) - (ghost)))\n    else\n        change [ghost v] by ((0.2) * ((0) - (ghost)))\n    end\n    set [ghost v] effect to (ghost)\nend\n\n@THUMBNAIL\n\nwhen flag clicked\nforever\n    hide\n    go to x: (0) y: (0)\n    set [ghost v] effect to (100)\n    go to [front v] layer\nend\n\n@Numbers\n\nwhen flag clicked\nsetup\n\nwhen I start as a clone\nshow\nforever\n    change costume to (letter (index) of (BANANAS))\n    set x to ((((index) - (0.5)) * ((size) / (1.8))) - (144))\n    change size by ((0.2) * ((20) - (size)))\nend\n\ndefine setup\nset [bananas v] to [4501]\nhide\nswitch costume to (0 v)\nset size to (50) %\ngo to x: (0) y: (130)\nset [index v] to [1]\nrepeat (6)\n    create clone of (_myself_ v)\n    change x by ((size) / (1.8))\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 (30) %\nend\n\nchange [bananas v] by (1)\n\n@Sprite1\n\n@Safe Zones\n\nwhen flag clicked\ngo to x: (0) y: (0)\ngo to [back v] layer\nset [ghost v] effect to (100)\n\nwhen I receive [change scene v]\nswitch costume to (blank v)\nswitch costume to (join [Scene] (SCENE #))\nif <(SCENE #) = [302]> then\n    forever\n        set y to ((10) * ([sin v] of ((timer) * (100)) ))\n    end\nend\n\n