Ancient Egyptian Platformer


@Stage\n\nwhen flag clicked\nset [started? v] to [0]\nset [brightness v] effect to (-100)\nswitch backdrop to (one v)\nrepeat (5)\n    repeat (20)\n        change [brightness v] effect by (5)\n    end\n    wait (5) seconds\n    repeat (20)\n        change [brightness v] effect by (-5)\n    end\n    next backdrop\nend\nbroadcast (start v)\nset [started? v] to [1]\nrepeat (20)\n    change [brightness v] effect by (5)\nend\n\nwhen [space v] key pressed\nif <(started?) = [0]> then\n    stop [other scripts in sprite v]\n    clear graphic effects\n    switch backdrop to (backdrop v)\n    broadcast (start v)\n    set [started? v] to [1]\n    set [brightness v] effect to (-100)\n    repeat (20)\n        change [brightness v] effect by (5)\n    end\nend\n\nwhen I receive [start v]\nforever\n    switch costume to (level)\nend\n\nwhen I receive [game over v]\nstop [other scripts in sprite v]\nset [brightness v] effect to (0)\nrepeat (20)\n    change [brightness v] effect by (-5)\nend\nswitch backdrop to (game over v)\nrepeat (20)\n    change [brightness v] effect by (5)\nend\nset [started? v] to [0]\nset [music started? v] to [0]\n\nwhen I receive [win v]\nstop [other scripts in sprite v]\nset [brightness v] effect to (0)\nrepeat (20)\n    change [brightness v] effect by (5)\nend\n\nwhen I receive [win done v]\nswitch backdrop to (win v)\nset [brightness v] effect to (100)\nrepeat (20)\n    change [brightness v] effect by (-5)\nend\nset [started? v] to [0]\nset [music started? v] to [0]\n\nwhen stage clicked\nif <(started?) = [0]> then\n    stop [other scripts in sprite v]\n    clear graphic effects\n    switch backdrop to (backdrop v)\n    broadcast (start v)\n    set [started? v] to [1]\n    set [brightness v] effect to (-100)\n    repeat (20)\n        change [brightness v] effect by (5)\n    end\nend\n\n@thumbnail\n\nwhen flag clicked\nset [ghost v] effect to (100)\ngo to [front v] layer\nshow\n\nwhen I receive [start v]\nforever\n    if <(music started?) = [0]> then\n        play sound [music v] until done\n    end\nend\n\nwhen flag clicked\nset [music started? v] to [1]\nset volume to (100) %\nforever\n    play sound [music v] until done\nend\n\nwhen [m v] key pressed\nbroadcast (mute/unmute v)\n\nwhen I receive [mute/unmute v]\nif <(volume) = [0]> then\n    set volume to (100) %\nelse\n    set volume to (0) %\nend\n\n@player\n\nwhen flag clicked\nhide\nswitch costume to (still v)\nset size to (40) %\n\nwhen I receive [start v]\nhide\nclear graphic effects\nswitch costume to (still v)\nset size to (40) %\ngo to x: (-210) y: (180)\nshow\n\nwhen I receive [start v]\nset [y velocity v] to [0]\nforever\n    set [current costume v] to (costume [name v])\n    switch costume to (hitbox v)\n    change [y velocity v] by (-0.5)\n    change y by (y velocity)\n    if <(x velocity) < [0]> then\n        change [x velocity v] by (0.5)\n    end\n    if <(x velocity) > [0]> then\n        change [x velocity v] by (-0.5)\n    end\n    detect wall\n    detect platform <(y velocity) > [0]>\n    switch costume to (current costume)\nend\n\ndefine detect platform <up?>\nchange [falling? v] by (1)\nif <<up?> and <touching (platform v)?>> then\n    set [y velocity v] to ((y velocity) * (-1))\nelse\n    repeat until <not <touching (platform v)?>>\n        change y by (0.5)\n        set [y velocity v] to [0]\n        set [falling? v] to [0]\n    end\nend\n\nwhen I receive [start v]\nforever\n    if <<<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <<mouse down?> and <(mouse y) > ((y position) + (5))>>> and <(falling?) = [0]>> then\n        set [y velocity v] to [7]\n    end\nend\n\nwhen I receive [start v]\nforever\n    if <<<key (right arrow v) pressed?> or <key (d v) pressed?>> or <<mouse down?> and <(mouse x) > ((x position) + (5))>>> then\n        set [x velocity v] to [5]\n        point in direction (90)\n    end\nend\n\nwhen I receive [start v]\nforever\n    if <<<key (left arrow v) pressed?> or <key (a v) pressed?>> or <<mouse down?> and <(mouse x) < ((x position) - (5))>>> then\n        set [x velocity v] to [-5]\n        point in direction (-90)\n    end\nend\n\ndefine detect wall\nchange x by (x velocity)\nchange y by (1)\nif <touching (platform v)?> then\n    change x by ((x velocity) * (-1))\nend\nchange y by (-1)\n\nwhen I receive [start v]\nforever\n    if <(y velocity) = [0]> then\n        if <(falling?) = [0]> then\n            if <(x velocity) = [0]> then\n                switch costume to (1 v)\n            else\n                if <(costume [name v]) = [5]> then\n                    switch costume to (1 v)\n                else\n                    next costume\n                    wait (0.001) seconds\n                end\n            end\n        end\n    else\n        switch costume to (falling v)\n    end\nend\n\nwhen flag clicked\nset rotation style [left-right v]\n\nwhen I receive [start v]\nforever\n    if <<(x position) = [240]> and <not <(level) = [12]>>> then\n        change [level v] by (1)\n        go to x: (-210) y: (180)\n        set [x velocity v] to [0]\n        set [y velocity v] to [0]\n    end\nend\n\nwhen I receive [start v]\nforever\n    if <<(y position) < [-180]> or <(y position) = [-180]>> then\n        go to x: (-210) y: (180)\n        set [x velocity v] to [0]\n        set [y velocity v] to [0]\n    end\nend\n\nwhen I receive [start v]\nset rotation style [left-right v]\npoint in direction (90)\n\nwhen I receive [win v]\nstop [other scripts in sprite v]\nswitch costume to (1 v)\nset [brightness v] effect to (0)\nrepeat (20)\n    change [brightness v] effect by (5)\nend\nhide\n\nwhen I receive [game over v]\nstop [other scripts in sprite v]\nswitch costume to (1 v)\nset [brightness v] effect to (0)\nrepeat (20)\n    change [brightness v] effect by (-5)\nend\nhide\n\nwhen I receive [start v]\nforever\n    if <touching (fire v)?> then\n        if <(level) = [12]> then\n            go to x: (-210) y: (180)\n            change [health v] by (-1)\n            set [x velocity v] to [0]\n            set [y velocity v] to [0]\n        else\n            go to x: (-210) y: (180)\n            set [x velocity v] to [0]\n            set [y velocity v] to [0]\n        end\n    end\nend\n\nwhen I receive [start v]\nforever\n    if <<(level) = [12]> and <touching (larrick v)?>> then\n        go to x: (-210) y: (180)\n        change [health v] by (-1)\n        set [x velocity v] to [0]\n        set [y velocity v] to [0]\n    end\nend\n\nwhen this sprite clicked\nbroadcast (mute/unmute v)\n\n@platform\n\nwhen flag clicked\nhide\ngo to x: (0) y: (0)\n\nwhen I receive [start v]\nhide\ngo to x: (0) y: (0)\nset [brightness v] effect to (-100)\nshow\nrepeat (20)\n    change [brightness v] effect by (5)\nend\n\nwhen I receive [start v]\nforever\n    switch costume to (level)\nend\n\nwhen I receive [win v]\nstop [other scripts in sprite v]\nset [brightness v] effect to (0)\nrepeat (20)\n    change [brightness v] effect by (5)\nend\nhide\n\nwhen I receive [game over v]\nstop [other scripts in sprite v]\nset [brightness v] effect to (0)\nrepeat (20)\n    change [brightness v] effect by (-5)\nend\nhide\n\n@fire\n\nwhen flag clicked\nhide\ngo to x: (0) y: (0)\n\nwhen I receive [start v]\nforever\n    if <(level) = [12]> then\n        hide\n    else\n        if <(letter (length of (costume [name v])) of (costume [name v])) = [1]> then\n            switch costume to (join (level) [2])\n        else\n            switch costume to (join (level) [1])\n        end\n        wait (0.1) seconds\n    end\nend\n\nwhen I receive [start v]\nhide\ngo to x: (0) y: (0)\nclear graphic effects\nshow\n\nwhen I start as a clone\nswitch costume to (01 v)\ngo to (larrick v)\nshow\nrepeat until <<touching (_edge_ v)?> or <(pick random (1) to (100)) = [1]>>\n    change x by (-5)\nend\nrepeat until <<touching (platform v)?> or <touching (_edge_ v)?>>\n    change y by (-10)\nend\nrepeat (30)\n    if <(letter (length of (costume [name v])) of (costume [name v])) = [1]> then\n        switch costume to (02 v)\n    else\n        switch costume to (01 v)\n    end\n    wait (0.1) seconds\nend\ndelete this clone\n\nwhen I receive [game over v]\ndelete this clone\n\nwhen I receive [win v]\ndelete this clone\n\nwhen I receive [win v]\nstop [other scripts in sprite v]\nset [brightness v] effect to (0)\nrepeat (20)\n    change [brightness v] effect by (5)\nend\nhide\ndelete this clone\n\nwhen I receive [game over v]\nstop [other scripts in sprite v]\nset [brightness v] effect to (0)\nrepeat (20)\n    change [brightness v] effect by (-5)\nend\nhide\ndelete this clone\n\n@scarab\n\nwhen flag clicked\nset [scarab? v] to [0]\n\nwhen flag clicked\nhide\nset size to (100) %\nclear graphic effects\n\nwhen I receive [start v]\nforever\n    if <(level) = [7]> then\n        go to x: (115) y: (90)\n        show\n        wait until <touching (player v)?>\n        set [brightness v] effect to (0)\n        repeat (10)\n            change [brightness v] effect by (-10)\n        end\n        hide\n        set [scarab? v] to [1]\n        stop [this script v]\n    end\nend\n\nwhen I receive [start v]\nforever\n    if <(level) > [7]> then\n        hide\n        stop [other scripts in sprite v]\n        stop [this script v]\n    end\nend\n\nwhen I receive [start v]\nhide\nset size to (100) %\nclear graphic effects\n\nwhen I receive [start v]\nset [scarab? v] to [0]\n\nwhen I receive [win v]\nset [brightness v] effect to (0)\nstop [other scripts in sprite v]\ngo to (player v)\nset size to (100) %\nshow\nglide (2) secs to x: (0) y: (0)\nrepeat (20)\n    change size by (10)\nend\nwait (1) seconds\nrepeat (20)\n    change [brightness v] effect by (5)\nend\nhide\nbroadcast (win done v)\n\n@Larrick\n\nwhen flag clicked\ngo to x: (150) y: (0)\nhide\n\nwhen I receive [start v]\nclear graphic effects\nset [level v] to [1]\nset [health v] to [5]\ngo to x: (150) y: (0)\nhide\nforever\n    if <(level) = [12]> then\n        show\n        go to [front v] layer\n        reset timer\n        repeat until <<<(timer) = [30]> or <(timer) > [30]>> or <<(health) = [0]> or <(health) < [0]>>>\n            switch costume to (larrick v)\n            glide (pick random (1) to (3)) secs to x: (x position) y: (pick random (-125) to (130))\n            create clone of (fire v)\n        end\n        if <<(health) = [0]> or <(health) < [0]>> then\n            broadcast (game over v)\n        else\n            if <(scarab?) = [0]> then\n                repeat until <<(health) = [0]> or <(health) < [0]>>\n                    switch costume to (larrick v)\n                    glide (pick random (1) to (3)) secs to x: (150) y: (pick random (-125) to (130))\n                    create clone of (fire v)\n                end\n                broadcast (game over v)\n            else\n                broadcast (win v)\n            end\n        end\n    end\nend\n\nwhen I receive [win v]\nstop [other scripts in sprite v]\nset [brightness v] effect to (0)\nrepeat (20)\n    change [brightness v] effect by (5)\nend\nhide\n\nwhen I receive [game over v]\nstop [other scripts in sprite v]\nset [brightness v] effect to (0)\nrepeat (20)\n    change [brightness v] effect by (-5)\nend\nhide\n\nwhen flag clicked\nset [level v] to [1]\n\n