Chain Mail (Platformer)


@Stage\n\nwhen flag clicked\nset volume to (100) %\nset [level v] to [1]\nset [boss hp v] to [6]\nset [hp v] to [6]\n\nwhen I receive [start game v]\nforever\n    play sound [Hero's Quest v] until done\nend\n\nset [hp v] to [6]\n\nwhen I receive [boss defeated v]\nstop [other scripts in sprite v]\nforever\n    play sound [Hero's Quest v] until done\nend\n\nwhen I receive [boss 1 v]\nstop [other scripts in sprite v]\nbroadcast (Boss Tune v)\n\nwhen I receive [boss tune v]\nforever\n    play sound [Skill Against Might  v] until done\nend\n\nwhen I receive [boss tune v]\nforever\n    play sound [Skill against Might 2 v] until done\nend\n\nwhen I receive [boss 2 v]\nstop [other scripts in sprite v]\nbroadcast (Boss Tune v)\n\nwhen I receive [volume v]\nset volume to ((100) * (Volume)) %\n\n@Knight\n\nwhen I receive [start game v]\nswitch costume to (wall v)\ncreate clone of (_myself_ v)\nswitch costume to (roof v)\ncreate clone of (_myself_ v)\nswitch costume to (hitbox v)\ncreate clone of (_myself_ v)\nswitch costume to (rest v)\ngo to x: (-175) y: (-147)\npoint in direction (90)\nset [jump v] to [0]\nset [attack v] to [0]\nset [jumping v] to [0]\nset [blocking v] to [0]\nset [touching ground v] to [1]\n\nwhen I receive [start game v]\nset [stunned v] to [0]\nset [playerattack v] to [0]\nset rotation style [left-right v]\nwait (0.8) seconds\nforever\n    if <(damaged) = [0]> then\n        if <<(stunned) = [0]> and <<(blocking) = [0]> and <<(attack) = [0]> and <<color (#a59b6b) is touching (#cca797)?> or <color (#78714e) is touching (#cca797)?>>>>> then\n            if <<not < or <<key (space v) pressed?> or <mouse down?>>>> and <<key (w v) pressed?> or <key (up arrow v) pressed?>>> then\n                set [jump v] to [1]\n                set [at what y v] to (y position)\n                repeat (10)\n                    if <(roof) = [0]> then\n                        change y by (5)\n                    end\n                end\n                repeat until <<(jump) = [0]> or <<<color (#a59b6b) is touching (#cca797)?> or <color (#78714e) is touching (#cca797)?>> or <<(y position) > ((at what y) + (70))> or <(roof) = [1]>>>>\n                    if <(roof) = [0]> then\n                        change y by (5)\n                    end\n                end\n                set [jumping v] to [1]\n                set [touching ground v] to [1]\n                set [jump v] to [0]\n                wait until <<color (#a59b6b) is touching (#cca797)?> or <color (#78714e) is touching (#cca797)?>>\n                set [jumping v] to [0]\n                switch costume to (rest v)\n            end\n        end\n    end\nend\n\nwhen I receive [start game v]\nset rotation style [left-right v]\nforever\n    if <(damaged) = [0]> then\n        if <<(blocking) = [0]> and <(attack) = [0]>> then\n            if <<(stunned) = [0]> and <<not > and <<key (left arrow v) pressed?> or <key (a v) pressed?>>>> then\n                point in direction (-90)\n                if <(Touching Wall) = [0]> then\n                    change x by (-4)\n                end\n                if <(jumping) = [0]> then\n                    set [walk v] to [1]\n                end\n            else\n                if <<(stunned) = [0]> and <<not > and <<key (right arrow v) pressed?> or <key (d v) pressed?>>>> then\n                    point in direction (90)\n                    if <(Touching Wall) = [0]> then\n                        change x by (4)\n                    end\n                    if <(jumping) = [0]> then\n                        set [walk v] to [1]\n                    end\n                else\n                    set [walk v] to [0]\n                end\n            end\n        end\n    end\nend\n\nwhen I receive [start game v]\nforever\n    if <<(walk) = [1]> and <<<color (#a59b6b) is touching (#cca797)?> or <color (#78714e) is touching (#cca797)?>> and <<(blocking) = [0]> and <(attack) = [0]>>>> then\n        if <<(walk) = [1]> and <<<color (#a59b6b) is touching (#cca797)?> or <color (#78714e) is touching (#cca797)?>> and <<(blocking) = [0]> and <(attack) = [0]>>>> then\n            switch costume to (walk v)\n            wait (0.15) seconds\n        end\n        if <<(walk) = [1]> and <<<color (#a59b6b) is touching (#cca797)?> or <color (#78714e) is touching (#cca797)?>> and <<(blocking) = [0]> and <(attack) = [0]>>>> then\n            switch costume to (rest v)\n            wait (0.15) seconds\n        end\n        if <<(walk) = [1]> and <<<color (#a59b6b) is touching (#cca797)?> or <color (#78714e) is touching (#cca797)?>> and <<(blocking) = [0]> and <(attack) = [0]>>>> then\n            switch costume to (walk2 v)\n            wait (0.15) seconds\n        end\n        if <<(walk) = [1]> and <<<color (#a59b6b) is touching (#cca797)?> or <color (#78714e) is touching (#cca797)?>> and <<(blocking) = [0]> and <(attack) = [0]>>>> then\n            switch costume to (rest v)\n            wait (0.15) seconds\n        end\n    end\nend\n\nwhen I start as a clone\nif <(costume [name v]) = [Wall]> then\n    forever\n        if <<<touching color (#8f555f)?> = [true]> or <<touching color (#a1616b)?> = [true]>> then\n            set [touching wall v] to [1]\n        else\n            set [touching wall v] to [0]\n        end\n    end\nelse\n    if <(costume [name v]) = [Roof]> then\n        forever\n            if <touching color (#af8f81)?> then\n                set [roof v] to [1]\n            else\n                set [roof v] to [0]\n            end\n        end\n    else\n        if <(costume [name v]) = [Hitbox]> then\n            forever\n                if <touching (spikes v)?> then\n                    broadcast (Damaged v)\n                    wait until <(damaged) = [0]>\n                end\n                if <<(Enemy Attacking) = [2]> and <touching (boss 2 v)?>> then\n                    broadcast (Damaged v)\n                    wait until <(damaged) = [0]>\n                end\n                if <<(Enemy Attacking) = [3]> and <<<touching color (#b79582)?> or <<touching color (#8acbde)?> or <touching color (#9ee8ff)?>>> and <touching (boss 2 v)?>>> then\n                    if <(Player Block) = [0]> then\n                        broadcast (Damaged v)\n                        wait until <(damaged) = [0]>\n                    else\n                        if <(Stamina) > [3]> then\n                            change [stamina v] by (-3)\n                            wait until <(enemy attack) = [0]>\n                            wait (0.1) seconds\n                        else\n                            change [stamina v] by (-3)\n                            set [stunned v] to [1]\n                            wait until <(enemy attack) = [0]>\n                            wait (0.1) seconds\n                        end\n                    end\n                end\n                if <<touching (arrow v)?> or <<<<(enemy2attack) = [1]> and <touching (enemy2 v)?>> and <touching color (#d8d8d8)?>> or <<<(Enemy Attacking) = [1]> and <touching (enemy v)?>> and <touching color (#d8d8d8)?>>>> then\n                    if <(Player Block) = [0]> then\n                        broadcast (Damaged v)\n                        wait until <(damaged) = [0]>\n                    else\n                        if <touching (arrow v)?> then\n                            broadcast (Block v)\n                        end\n                        if <(Stamina) > [1]> then\n                            change [stamina v] by (-1)\n                            wait until <(enemy attack) = [0]>\n                            wait (0.1) seconds\n                        else\n                            change [stamina v] by (-1)\n                            set [stunned v] to [1]\n                            wait until <(enemy attack) = [0]>\n                            wait (0.1) seconds\n                        end\n                    end\n                end\n                if <<(Enemy Punch) = [1]> and <touching (mini goblin v)?>> then\n                    if <(Player Block) = [0]> then\n                        broadcast (Move v)\n                    else\n                        if <(Stamina) > [1]> then\n                            change [stamina v] by (-1)\n                            broadcast (Small Move v)\n                            wait until <(Enemy Punch) = [0]>\n                            wait (0.1) seconds\n                        else\n                            change [stamina v] by (-1)\n                            set [stunned v] to [1]\n                            broadcast (Small Move v)\n                            wait until <(Enemy Punch) = [0]>\n                            wait (0.1) seconds\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\n\nif <(Touching Ground) = [1]> then\nend\nif <(Touching Ground) = [0]> then\n    if <<(Touching Ground) = [0]> and <touching (levels v)?>> then\n        set [touching wall v] to [1]\n    else\n        set [touching wall v] to [0]\n    end\nend\n\nwhen I start as a clone\nshow\nset [ghost v] effect to (100)\nset rotation style [left-right v]\nforever\n    go to (knight v)\nend\n\nwhen I receive [start game v]\nforever\n    if <(stunned) = [1]> then\n        set [player block v] to [0]\n        set [blocking v] to [0]\n        set [attack v] to [0]\n        set [playerattack v] to [0]\n        set [walk v] to [0]\n        if <(stunned) = [1]> then\n            switch costume to (stunned v)\n            wait (0.1) seconds\n        end\n        if <(stunned) = [1]> then\n            switch costume to (stunned2 v)\n            wait (0.1) seconds\n        end\n    else\n        if <<(blocking) = [0]> and <<(jump) = [0]> and <<<color (#a59b6b) is touching (#cca797)?> or <color (#78714e) is touching (#cca797)?>> and <<(attack) = [0]> and <(walk) = [0]>>>>> then\n            switch costume to (rest v)\n        else\n            if <(jump) = [1]> then\n                switch costume to (jump v)\n            end\n            if <<(jump) = [0]> and <not <<<color (#a59b6b) is touching (#cca797)?> or <color (#78714e) is touching (#cca797)?>> or <(Touching Ground) = [1]>>>> then\n                switch costume to (jump2 v)\n            end\n        end\n    end\nend\n\nwhen I start as a clone\nforever\n    point in direction ([direction v] of [knight v])\nend\n\nwhen I receive [next level v]\nset x to (-230)\nset [y position v] to (y position)\n\nwhen I receive [start game v]\nset [hp v] to [6]\nset [damaged v] to [0]\nshow\nforever\n    if <(x position) > [220]> then\n        change [level v] by (1)\n        broadcast (Next Level v)\n        wait (0.5) seconds\n    end\nend\n\nwhen I receive [damaged v]\nif <(damaged) = [0]> then\n    change [hp v] by (-1)\nend\nset [damaged v] to [1]\nbroadcast (HP Bar v)\nif <[1] > (HP)> then\n    stop [other scripts in sprite v]\n    switch costume to (defeated v)\n    repeat (2)\n        change [brightness v] effect by (10)\n        hide\n        wait (0.1) seconds\n        show\n        wait (0.1) seconds\n    end\n    repeat (8)\n        change [brightness v] effect by (10)\n        next costume\n        wait (0.01) seconds\n    end\n    hide\nelse\n    go to x: (-230) y: (Y position)\n    broadcast (Crunch v)\n    hide\n    wait (0.1) seconds\n    show\n    wait (0.1) seconds\n    hide\n    wait (0.1) seconds\n    show\n    wait (0.1) seconds\n    set [damaged v] to [0]\nend\n\nwhen I receive [start game v]\nclear graphic effects\n\nwhen I receive [small move v]\nif <<(x position) = (EnemyX2)> or <(EnemyX2) > (x position)>> then\n    change x by (-5)\nelse\n    change x by (5)\nend\n\nwhen I receive [move v]\nif <<(x position) = (EnemyX2)> or <(EnemyX2) > (x position)>> then\n    change x by (-10)\nelse\n    change x by (10)\nend\n\nwhen I receive [start game v]\nwait (0.8) seconds\nforever\n    if <(damaged) = [0]> then\n        if <<(stunned) = [0]> and <<(blocking) = [0]> and <<(attack) = [0]> and <<color (#a59b6b) is touching (#cca797)?> or <color (#78714e) is touching (#cca797)?>>>>> then\n            if <<(blocking) = [0]> and <<(attack) = [0]> and <(costume [name v]) = [Rest]>>> then\n                if <<<(stunned) = [0]> and <(Stamina) > [0]>> and <<not <<<<<key (s v) pressed?> or <key (z v) pressed?>> or <<key (left arrow v) pressed?> or <key (a v) pressed?>>> or <<key (w v) pressed?> or <key (up arrow v) pressed?>>> or <<key (right arrow v) pressed?> or <key (d v) pressed?>>>> and <<key (space v) pressed?> or <<<(1Sound) = [0]> and <(!Sound) = [0]>> and <mouse down?>>>>> then\n                    set [attack v] to [1]\n                    change [stamina v] by (-1)\n                    switch costume to (prepare v)\n                    wait (0.05) seconds\n                    switch costume to (attack6 v)\n                    wait (0.05) seconds\n                    switch costume to (attack v)\n                    repeat (2)\n                        wait (0.05) seconds\n                        next costume\n                    end\n                    set [playerattack v] to [1]\n                    broadcast (Whoosh v)\n                    repeat (2)\n                        wait (0.05) seconds\n                        next costume\n                    end\n                    wait (0.05) seconds\n                    switch costume to (prepare v)\n                    set [playerattack v] to [0]\n                    set [attack v] to [0]\n                end\n                if <<(blocking) = [0]> and <<(attack) = [0]> and <<color (#a59b6b) is touching (#cca797)?> or <color (#78714e) is touching (#cca797)?>>>> then\n                    if <<<<(stunned) = [0]> and <(Stamina) > [0]>> and <not <<< or <<key (w v) pressed?> or <key (up arrow v) pressed?>>> or <<key (right arrow v) pressed?> or <key (d v) pressed?>>> or <<key (space v) pressed?> or <mouse down?>>>>> and <<key (s v) pressed?> or <key (z v) pressed?>>> then\n                        set [blocking v] to [1]\n                        switch costume to (prepare v)\n                        wait (0.05) seconds\n                        switch costume to (block2 v)\n                        wait (0.05) seconds\n                        switch costume to (block3 v)\n                        set [player block v] to [1]\n                        wait until <<(stunned) = [1]> or <not <<key (s v) pressed?> or <key (z v) pressed?>>>>\n                        set [player block v] to [0]\n                        if <(stunned) = [0]> then\n                            wait (0.05) seconds\n                            switch costume to (block2 v)\n                            wait (0.05) seconds\n                            switch costume to (block v)\n                            wait (0.05) seconds\n                            switch costume to (prepare v)\n                            wait (0.05) seconds\n                        end\n                        set [blocking v] to [0]\n                    end\n                end\n            end\n        end\n    end\nend\n\nwhen I receive [start game v]\nforever\n    if <not <<<<color (#a59b6b) is touching (#af8f81)?> or <color (#78714e) is touching (#af8f81)?>> or <<color (#a59b6b) is touching (#cca797)?> or <color (#78714e) is touching (#cca797)?>>> or <(jump) = [1]>>> then\n        set [touching ground v] to [0]\n        change y by (-5)\n    end\nend\n\nwhen I receive [start game v]\nforever\n    if <<color (#a59b6b) is touching (#cca797)?> or <color (#78714e) is touching (#cca797)?>> then\n        set [touching ground v] to [1]\n    end\nend\n\nwhen I receive [start game v]\nforever\n    if <<color (#a59b6b) is touching (#af8f81)?> or <color (#78714e) is touching (#af8f81)?>> then\n        change y by (5)\n        set [touching ground v] to [1]\n    end\nend\n\n@Levels\n\nwhen I receive [start game v]\nset size to (100) %\ngo to [back v] layer\ngo to x: (0) y: (0)\nswitch costume to (costume1 v)\n\nwhen I receive [next level v]\nnext costume\n\n@Spikes\n\nwhen I receive [next level v]\nnext costume\n\nwhen I receive [start game v]\ngo to x: (0) y: (0)\nswitch costume to (costume2 v)\n\n@Enemy\n\nwhen flag clicked\nhide\n\nwhen I receive [next level v]\nif <(level) = [3]> then\n    go to x: (196) y: (-155)\n    create clone of (_myself_ v)\nend\nif <(level) = [4]> then\n    go to x: (52) y: (-155)\n    create clone of (_myself_ v)\nend\nif <(level) = [6]> then\n    go to x: (-133) y: (-40)\n    create clone of (_myself_ v)\nend\nif <(level) = [7]> then\n    go to x: (79) y: (-153)\n    create clone of (_myself_ v)\nend\nif <(level) = [8]> then\n    go to x: (79) y: (-153)\n    create clone of (_myself_ v)\nend\nif <(level) = [10]> then\n    go to x: (172) y: (-30)\n    create clone of (_myself_ v)\nend\nif <(level) = [11]> then\n    go to x: (179) y: (-11)\n    create clone of (_myself_ v)\nend\nif <(level) = [14]> then\n    go to x: (191) y: (-154)\n    create clone of (_myself_ v)\nend\nif <(level) = [15]> then\n    go to x: (66) y: (-38)\n    create clone of (_myself_ v)\nend\nif <(level) = [16]> then\n    go to x: (-98) y: (-120)\n    create clone of (_myself_ v)\nend\nif <(level) = [17]> then\n    go to x: (197) y: (-20)\n    create clone of (_myself_ v)\nend\n\nwhen I receive [next level v]\ndelete this clone\n\nwhen I start as a clone\nset [enemy attacking v] to [0]\nswitch costume to (rest v)\ngo to [front v] layer\nset size to (200) %\ncreate clone of (enemy hitbox v)\nshow\nset [enemy attack v] to [0]\nset [enemy walking v] to [0]\nset rotation style [left-right v]\nif <([x position v] of [knight v]) > (x position)> then\n    point in direction (90)\nelse\n    point in direction (-90)\nend\nforever\n    if <[200] > ([abs v] of ((x position) - ([x position v] of [knight v])) )> then\n        repeat until <<([abs v] of ((x position) - ([x position v] of [knight v])) ) > [200]> or <[30] > ([abs v] of ((x position) - ([x position v] of [knight v])) )>>\n            if <([x position v] of [knight v]) > (x position)> then\n                point in direction (90)\n            else\n                point in direction (-90)\n            end\n            if <(Enemy in Level) = [0]> then\n                move (3) steps\n                set [enemy walking v] to [1]\n            end\n        end\n        set [enemy walking v] to [0]\n        if <<[30] > ([abs v] of ((y position) - ([y position v] of [knight v])) )> and <[30] > ([abs v] of ((x position) - ([x position v] of [knight v])) )>> then\n            set [enemy walking v] to [0]\n            set [enemy attack v] to [1]\n            switch costume to (attack v)\n            wait (0.5) seconds\n            repeat (3)\n                next costume\n                wait (0.02) seconds\n            end\n            set [enemy attacking v] to [1]\n            broadcast (Whoosh v)\n            repeat (3)\n                next costume\n                wait (0.02) seconds\n            end\n            set [enemy attacking v] to [0]\n            set [enemy attack v] to [0]\n            if <<(blocking) = [1]> and <touching (knight v)?>> then\n                switch costume to (blocked v)\n                broadcast (Block v)\n                wait (0.01) seconds\n                switch costume to (blocked2 v)\n                wait (1.5) seconds\n            end\n            if <(enemy attack) = [0]> then\n                switch costume to (rest v)\n                wait (0.3) seconds\n            end\n        end\n        if <(enemy attack) = [0]> then\n            switch costume to (rest v)\n        end\n    end\nend\n\nwhen I start as a clone\nforever\n    set [enemy direction v] to (direction)\n    set [enemy x v] to (x position)\n    set [enemy y v] to (y position)\nend\n\nwhen I start as a clone\nforever\n    if <<(enemy attack) = [0]> and <(enemy walking) = [1]>> then\n        if <<(enemy attack) = [0]> and <(enemy walking) = [1]>> then\n            switch costume to (walk v)\n            wait (0.15) seconds\n        end\n        if <<(enemy attack) = [0]> and <(enemy walking) = [1]>> then\n            switch costume to (rest v)\n            wait (0.15) seconds\n        end\n        if <<(enemy attack) = [0]> and <(enemy walking) = [1]>> then\n            switch costume to (walk2 v)\n            wait (0.15) seconds\n        end\n        if <<(enemy attack) = [0]> and <(enemy walking) = [1]>> then\n            switch costume to (rest v)\n            wait (0.15) seconds\n        end\n    end\nend\n\nwhen I start as a clone\nclear graphic effects\nset [enemy hp v] to [3]\nforever\n    if <<(attack) = [1]> and <<touching color (#ffffff)?> and <<(PlayerAttack) > [0]> and <touching (knight v)?>>>> then\n        if <(enemy HP) > [1]> then\n            change [enemy hp v] by (-1)\n            repeat (10)\n                hide\n                wait (0.05) seconds\n                show\n                wait (0.05) seconds\n            end\n        else\n            stop [other scripts in sprite v]\n            switch costume to (defeated v)\n            repeat (2)\n                change [brightness v] effect by (10)\n                switch costume to (defeated v)\n                hide\n                wait (0.05) seconds\n                show\n                wait (0.05) seconds\n            end\n            repeat (8)\n                next costume\n                change [brightness v] effect by (10)\n                wait (0.01) seconds\n            end\n            delete this clone\n        end\n    end\nend\n\n@Button\n\nwhen flag clicked\nhide\n\nwhen I start as a clone\nset size to (200) %\ngo to [back v] layer\nshow\nswitch costume to (costume1 v)\nwait until <<(attack) = [1]> and <<touching color (#ffffff)?> and <<(PlayerAttack) > [0]> and <touching (knight v)?>>>>\nbroadcast (Block v)\nrepeat (3)\n    wait (0.01) seconds\n    next costume\nend\nbroadcast (Break Block v)\n\nwhen I receive [next level v]\ndelete this clone\n\nwhen I receive [next level v]\nif <(level) = [5]> then\n    point in direction (-90)\n    go to x: (205) y: (-127)\n    create clone of (_myself_ v)\nend\nif <(level) = [6]> then\n    go to x: (-206) y: (-135)\n    point in direction (90)\n    create clone of (_myself_ v)\nend\nif <(level) = [7]> then\n    go to x: (-203) y: (38)\n    point in direction (90)\n    create clone of (_myself_ v)\nend\nif <(level) = [8]> then\n    go to x: (-203) y: (120)\n    point in direction (90)\n    create clone of (_myself_ v)\nend\nif <(level) = [10]> then\n    go to x: (205) y: (-12)\n    point in direction (-90)\n    create clone of (_myself_ v)\nend\nif <(level) = [11]> then\n    point in direction (-90)\n    go to x: (206) y: (8)\n    create clone of (_myself_ v)\nend\nif <(level) = [13]> then\n    go to x: (205) y: (70)\n    point in direction (-90)\n    create clone of (_myself_ v)\nend\nif <(level) = [14]> then\n    go to x: (207) y: (115)\n    point in direction (-90)\n    create clone of (_myself_ v)\nend\nif <(level) = [15]> then\n    go to x: (-205) y: (-7)\n    point in direction (90)\n    create clone of (_myself_ v)\nend\nif <(level) = [16]> then\n    go to x: (206) y: (-54)\n    point in direction (-90)\n    create clone of (_myself_ v)\nend\nif <(level) = [17]> then\n    point in direction (90)\n    go to x: (-67) y: (110)\n    create clone of (_myself_ v)\nend\n\n@Boss 1\n\nwhen I receive [boss 1 v]\ncreate clone of (_myself_ v)\n\nwhen I start as a clone\nshow\ngo to x: (13) y: (128)\nset rotation style [left-right v]\nset [boss hp v] to [6]\nset [attacking v] to [0]\nset [ghost v] effect to (100)\nrepeat (10)\n    wait (0.1) seconds\n    change [ghost v] effect by (-10)\nend\nforever\n    wait (2) seconds\n    broadcast (Spikes v)\n    wait (5) seconds\n    if <(pick random (1) to (2)) = [1]> then\n        glide (1) secs to x: (-69) y: (32)\n    else\n        glide (1) secs to x: (71) y: (32)\n    end\n    wait until <(flying) = [0]>\n    set [attacking v] to [1]\n    wait (0.1) seconds\n    switch costume to (attack v)\n    repeat (3)\n        wait (0.1) seconds\n        next costume\n    end\n    set [firex v] to (x position)\n    set [firey v] to (y position)\n    broadcast (Laser v)\n    if <<([x position v] of [knight v]) = (x position)> or <([x position v] of [knight v]) > (x position)>> then\n        point in direction (90)\n    else\n        point in direction (-90)\n    end\n    wait (0.1) seconds\n    switch costume to (attack3 v)\n    wait (0.1) seconds\n    switch costume to (attack2 v)\n    wait (0.1) seconds\n    switch costume to (attack v)\n    wait (0.1) seconds\n    set [attacking v] to [0]\n    wait (5) seconds\n    glide (1) secs to x: (13) y: (128)\nend\n\nwhen I start as a clone\nset size to (200) %\nforever\n    if <not <(attacking) = [1]>> then\n        set [flying v] to [1]\n        switch costume to (rest v)\n        wait (0.1) seconds\n        switch costume to (rest2 v)\n        wait (0.1) seconds\n        switch costume to (rest v)\n        wait (0.1) seconds\n        switch costume to (rest3 v)\n        set [flying v] to [0]\n        wait (0.1) seconds\n    end\nend\n\nwhen flag clicked\nhide\n\nwhen I start as a clone\nwait (0.1) seconds\nforever\n    if <<(attack) = [1]> and <<touching color (#ffffff)?> and <<(PlayerAttack) > [0]> and <touching (knight v)?>>>> then\n        change [boss hp v] by (-1)\n        if <(Boss HP) > [0]> then\n            repeat (10)\n                hide\n                wait (0.05) seconds\n                show\n                wait (0.05) seconds\n            end\n        else\n            stop [other scripts in sprite v]\n            clear graphic effects\n            switch costume to (rest v)\n            show\n            repeat (10)\n                wait (0.05) seconds\n                hide\n                change [brightness v] effect by (10)\n                wait (0.05) seconds\n                show\n                wait (0.05) seconds\n                hide\n                wait (0.05) seconds\n                show\n            end\n            wait (0.05) seconds\n            switch costume to (defeated v)\n            repeat (11)\n                wait (0.05) seconds\n                next costume\n            end\n            wait (0.05) seconds\n            broadcast (Boss Defeated v)\n            delete this clone\n        end\n    end\nend\n\n@Enemy Hitbox\n\nwhen I start as a clone\nshow\nset [ghost v] effect to (100)\nset rotation style [left-right v]\nforever\n    go to x: (Enemy X) y: (Enemy Y)\nend\n\nwhen I start as a clone\nforever\n    point in direction (Enemy Direction)\nend\n\nwhen I receive [next level v]\ndelete this clone\n\nwhen flag clicked\nhide\n\nwhen I start as a clone\nforever\n    if <<not <touching (levels v)?>> or <<touching (spikes v)?> or <<touching color (#886468)?> or <<touching color (#a1616b)?> or <touching color (#935861)?>>>>> then\n        set [enemy in level v] to [1]\n    else\n        set [enemy in level v] to [0]\n    end\nend\n\n@Boss 1 Attack\n\nwhen I start as a clone\ngo to [front v] layer\nset size to (200) %\nshow\nif <(costume [number v]) = [3]> then\n    point towards (knight v)\n    set [ghost v] effect to (100)\n    switch costume to (costume1 v)\n    set [brightness v] effect to (100)\n    repeat (10)\n        change [brightness v] effect by (-10)\n        change [ghost v] effect by (-10)\n    end\n    wait (0.5) seconds\n    switch costume to (costume2 v)\n    wait (0.1) seconds\n    switch costume to (costume1 v)\n    repeat (3)\n        change [brightness v] effect by (30)\n        change [ghost v] effect by (30)\n    end\n    delete this clone\nelse\n    point in direction (90)\n    clear graphic effects\n    switch costume to (ground v)\n    wait (1.5) seconds\n    repeat (10)\n        change [brightness v] effect by (10)\n    end\n    switch costume to (ground2 v)\n    repeat (10)\n        change [brightness v] effect by (-10)\n    end\n    wait (1) seconds\n    repeat (10)\n        change [brightness v] effect by (10)\n        change [ghost v] effect by (10)\n    end\n    delete this clone\nend\n\nwhen I receive [spikes v]\nswitch costume to (ground v)\nif <(pick random (1) to (2)) = [2]> then\n    go to x: (-80) y: (8)\n    create clone of (_myself_ v)\n    go to x: (60) y: (8)\n    create clone of (_myself_ v)\nelse\n    go to x: (-192) y: (-28)\n    create clone of (_myself_ v)\n    go to x: (-232) y: (-28)\n    create clone of (_myself_ v)\n    go to x: (165) y: (-28)\n    create clone of (_myself_ v)\n    go to x: (205) y: (-28)\n    create clone of (_myself_ v)\nend\n\nwhen flag clicked\nhide\n\nwhen I receive [laser v]\ngo to x: (FireX) y: (FireY)\nswitch costume to (costume1 v)\ncreate clone of (_myself_ v)\n\nwhen I start as a clone\nwait (0.1) seconds\nwait until <<(costume [number v]) = [2]> or <(costume [number v]) = [4]>>\nwait until <touching (knight v)?>\nbroadcast (Damaged v)\n\n@HP Bar\n\nwhen I receive [start game v]\nset size to (200) %\nshow\ngo to x: (-179) y: (163)\nbroadcast (HP Bar v)\n\nwhen I receive [hp bar v]\nif <[1] < (HP)> then\n    switch costume to ((HP) + (3))\nelse\n    if <(HP) < [1]> then\n        switch costume to (costume1 v)\n    else\n        forever\n            switch costume to (costume2 v)\n            wait (0.5) seconds\n            switch costume to (costume8 v)\n            wait (0.5) seconds\n        end\n    end\nend\n\n@Stamina Bar\n\nwhen I receive [start game v]\nset size to (200) %\nshow\nset [stamina v] to [6]\ngo to x: (-179) y: (143)\nforever\n    switch costume to ((Stamina) + (2))\nend\n\nwhen I receive [start game v]\nset size to (200) %\nshow\nforever\n    if <<[6] > (Stamina)> and <((blocking) + (attack)) = [0]>> then\n        wait (0.5) seconds\n        change [stamina v] by (1)\n    end\nend\n\nwhen I receive [start game v]\nforever\n    if <(stunned) = [1]> then\n        wait until <(Stamina) = [6]>\n        set [stunned v] to [0]\n    end\nend\n\n@Mini Goblin\n\nset size to (200) %\n\nwhen I receive [next level v]\ndelete this clone\n\nwhen I start as a clone\nset [enemy in level 2 v] to [0]\nset [enemy punch v] to [0]\nset [enemy attacking 2 v] to [0]\nswitch costume to (rest v)\ngo to [front v] layer\nset size to (200) %\ncreate clone of (enemy hitbox2 v)\nshow\nset [enemy walking v] to [0]\nset rotation style [left-right v]\nif <([x position v] of [knight v]) > (x position)> then\n    point in direction (90)\nelse\n    point in direction (-90)\nend\nforever\n    if <[200] > ([abs v] of ((x position) - ([x position v] of [knight v])) )> then\n        repeat until <<([abs v] of ((x position) - ([x position v] of [knight v])) ) > [200]> or <[5] > ([abs v] of ((x position) - ([x position v] of [knight v])) )>>\n            if <([x position v] of [knight v]) > (x position)> then\n                point in direction (90)\n            else\n                point in direction (-90)\n            end\n            if <(Enemy in Level 2) = [0]> then\n                move (3) steps\n                set [enemy walking v] to [1]\n            end\n        end\n        set [enemy walking v] to [0]\n        if <<[10] > ([abs v] of ((y position) - ([y position v] of [knight v])) )> and <[20] > ([abs v] of ((x position) - ([x position v] of [knight v])) )>> then\n            set [enemy walking v] to [0]\n            set [enemy attacking 2 v] to [1]\n            switch costume to (rest v)\n            wait (0.1) seconds\n            switch costume to (punch v)\n            wait (0.1) seconds\n            switch costume to (punch2 v)\n            set [enemy punch v] to [1]\n            wait (0.2) seconds\n            set [enemy punch v] to [0]\n            wait (0.1) seconds\n            set [enemy attacking 2 v] to [0]\n        end\n        if <(enemy attack) = [0]> then\n            switch costume to (rest v)\n        end\n    end\nend\n\nwhen I start as a clone\nforever\n    set [enemy direction 2 v] to (direction)\n    set [enemyx2 v] to (x position)\n    set [enemyy2 v] to (y position)\nend\n\nwhen I start as a clone\nforever\n    if <<(Enemy Attacking 2) = [0]> and <(enemy walking) = [1]>> then\n        if <<(Enemy Attacking 2) = [0]> and <(enemy walking) = [1]>> then\n            switch costume to (walk v)\n            wait (0.15) seconds\n        end\n        if <<(Enemy Attacking 2) = [0]> and <(enemy walking) = [1]>> then\n            switch costume to (walk2 v)\n            wait (0.15) seconds\n        end\n        if <<(Enemy Attacking 2) = [0]> and <(enemy walking) = [1]>> then\n            switch costume to (walk3 v)\n            wait (0.15) seconds\n        end\n        if <<(Enemy Attacking 2) = [0]> and <(enemy walking) = [1]>> then\n            switch costume to (walk4 v)\n            wait (0.15) seconds\n        end\n    end\nend\n\nwhen I start as a clone\nclear graphic effects\nset [enemy hp v] to [3]\nforever\n    if <<(attack) = [1]> and <<touching color (#ffffff)?> and <<(PlayerAttack) > [0]> and <touching (knight v)?>>>> then\n        if <(enemy HP) > [1]> then\n            change [enemy hp v] by (-1)\n            repeat (10)\n                hide\n                wait (0.05) seconds\n                show\n                wait (0.05) seconds\n            end\n        else\n            stop [other scripts in sprite v]\n            switch costume to (defeated v)\n            repeat (2)\n                change [brightness v] effect by (10)\n                switch costume to (defeated v)\n                hide\n                wait (0.05) seconds\n                show\n                wait (0.05) seconds\n            end\n            repeat (7)\n                next costume\n                change [brightness v] effect by (10)\n                wait (0.01) seconds\n            end\n            delete this clone\n        end\n    end\nend\n\nwhen I receive [next level v]\nif <(level) = [12]> then\n    go to x: (104) y: (-11)\n    create clone of (_myself_ v)\nend\nif <(level) = [13]> then\n    go to x: (-6) y: (-86)\n    create clone of (_myself_ v)\nend\nif <(level) = [14]> then\n    go to x: (52) y: (68)\n    create clone of (_myself_ v)\nend\nif <(level) = [15]> then\n    go to x: (22) y: (-94)\n    create clone of (_myself_ v)\nend\nif <(level) = [16]> then\n    go to x: (74) y: (-109)\n    create clone of (_myself_ v)\nend\nif <(level) = [17]> then\n    go to x: (-4) y: (14)\n    create clone of (_myself_ v)\nend\n\nwhen flag clicked\nhide\n\n@Challenge Boss\n\nwhen flag clicked\nhide\n\nwhen I receive [next level v]\nif <(level) = [9]> then\n    show\n    clear graphic effects\n    go to x: (0) y: (170)\n    switch costume to (costume1 v)\n    set [y-velocity v] to [0]\n    go to [front v] layer\n    go to x: (0) y: (180)\n    show\n    repeat until <[100] > (y position)>\n        change y by ((y-velocity) * (([abs v] of (y-velocity) ) * (2)))\n        change [y-velocity v] by (-0.1)\n    end\n    wait until <key (x v) pressed?>\n    repeat (10)\n        change [ghost v] effect by (10)\n        change [brightness v] effect by (10)\n    end\n    hide\n    wait (1) seconds\n    broadcast (Boss 1 v)\nend\nif <(level) = [18]> then\n    show\n    clear graphic effects\n    go to x: (0) y: (170)\n    switch costume to (costume1 v)\n    set [y-velocity v] to [0]\n    go to [front v] layer\n    go to x: (0) y: (180)\n    show\n    repeat until <[100] > (y position)>\n        change y by ((y-velocity) * (([abs v] of (y-velocity) ) * (2)))\n        change [y-velocity v] by (-0.1)\n    end\n    wait until <key (x v) pressed?>\n    repeat (10)\n        change [ghost v] effect by (10)\n        change [brightness v] effect by (10)\n    end\n    hide\n    wait (1) seconds\n    broadcast (Boss 2 v)\nend\n\nwhen I receive [boss defeated v]\nhide\nif <(level) = [18]> then\n    wait (3) seconds\n    switch costume to (costume2 v)\n    create clone of (_myself_ v)\n    wait (3) seconds\n    switch costume to (costume3 v)\n    create clone of (_myself_ v)\n    wait (3) seconds\n    switch costume to (costume4 v)\n    create clone of (_myself_ v)\n    wait (3) seconds\n    switch costume to (costume5 v)\n    create clone of (_myself_ v)\n    wait (3) seconds\nend\n\nwhen I start as a clone\nshow\nclear graphic effects\ngo to x: (0) y: (170)\nset [y-velocity v] to [0]\ngo to [front v] layer\ngo to x: (0) y: (180)\nshow\nrepeat until <((180) - ((30) * (costume [number v]))) > (y position)>\n    change y by ((y-velocity) * (([abs v] of (y-velocity) ) * (2)))\n    change [y-velocity v] by (-0.1)\nend\n\n@Boss 2\n\nwhen I receive [boss 2 v]\ncreate clone of (_myself_ v)\n\nwhen I start as a clone\ngo to x: (162) y: (184)\nset [enemy attacking v] to [0]\nshow\nswitch costume to (fall v)\nglide (0.5) secs to x: (162) y: (-79)\nswitch costume to (land v)\nwait (0.5) seconds\nswitch costume to (recover v)\nwait (0.1) seconds\nswitch costume to (rest v)\nset rotation style [left-right v]\nset size to (200) %\nset [boss hp v] to [6]\nset [attacking v] to [0]\nforever\n    wait (2) seconds\n    wait until <(flying) = [0]>\n    set [attacking v] to [1]\n    if <(pick random (1) to (2)) = [1]> then\n        switch costume to (jump v)\n        show\n        switch costume to (jump v)\n        glide (0.5) secs to x: (x position) y: (180)\n        hide\n        wait (2) seconds\n        if <([x position v] of [knight v]) > [-190]> then\n            go to x: ([x position v] of [knight v]) y: (180)\n        else\n            go to x: (-190) y: (180)\n        end\n        switch costume to (fall v)\n        show\n        set [enemy attacking v] to [2]\n        broadcast (Yell v)\n        glide (0.5) secs to x: (x position) y: (-79)\n        switch costume to (land v)\n        set [enemy attacking v] to [0]\n        wait (2) seconds\n        switch costume to (recover v)\n        wait (0.1) seconds\n        switch costume to (rest v)\n    else\n        switch costume to (rest v)\n        wait (0.1) seconds\n        switch costume to (attack v)\n        wait (0.1) seconds\n        switch costume to (attack v)\n        repeat (2)\n            wait (0.1) seconds\n            next costume\n        end\n        wait (0.1) seconds\n        set [enemy attacking v] to [2]\n        broadcast (Yell v)\n        repeat (3)\n            move (10) steps\n            switch costume to (attack4 v)\n            wait (0.05) seconds\n            move (10) steps\n            switch costume to (attack6 v)\n            wait (0.05) seconds\n            move (10) steps\n            switch costume to (attack5 v)\n            wait (0.05) seconds\n            move (10) steps\n            switch costume to (attack7 v)\n            wait (0.05) seconds\n            move (10) steps\n            if <<([x position v] of [knight v]) = (x position)> or <([x position v] of [knight v]) > (x position)>> then\n                point in direction (90)\n            else\n                point in direction (-90)\n            end\n        end\n        set [enemy attacking v] to [0]\n    end\n    set [attacking v] to [0]\n    wait (0.2) seconds\n    if <[100] > ([abs v] of (([x position v] of [knight v]) - (x position)) )> then\n        if <<([x position v] of [knight v]) = (x position)> or <([x position v] of [knight v]) > (x position)>> then\n            point in direction (90)\n        else\n            point in direction (-90)\n        end\n        wait until <(flying) = [0]>\n        set [attacking v] to [1]\n        wait (0.2) seconds\n        switch costume to (swing v)\n        wait (0.5) seconds\n        switch costume to (swing2 v)\n        wait (0.1) seconds\n        set [enemy attacking v] to [3]\n        switch costume to (swing3 v)\n        wait (0.1) seconds\n        switch costume to (swing4 v)\n        wait (0.1) seconds\n        switch costume to (swing5 v)\n        set [enemy attacking v] to [0]\n        if <<(blocking) = [1]> and <touching (knight v)?>> then\n            broadcast (Block v)\n            wait (0.2) seconds\n        end\n        wait (0.1) seconds\n        set [attacking v] to [0]\n    end\nend\n\nwhen I start as a clone\nwait (1.1) seconds\nset size to (200) %\nforever\n    if <not <(attacking) = [1]>> then\n        set [flying v] to [1]\n        switch costume to (rest v)\n        wait (0.2) seconds\n        switch costume to (rest2 v)\n        wait (0.2) seconds\n        switch costume to (rest3 v)\n        wait (0.2) seconds\n        switch costume to (rest2 v)\n        set [flying v] to [0]\n        wait (0.2) seconds\n    end\nend\n\nwhen flag clicked\nhide\n\nwhen I start as a clone\nwait (0.1) seconds\nforever\n    if <<(attack) = [1]> and <<touching color (#ffffff)?> and <<(PlayerAttack) > [0]> and <touching (knight v)?>>>> then\n        change [boss hp v] by (-1)\n        if <(Boss HP) > [0]> then\n            repeat (10)\n                hide\n                wait (0.05) seconds\n                show\n                wait (0.05) seconds\n            end\n        else\n            stop [other scripts in sprite v]\n            set [enemy attacking v] to [0]\n            clear graphic effects\n            switch costume to (rest v)\n            show\n            repeat (10)\n                wait (0.05) seconds\n                hide\n                change [brightness v] effect by (10)\n                wait (0.05) seconds\n                show\n                wait (0.05) seconds\n                hide\n                wait (0.05) seconds\n                show\n            end\n            wait (0.05) seconds\n            switch costume to (defeated v)\n            repeat (12)\n                wait (0.05) seconds\n                next costume\n            end\n            wait (0.05) seconds\n            broadcast (Boss Defeated v)\n            delete this clone\n        end\n    end\nend\n\nwhen I start as a clone\nset rotation style [left-right v]\npoint in direction (-90)\nwait (1) seconds\nforever\n    if <(y position) > [170]> then\n        repeat until <not <(y position) > [170]>>\n            hide\n        end\n        show\n    end\nend\n\n@Boss HP Bar\n\nwhen I receive [boss 1 v]\nset size to (200) %\nshow\ngo to x: (179) y: (163)\nforever\n    switch costume to ((Boss HP) + (1))\nend\n\nwhen flag clicked\nhide\n\nwhen I receive [boss defeated v]\nstop [other scripts in sprite v]\nhide\n\nwhen I receive [boss 2 v]\nset size to (200) %\nshow\ngo to x: (179) y: (163)\nforever\n    switch costume to ((Boss HP) + (8))\nend\n\n@arrow\n\nwhen flag clicked\nhide\n\nwhen I receive [next level v]\ndelete this clone\n\nwhen I start as a clone\nbroadcast (Whoosh v)\nset size to (100) %\ngo to x: (FireX) y: (FireY)\npoint towards (knight v)\nshow\nrepeat (2)\n    move (10) steps\nend\nrepeat until <<<(Player Block) = [1]> and <touching (knight v)?>> or <<touching (levels v)?> or <touching (_edge_ v)?>>>\n    move (10) steps\nend\nif <touching (knight v)?> then\n    repeat (2)\n        move (10) steps\n    end\nend\ndelete this clone\n\nwhen I start as a clone\nwait until <not <(level) = (Arrow's Level)>>\ndelete this clone\n\n@Block\n\nwhen I start as a clone\nclear graphic effects\nswitch costume to (costume1 v)\nshow\n\nwhen I receive [break block v]\nwait (1) seconds\nswitch costume to (costume1 v)\nchange [brightness v] effect by (10)\nwait (0.01) seconds\nrepeat (6)\n    change [brightness v] effect by (10)\n    next costume\n    wait (0.01) seconds\nend\ndelete this clone\n\nwhen I receive [next level v]\nif <(level) = [5]> then\n    go to x: (212) y: (133)\n    create clone of (_myself_ v)\nend\nif <(level) = [6]> then\n    go to x: (116) y: (133)\n    create clone of (_myself_ v)\nend\nif <(level) = [7]> then\n    go to x: (111) y: (-133)\n    create clone of (_myself_ v)\nend\nif <(level) = [8]> then\n    go to x: (-4) y: (-133)\n    create clone of (_myself_ v)\nend\nif <(level) = [9]> then\n    go to x: (223) y: (-2)\n    create clone of (_myself_ v)\nend\nif <(level) = [10]> then\n    go to x: (9) y: (134)\n    create clone of (_myself_ v)\nend\nif <(level) = [11]> then\n    go to x: (210) y: (133)\n    create clone of (_myself_ v)\nend\nif <<(level) = [14]> or <(level) = [13]>> then\n    go to x: (223) y: (-134)\n    create clone of (_myself_ v)\nend\nif <(level) = [15]> then\n    go to x: (5) y: (58)\n    create clone of (_myself_ v)\nend\nif <(level) = [16]> then\n    go to x: (-129) y: (-99)\n    create clone of (_myself_ v)\nend\nif <<(level) = [18]> or <(level) = [17]>> then\n    go to x: (222) y: (-78)\n    create clone of (_myself_ v)\nend\n\nwhen flag clicked\nswitch costume to (costume1 v)\nhide\n\nwhen I receive [break block v]\nforever\n    change y by (3)\n    change y by (-3)\nend\n\nwhen I receive [boss defeated v]\nif <(level) = [9]> then\n    wait (1) seconds\n    switch costume to (costume1 v)\n    change [brightness v] effect by (10)\n    wait (0.01) seconds\n    repeat (6)\n        change [brightness v] effect by (10)\n        next costume\n        wait (0.01) seconds\n    end\n    delete this clone\nend\n\nwhen I receive [next level v]\ndelete this clone\n\n@Enemy2\n\nwhen flag clicked\nhide\n\nwhen I receive [next level v]\nif <(level) = [4]> then\n    go to x: (218) y: (0)\n    create clone of (_myself_ v)\nend\nif <(level) = [5]> then\n    go to x: (194) y: (-1)\n    create clone of (_myself_ v)\nend\nif <(level) = [6]> then\n    go to x: (-78) y: (-154)\n    create clone of (_myself_ v)\nend\nif <(level) = [7]> then\n    go to x: (-135) y: (20)\n    create clone of (_myself_ v)\nend\nif <(level) = [8]> then\n    go to x: (-37) y: (118)\n    create clone of (_myself_ v)\nend\nif <(level) = [10]> then\n    go to x: (138) y: (114)\n    create clone of (_myself_ v)\nend\nif <(level) = [11]> then\n    go to x: (-175) y: (39)\n    create clone of (_myself_ v)\nend\nif <(level) = [13]> then\n    go to x: (60) y: (38)\n    create clone of (_myself_ v)\nend\nif <(level) = [14]> then\n    go to x: (-166) y: (38)\n    create clone of (_myself_ v)\nend\nif <(level) = [15]> then\n    go to x: (-166) y: (-14)\n    create clone of (_myself_ v)\nend\nif <(level) = [16]> then\n    go to x: (180) y: (-72)\n    create clone of (_myself_ v)\nend\nif <(level) = [17]> then\n    go to x: (-34) y: (97)\n    create clone of (_myself_ v)\nend\n\nwhen I receive [next level v]\ndelete this clone\n\nwhen I start as a clone\nswitch costume to (rest v)\ngo to [front v] layer\nshow\nset [enemy2attack v] to [0]\nset rotation style [left-right v]\nif <([x position v] of [knight v]) > (x position)> then\n    point in direction (90)\nelse\n    point in direction (-90)\nend\nforever\n    if <<[40] > ([abs v] of ((y position) - ([y position v] of [knight v])) )> and <[40] > ([abs v] of ((x position) - ([x position v] of [knight v])) )>> then\n        if <([x position v] of [knight v]) > (x position)> then\n            point in direction (90)\n        else\n            point in direction (-90)\n        end\n        switch costume to (rest2 v)\n        wait (0.01) seconds\n        switch costume to (attack v)\n        wait (0.02) seconds\n        repeat (3)\n            next costume\n            wait (0.02) seconds\n        end\n        set [enemy2attack v] to [1]\n        broadcast (Whoosh v)\n        repeat (3)\n            next costume\n            wait (0.02) seconds\n        end\n        set [enemy2attack v] to [0]\n        if <<(blocking) = [1]> and <touching (knight v)?>> then\n            broadcast (Block v)\n            switch costume to (blocked v)\n            wait (0.01) seconds\n            switch costume to (blocked2 v)\n            wait (1.5) seconds\n        end\n        if <(enemy2attack) = [0]> then\n            switch costume to (rest2 v)\n            wait (1) seconds\n        end\n    else\n        if <([x position v] of [knight v]) > (x position)> then\n            point in direction (90)\n        else\n            point in direction (-90)\n        end\n        switch costume to (rest v)\n        wait (1) seconds\n        switch costume to (draw v)\n        wait (0.05) seconds\n        repeat (4)\n            next costume\n            wait (0.05) seconds\n        end\n        create clone of (arrow v)\n        switch costume to (draw2 v)\n        wait (0.1) seconds\n        switch costume to (draw v)\n        wait (0.1) seconds\n        switch costume to (rest v)\n        wait (2) seconds\n    end\nend\n\nwhen I start as a clone\nforever\n    set [firex v] to (x position)\n    set [firey v] to (y position)\n    set [arrow's level v] to (level)\nend\n\nwhen I start as a clone\nclear graphic effects\nset [enemy hp v] to [3]\nforever\n    if <<(attack) = [1]> and <<touching color (#ffffff)?> and <<(PlayerAttack) > [0]> and <touching (knight v)?>>>> then\n        if <(enemy HP) > [1]> then\n            change [enemy hp v] by (-1)\n            repeat (10)\n                hide\n                wait (0.05) seconds\n                show\n                wait (0.05) seconds\n            end\n        else\n            stop [other scripts in sprite v]\n            switch costume to (defeated v)\n            repeat (2)\n                change [brightness v] effect by (10)\n                switch costume to (defeated v)\n                hide\n                wait (0.05) seconds\n                show\n                wait (0.05) seconds\n            end\n            repeat (8)\n                next costume\n                change [brightness v] effect by (10)\n                wait (0.01) seconds\n            end\n            delete this clone\n        end\n    end\nend\n\n@Heart\n\nwhen I receive [next level v]\nif <(level) = [4]> then\n    point in direction (90)\n    go to x: (183) y: (-146)\n    create clone of (_myself_ v)\nend\nif <(level) = [6]> then\n    point in direction (90)\n    go to x: (177) y: (117)\n    create clone of (_myself_ v)\nend\nif <(level) = [7]> then\n    go to x: (191) y: (124)\n    point in direction (90)\n    create clone of (_myself_ v)\nend\nif <(level) = [8]> then\n    go to x: (85) y: (123)\n    point in direction (90)\n    create clone of (_myself_ v)\nend\nif <(level) = [10]> then\n    go to x: (39) y: (-24)\n    point in direction (90)\n    create clone of (_myself_ v)\nend\nif <(level) = [11]> then\n    go to x: (-186) y: (-90)\n    point in direction (90)\n    create clone of (_myself_ v)\nend\nif <(level) = [12]> then\n    go to x: (166) y: (119)\n    point in direction (90)\n    create clone of (_myself_ v)\nend\nif <(level) = [13]> then\n    go to x: (-175) y: (-40)\n    point in direction (90)\n    create clone of (_myself_ v)\nend\nif <(level) = [14]> then\n    go to x: (40) y: (71)\n    point in direction (90)\n    create clone of (_myself_ v)\nend\nif <(level) = [16]> then\n    go to x: (-162) y: (-113)\n    point in direction (90)\n    create clone of (_myself_ v)\nend\n\nwhen I receive [next level v]\ndelete this clone\n\nwhen I start as a clone\nset size to (200) %\nshow\nwait until <<touching (knight v)?> and <[20] > ([abs v] of ((x position) - ([x position v] of [knight v])) )>>\nif <[6] > (HP)> then\n    change [hp v] by (1)\nend\nbroadcast (HP Bar v)\nhide\nbroadcast (zoop v)\ndelete this clone\n\nwhen flag clicked\nhide\n\n@Enemy Hitbox2\n\nwhen I start as a clone\nshow\nset [ghost v] effect to (100)\nset rotation style [left-right v]\nforever\n    go to x: (EnemyX2) y: (EnemyY2)\nend\n\nwhen I start as a clone\nforever\n    point in direction (Enemy Direction 2)\nend\n\nwhen I receive [next level v]\ndelete this clone\n\nwhen flag clicked\nhide\n\nwhen I start as a clone\nforever\n    if <<not <touching (levels v)?>> or <<touching (spikes v)?> or <<touching color (#886468)?> or <<touching color (#a1616b)?> or <touching color (#935861)?>>>>> then\n        set [enemy in level 2 v] to [1]\n    else\n        set [enemy in level 2 v] to [0]\n    end\nend\n\n@Game Over\n\nwhen flag clicked\nhide\n\nwhen I receive [start game v]\nwait until <[1] > (HP)>\nswitch costume to (costume1 v)\nset [ghost v] effect to (80)\nshow\ncreate clone of (_myself_ v)\n\nwhen I start as a clone\ngo to [front v] layer\nclear graphic effects\nswitch costume to (costume2 v)\nshow\ngo to x: (0) y: (180)\nglide (1) secs to x: (0) y: (100)\n\n@Thumbnail\n\nwhen flag clicked\nshow\ngo to x: (0) y: (0)\ngo to [front v] layer\nswitch costume to (costume1 v)\nclear graphic effects\ncreate clone of (_myself_ v)\n\nwhen I receive [controls v]\nrepeat (5)\n    change [brightness v] effect by (-10)\n    wait (0.01) seconds\nend\n\nwhen I receive [story v]\nrepeat (5)\n    change [brightness v] effect by (-10)\n    wait (0.01) seconds\nend\n\nwhen I receive [title v]\nrepeat (5)\n    change [brightness v] effect by (10)\n    wait (0.01) seconds\nend\nclear graphic effects\n\nwhen I receive [start game v]\nstop [other scripts in sprite v]\nhide\n\n@Volume\n\nwhen I receive [start game v]\nset [sound v] to [1]\ncreate clone of (_myself_ v)\ngo to x: (-116) y: (163)\npoint in direction (-90)\nshow\nset size to (200) %\nforever\n    if <<mouse down?> and <touching (mouse-pointer v)?>> then\n        if <(Sound) = [1]> then\n            broadcast (Sound v)\n            set [sound v] to [0]\n            wait (0.3) seconds\n        else\n            broadcast (Sound v)\n            set [sound v] to [1]\n            wait (0.3) seconds\n        end\n    end\nend\n\nwhen flag clicked\nset [volume v] to [1]\nhide\n\nwhen I receive [start game v]\nforever\n    switch costume to ((Sound) + (1))\nend\n\nwhen I start as a clone\ngo to x: (-95) y: (163)\npoint in direction (90)\nshow\nset size to (200) %\nforever\n    if <<mouse down?> and <touching (mouse-pointer v)?>> then\n        if <(Volume) = [1]> then\n            broadcast (Volume v)\n            set [volume v] to [0]\n            wait (0.3) seconds\n        else\n            broadcast (Volume v)\n            set [volume v] to [1]\n            wait (0.3) seconds\n        end\n    end\nend\n\nwhen I start as a clone\nforever\n    switch costume to ((Volume) + (3))\nend\n\nwhen I receive [start game v]\nforever\n    if <touching (mouse-pointer v)?> then\n        set [1sound v] to [1]\n    else\n        set [1sound v] to [0]\n    end\nend\n\nwhen I start as a clone\nforever\n    if <touching (mouse-pointer v)?> then\n        set [!sound v] to [1]\n    else\n        set [!sound v] to [0]\n    end\nend\n\n@Buttons\n\nwhen flag clicked\ngo to x: (0) y: (0)\nhide\nswitch costume to (costume2 v)\ncreate clone of (_myself_ v)\nswitch costume to (costume3 v)\ncreate clone of (_myself_ v)\nswitch costume to (costume4 v)\ncreate clone of (_myself_ v)\n\nwhen I start as a clone\nwait (0.1) seconds\nshow\ngo to [front v] layer\nclear graphic effects\nif <(costume [number v]) = [3]> then\n    go to x: (0) y: (-180)\n    glide (0.3) secs to x: (0) y: (-136)\n    forever\n        if <touching (mouse-pointer v)?> then\n            set [brightness v] effect to (20)\n            if <mouse down?> then\n                broadcast (Start Game v)\n                wait (1) seconds\n            end\n        else\n            clear graphic effects\n        end\n    end\nelse\n    if <(costume [number v]) = [4]> then\n        go to x: (-151) y: (-180)\n        glide (0.3) secs to x: (-151) y: (-136)\n        forever\n            if <touching (mouse-pointer v)?> then\n                set [brightness v] effect to (20)\n                if <mouse down?> then\n                    broadcast (Story v)\n                    wait (1) seconds\n                end\n            else\n                clear graphic effects\n            end\n        end\n    else\n        if <(costume [number v]) = [5]> then\n            go to x: (151) y: (-180)\n            glide (0.3) secs to x: (151) y: (-136)\n            forever\n                if <touching (mouse-pointer v)?> then\n                    set [brightness v] effect to (20)\n                    if <mouse down?> then\n                        broadcast (Controls v)\n                        wait (1) seconds\n                    end\n                else\n                    clear graphic effects\n                end\n            end\n        else\n            go to x: (195) y: (140)\n            forever\n                if <touching (mouse-pointer v)?> then\n                    set [brightness v] effect to (60)\n                    if <mouse down?> then\n                        broadcast (Title v)\n                        wait (1) seconds\n                    end\n                else\n                    clear graphic effects\n                end\n            end\n        end\n    end\nend\n\nwhen I receive [start game v]\ndelete this clone\n\nwhen I receive [story v]\ndelete this clone\n\nwhen I receive [controls v]\ndelete this clone\n\nwhen I receive [title v]\nhide\nwait (1) seconds\nswitch costume to (costume2 v)\ncreate clone of (_myself_ v)\nswitch costume to (costume3 v)\ncreate clone of (_myself_ v)\nswitch costume to (costume4 v)\ncreate clone of (_myself_ v)\n\nwhen I receive [controls v]\nwait (0.1) seconds\nswitch costume to (costume5 v)\nwait (0.8) seconds\ncreate clone of (_myself_ v)\ngo to [front v] layer\nswitch costume to (costume6 v)\nshow\n\nwhen I receive [title v]\ndelete this clone\n\nwhen I receive [story v]\nwait (0.1) seconds\nswitch costume to (costume5 v)\nwait (0.8) seconds\ncreate clone of (_myself_ v)\ngo to [front v] layer\nswitch costume to (costume1 v)\nshow\n\n@SFX\n\nwhen I receive [block v]\nplay sound [Basketball Bounce v] until done\n\nwhen I receive [whoosh v]\nplay sound [Low Whoosh v] until done\n\nwhen I receive [yell v]\nplay sound [Yell v] until done\n\nwhen flag clicked\nset volume to (100) %\n\nwhen I receive [sound v]\nset volume to ((100) * (Sound)) %\n\nwhen I receive [crunch v]\nplay sound [Crunch v] until done\n\nwhen I receive [zoop v]\nplay sound [Zoop v] until done\n\n