SCRATCH WARS - Episode 1 - V1.4
@Stage\n\nwhen [a v] key pressed\nif <(Intro) = [0]> then\n    set [pause v] to [1]\n    stop all sounds\n    set [intro v] to [1]\n    switch backdrop to (menu3 v)\n    broadcast (INTRO_2 v)\nend\n\nwhen flag clicked\nswitch backdrop to (backdrop1 v)\nset [pause v] to [1]\nset volume to (80) %\nforever\n    if <(Intro) = [0]> then\n        play sound [Star Wars-The Imperial March \( Darth Vader Theme Song \) 8-bit.mp3 v] until done\n    end\n    if <(Intro) = [3]> then\n        play sound [Star Wars-The Imperial March \( Darth Vader Theme Song \) 8-bit.mp3 v] until done\n    end\nend\n\nwhen I receive [z_sound_1 v]\nplay sound [ltsaberhit01 v] until done\n\nwhen I receive [z_sound_2 v]\nplay sound [pistol-1 v] until done\n\nwhen I receive [fire_1 v]\nplay sound [pistol-1 v] until done\n\nwhen I receive [death_2 v]\nplay sound [ltsaberbodyhit01 v] until done\n\nwhen I receive [destroyed v]\nplay sound [270311__littlerobotsoundfactory__explosion-03 v] until done\n\nwhen I receive [jump v]\nplay sound [270323__littlerobotsoundfactory__jump-03 v] until done\n\nwhen I receive [door_destroyed v]\nplay sound [270311__littlerobotsoundfactory__explosion-03 v] until done\n\nwhen I receive [fall_sound v]\nplay sound [270343__littlerobotsoundfactory__shoot-01 v] until done\n\nwhen I receive [death_1 v]\nplay sound [270311__littlerobotsoundfactory__explosion-03 v] until done\n\nwhen I receive [death_1 v]\nplay sound [ltsaberbodyhit01 v] until done\n\nwhen I receive [scontro v]\nplay sound [pistol-1 v] until done\n\nwhen I receive [vader_hit v]\nplay sound [ltsaberbodyhit01 v] until done\n\nrepeat until <(Intro) = [1]>\n    if <(Intro) = [0]> then\n        set [tempo v] to ((tempo) + (1))\n        if <(tempo) = [600]> then\n            switch backdrop to (menu2 v)\n        end\n        if <(tempo) = [1200]> then\n            switch backdrop to (backdrop1 v)\n            set [tempo v] to [0]\n        end\n    end\n    if <(Intro) = [1]> then\n        switch backdrop to (menu3 v)\n    end\n    if <(Intro) = [3]> then\n    end\nend\n\nwhen I receive [fire_2 v]\nplay sound [pistol-1 v] until done\n\nwhen I receive [fire_5 v]\nplay sound [pistol-1 v] until done\n\nwhen I receive [fire_4 v]\nplay sound [pistol-1 v] until done\n\nwhen I receive [fire_3 v]\nplay sound [pistol-1 v] until done\n\nwhen flag clicked\nswitch backdrop to (backdrop1 v)\n\n@Sprite1\n\ndefine None\nset [dx v] to [0]\nrepeat until <(DX) = ([abs v] of (vx) )>\n    set [dx v] to ((DX) + (1))\n    change x by (-1)\n    if <touching (sprite2 v)?> then\n        set [dx v] to ([abs v] of (vx) )\n        change x by (1)\n        set [vx v] to [0]\n    end\n    if <<touching (plaat_01 v)?> and <(On_a_Moving_plat) = [0]>> then\n        set [dx v] to ([abs v] of (vx) )\n        change x by (1)\n        set [vx v] to [0]\n    end\n    if <touching (falling_plaat v)?> then\n        set [dx v] to ([abs v] of (vx) )\n        change x by (1)\n        set [vx v] to [0]\n    end\n    if <touching (falling_plaat2 v)?> then\n        set [dx v] to ([abs v] of (vx) )\n        change x by (1)\n        set [vx v] to [0]\n    end\n    if <touching (falling_plaat3 v)?> then\n        set [dx v] to ([abs v] of (vx) )\n        change x by (1)\n        set [vx v] to [0]\n    end\nend\n\ndefine Jump_calc\nif <(GROUNDED) > [0]> then\n    if <(GROUNDED) = (Jump_Delay)> then\n        broadcast (JUMP v)\n    end\n    set [vy v] to (Jump_Strenght)\n    set [grounded v] to ((GROUNDED) - (1))\nend\n\nwhen I receive [restart v]\nset [progressi v] to [0]\nset [gravity v] to [-4]\nset [jump_strenght v] to [15]\nset [jump_delay v] to [8]\nset [acc_x v] to [1]\nset [dec_x v] to [2]\nset [vx_max v] to [8]\nset [vx v] to [0]\nset [vy v] to [0]\nset [dx v] to [0]\nset [dy v] to [0]\nset [add_v_max v] to [2]\nset [on_a_moving_plat v] to [0]\ngo to [front v] layer\ngo [backward v] (12) layers\nset [grounded v] to [0]\nwait (0.1) seconds\ngo to x: (-196) y: (-144)\npoint in direction (90)\n\nwhen I receive [death_fall v]\nif <(PROGRESSI) < [2]> then\n    go to x: (-196) y: (-144)\nend\nif <<(PROGRESSI) = [2]> or <(PROGRESSI) = [3]>> then\n    go to x: (-221) y: (76)\nend\nif <<(PROGRESSI) = [4]> or <(PROGRESSI) = [5]>> then\n    go to x: (-216) y: (77)\nend\nif <<(PROGRESSI) = [6]> or <(PROGRESSI) = [7]>> then\n    go to x: (-219) y: (-153)\nend\nif <<(PROGRESSI) = [8]> or <(PROGRESSI) = [9]>> then\n    go to x: (-215) y: (96)\nend\nif <<(PROGRESSI) = [10]> or <(PROGRESSI) = [11]>> then\n    go to x: (-219) y: (64)\nend\nif <<(PROGRESSI) = [12]> or <(PROGRESSI) = [13]>> then\n    go to x: (-213) y: (95)\nend\nif <<(PROGRESSI) = [14]> or <(PROGRESSI) = [15]>> then\n    go to x: (-179) y: (-140)\nend\nif <<(PROGRESSI) = [16]> or <(PROGRESSI) = [17]>> then\n    go to x: (-218) y: (-140)\nend\nif <<(PROGRESSI) = [18]> or <(PROGRESSI) = [19]>> then\n    go to x: (-217) y: (76)\nend\nif <<(PROGRESSI) = [20]> or <(PROGRESSI) = [21]>> then\n    go to x: (-217) y: (-140)\nend\nif <(PROGRESSI) = [22]> then\n    go to x: (-161) y: (-140)\nend\n\ndefine None\nif <(vy) = [0]> then\nend\nif <(vy) < [0]> then\n    set [dy v] to [0]\n    repeat until <(DY) = ([abs v] of (vy) )>\n        set [dy v] to ((DY) + (1))\n        change y by (-1)\n        if <touching (sprite2 v)?> then\n            set [grounded v] to (Jump_Delay)\n            set [dy v] to ([abs v] of (vy) )\n            change y by (1)\n            set [vy v] to [0]\n            set [add_vy v] to [0]\n        end\n        if <not <touching (plaat_01 v)?>> then\n            set [on_a_moving_plat v] to [0]\n        end\n        if <touching (plaat_01 v)?> then\n            set [on_a_moving_plat v] to [1]\n            set [grounded v] to (Jump_Delay)\n            set [dy v] to ([abs v] of (vy) )\n            change y by (1)\n            set [vy v] to [0]\n            set [add_vy v] to (VY_addizionale)\n        end\n        if <touching (falling_plaat v)?> then\n            set [on_a_falling_plat v] to [1]\n            set [grounded v] to (Jump_Delay)\n            set [dy v] to ([abs v] of (vy) )\n            change y by (1)\n            set [vy v] to [0]\n            set [add_vy v] to [0]\n        end\n        if <touching (falling_plaat2 v)?> then\n            set [on_a_falling_plat2 v] to [1]\n            set [grounded v] to (Jump_Delay)\n            set [dy v] to ([abs v] of (vy) )\n            change y by (1)\n            set [vy v] to [0]\n            set [add_vy v] to [0]\n        end\n        if <touching (falling_plaat3 v)?> then\n            set [on_a_falling_plat3 v] to [1]\n            set [grounded v] to (Jump_Delay)\n            set [dy v] to ([abs v] of (vy) )\n            change y by (1)\n            set [vy v] to [0]\n            set [add_vy v] to [0]\n        end\n    end\n    change y by (ADD_VY)\nend\nif <(vy) > [0]> then\n    set [dy v] to [0]\n    repeat until <(DY) = ([abs v] of (vy) )>\n        set [dy v] to ((DY) + (1))\n        change y by (1)\n        if <touching (sprite2 v)?> then\n            set [grounded v] to [0]\n            set [dy v] to ([abs v] of (vy) )\n            change y by (-1)\n            set [vy v] to [0]\n        end\n        if <<touching (plaat_01 v)?> and <(On_a_Moving_plat) = [0]>> then\n            set [grounded v] to [0]\n            set [dy v] to ([abs v] of (vy) )\n            change y by (-10)\n            set [vy v] to [-10]\n        end\n        if <(y position) > [160]> then\n            set [grounded v] to [0]\n            set [dy v] to ([abs v] of (vy) )\n            change y by (-1)\n            set [vy v] to [0]\n        end\n        if <touching (falling_plaat v)?> then\n            set [grounded v] to [0]\n            set [dy v] to ([abs v] of (vy) )\n            change y by (-1)\n            set [vy v] to [0]\n        end\n        if <touching (falling_plaat2 v)?> then\n            set [grounded v] to [0]\n            set [dy v] to ([abs v] of (vy) )\n            change y by (-1)\n            set [vy v] to [0]\n        end\n        if <touching (falling_plaat3 v)?> then\n            set [grounded v] to [0]\n            set [dy v] to ([abs v] of (vy) )\n            change y by (-1)\n            set [vy v] to [0]\n        end\n    end\nend\n\ndefine None\nset [dx v] to [0]\nrepeat until <(DX) = ([abs v] of (vx) )>\n    set [dx v] to ((DX) + (1))\n    change x by (1)\n    if <touching (sprite2 v)?> then\n        set [dx v] to ([abs v] of (vx) )\n        change x by (-1)\n        set [vx v] to [0]\n    end\n    if <<touching (plaat_01 v)?> and <(On_a_Moving_plat) = [0]>> then\n        set [dx v] to ([abs v] of (vx) )\n        change x by (-1)\n        set [vx v] to [0]\n    end\n    if <touching (falling_plaat v)?> then\n        set [dx v] to ([abs v] of (vx) )\n        change x by (-1)\n        set [vx v] to [0]\n    end\n    if <touching (falling_plaat2 v)?> then\n        set [dx v] to ([abs v] of (vx) )\n        change x by (-1)\n        set [vx v] to [0]\n    end\n    if <touching (falling_plaat3 v)?> then\n        set [dx v] to ([abs v] of (vx) )\n        change x by (-1)\n        set [vx v] to [0]\n    end\nend\n\ndefine Check_moving_plat\nif <(VY_addizionale) < [0]> then\n    if <(Delta_Y) > [-17]> then\n        go to x: (x position) y: (([y position v] of [plaat_01 v]) + (17))\n    end\nend\nif <(VY_addizionale) > [0]> then\n    if <(Delta_Y) > [-25]> then\n        go to x: (x position) y: (([y position v] of [plaat_01 v]) + (25))\n    end\nend\n\nwhen I receive [end_game v]\nrepeat until <(y position) = [-142]>\n    change [vy v] by (Gravity)\n    Collisioni_giù (Vy)\nend\npoint towards (vader_01 v)\n\nwhen I receive [level_change v]\nset [pause v] to [0]\nset [grounded v] to [0]\nif <(PROGRESSI) = [2]> then\n    go to x: (-221) y: (76)\nend\nif <(PROGRESSI) = [4]> then\n    go to x: (-221) y: (76)\nend\nif <(PROGRESSI) = [4]> then\n    go to x: (-216) y: (77)\nend\nif <(PROGRESSI) = [6]> then\n    go to x: (-219) y: (-154)\nend\nif <(PROGRESSI) = [8]> then\n    go to x: (-215) y: (96)\nend\nif <(PROGRESSI) = [10]> then\n    go to x: (-219) y: (63)\nend\nif <(PROGRESSI) = [12]> then\n    go to x: (-213) y: (94)\nend\nif <(PROGRESSI) = [14]> then\n    go to x: (-179) y: (-140)\nend\nif <(PROGRESSI) = [16]> then\n    go to x: (-218) y: (-140)\nend\nif <(PROGRESSI) = [18]> then\n    go to x: (-217) y: (76)\nend\nif <(PROGRESSI) = [20]> then\n    go to x: (-217) y: (-140)\nend\nif <(PROGRESSI) = [22]> then\n    go to x: (-161) y: (-140)\nend\nshow\n\ndefine Calc_V_max_SX\nif <(GROUNDED) = (Jump_Delay)> then\n    if <(Vx) < ((Vx_MAX) * (-1))> then\n        set [vx v] to ((Vx_MAX) * (-1))\n    end\nelse\n    if <(Vx) < (((Vx_MAX) * (-1)) + ((ADD_V_MAX) * (-1)))> then\n        set [vx v] to (((Vx_MAX) * (-1)) + ((ADD_V_MAX) * (-1)))\n    end\nend\n\nwhen flag clicked\nhide\n\nwhen I receive [go v]\nshow\ngo to [front v] layer\ngo [backward v] (12) layers\nset [grounded v] to [0]\nbroadcast (RESTART v)\nwait (0.1) seconds\ngo to x: (-196) y: (-146)\npoint in direction (90)\nforever\n    if <(PAUSE) = [0]> then\n        if <<key (z v) pressed?> or <key (up arrow v) pressed?>> then\n            Jump_calc\n            set [add_vy v] to [0]\n        end\n        change [vy v] by (Gravity)\n        Collisioni_giù (Vy)\n        if <key (right arrow v) pressed?> then\n            change [vx v] by (Acc_X)\n            Calc_V_max_DX\n            if <(Vx) > [0]> then\n                Collisioni_DX (Vx)\n            else\n                Collisioni_SX (Vx)\n            end\n        end\n        if <key (left arrow v) pressed?> then\n            change [vx v] by ((Acc_X) * (-1))\n            Calc_V_max_SX\n            if <(Vx) < [0]> then\n                Collisioni_SX (Vx)\n            else\n                Collisioni_DX (Vx)\n            end\n        end\n        if <<not <key (left arrow v) pressed?>> and <not <key (right arrow v) pressed?>>> then\n            if <(Vx) < [0]> then\n                change [vx v] by (Dec_X)\n                if <(Vx) > [0]> then\n                    set [vx v] to [0]\n                end\n                Collisioni_SX (Vx)\n            end\n            if <(Vx) > [0]> then\n                change [vx v] by ((Dec_X) * (-1))\n                if <(Vx) < [0]> then\n                    set [vx v] to [0]\n                end\n                Collisioni_DX (Vx)\n            end\n        end\n        if <<not <key (z v) pressed?>> and <not <key (up arrow v) pressed?>>> then\n            if <<(GROUNDED) > [0]> and <(GROUNDED) < (Jump_Delay)>> then\n                set [grounded v] to [0]\n            end\n        end\n        if <(Vy) < [0]> then\n            set [grounded v] to [0]\n        end\n        if <(On_a_Moving_plat) = [1]> then\n            if <not <(Vy) > [0]>> then\n                Check_moving_plat\n            end\n        end\n    end\nend\n\nwhen I receive [death_1 v]\nset [vx v] to [0]\nset [vy v] to [0]\n\ndefine Calc_V_max_DX\nif <(GROUNDED) = (Jump_Delay)> then\n    if <(Vx) > (Vx_MAX)> then\n        set [vx v] to (Vx_MAX)\n    end\nelse\n    if <(Vx) > ((Vx_MAX) + (ADD_V_MAX))> then\n        set [vx v] to ((Vx_MAX) + (ADD_V_MAX))\n    end\nend\n\nwhen flag clicked\nset [progressi v] to [0]\nset [gravity v] to [-4]\nset [jump_strenght v] to [15]\nset [jump_delay v] to [8]\nset [acc_x v] to [1]\nset [dec_x v] to [1]\nset [vx_max v] to [8]\nset [vx v] to [0]\nset [vy v] to [0]\nset [dx v] to [0]\nset [dy v] to [0]\nset [add_v_max v] to [2]\nset [on_a_moving_plat v] to [0]\n\nwhen I receive [very end v]\nhide\n\n@Cube_01\n\nwhen I receive [restart v]\ngo to x: (-196) y: (-146)\ngo to [front v] layer\ngo [backward v] (1) layers\nset [fire_premuto v] to [0]\nset [spada_counter v] to [0]\nset [delay_spada v] to [1]\nset rotation style [left-right v]\npoint in direction (90)\nset [clones counter v] to [0]\nset [clones_count_max v] to [2]\nset [sprite_n v] to [1]\n\ndefine Change_Level\nhide\nset [sprite_n v] to [1]\nswitch costume to (cube_01 v)\npoint in direction (90)\nset [vx v] to [0]\nset [vy v] to [0]\nset [pause v] to [1]\nset [progressi v] to ((PROGRESSI) + (1))\nset [fire_premuto v] to [0]\nbroadcast (LEVEL_CHANGE v)\n\nwhen I receive [death_1 v]\nset [pause v] to [1]\nset [fire_premuto v] to [0]\nDeath_1\n\nwhen I receive [death_2 v]\nset [pause v] to [1]\nset [fire_premuto v] to [0]\nDeath_2\n\ndefine Death_2\nset [sprite_n v] to [11]\nswitch costume to (jedi_10 v)\nset [vx v] to [0]\nset [vy v] to [0]\nset [pause v] to [1]\nset [fire_premuto v] to [0]\nwait (0.3) seconds\nset [brightness v] effect to (50)\nwait (0.2) seconds\nset [brightness v] effect to (0)\nwait (0.2) seconds\nset [brightness v] effect to (50)\nwait (0.2) seconds\nset [brightness v] effect to (0)\nDeath_by_fall\n\ndefine Death_1\nset [sprite_n v] to [10]\nswitch costume to (jedi_09 v)\nset [vx v] to [0]\nset [vy v] to [0]\nset [pause v] to [1]\nset [fire_premuto v] to [0]\nwait (0.3) seconds\nset [brightness v] effect to (50)\nwait (0.2) seconds\nset [brightness v] effect to (0)\nwait (0.2) seconds\nset [brightness v] effect to (50)\nwait (0.2) seconds\nset [brightness v] effect to (0)\nDeath_by_fall\n\ndefine Movimento_spada\nif <(Spada_counter) = (Delay_spada)> then\n    change [sprite_n v] by (1)\n    switch costume to (Sprite_N)\n    set [spada_counter v] to [0]\nend\nchange [spada_counter v] by (1)\n\nwhen I receive [go v]\nshow\ngo to x: (-196) y: (-146)\nswitch costume to (jedi_14 v)\ngo to [front v] layer\ngo [backward v] (1) layers\nset [fire_premuto v] to [0]\nset [spada_counter v] to [0]\nset [delay_spada v] to [1]\nset rotation style [left-right v]\npoint in direction (90)\nset [clones counter v] to [0]\nset [clones_count_max v] to [2]\nset [sprite_n v] to [1]\nSword\nforever\n    if <(Intro) > [2]> then\n        go to x: ([x position v] of [sprite1 v]) y: ([y position v] of [sprite1 v])\n    end\n    if <(PAUSE) = [0]> then\n        if <(Sprite_N) = [9]> then\n            switch costume to (cube_2 v)\n            set [sprite_n v] to [2]\n        end\n        if <not <key (a v) pressed?>> then\n            set [fire_premuto v] to [0]\n        end\n        if <(Sprite_N) > [2]> then\n            Movimento_spada\n        end\n        if <(Ghost_Effect) = [1]> then\n            if <(Clones Counter) = [0]> then\n                set [clones counter v] to [1]\n            end\n            if <(Clones Counter) > [0]> then\n                set [clones counter v] to ((Clones Counter) + (1))\n                if <(Clones Counter) = (Clones_count_MAX)> then\n                    create clone of (_myself_ v)\n                    set [clones counter v] to [0]\n                end\n            end\n        end\n        if <key (right arrow v) pressed?> then\n            point in direction (90)\n        end\n        if <key (left arrow v) pressed?> then\n            point in direction (-90)\n        end\n        if <<(Sprite_N) < [3]> and <not <key (a v) pressed?>>> then\n            if <key (right arrow v) pressed?> then\n                if <(GROUNDED) = (Jump_Delay)> then\n                    set [sprite_n v] to [2]\n                    switch costume to (cube_2 v)\n                end\n            end\n            if <key (left arrow v) pressed?> then\n                if <(GROUNDED) = (Jump_Delay)> then\n                    set [sprite_n v] to [2]\n                    switch costume to (cube_2 v)\n                end\n            end\n            if <<not <key (left arrow v) pressed?>> and <not <key (right arrow v) pressed?>>> then\n                if <(GROUNDED) = (Jump_Delay)> then\n                    set [sprite_n v] to [1]\n                    switch costume to (cube_01 v)\n                end\n            end\n            if <(GROUNDED) < (Jump_Delay)> then\n                set [sprite_n v] to [2]\n                switch costume to (cube_2 v)\n            end\n        else\n            if <<<(Sprite_N) < [3]> and <key (a v) pressed?>> and <(Fire_premuto) = [0]>> then\n                set [sprite_n v] to [3]\n                switch costume to (Sprite_N)\n                set [fire_premuto v] to [1]\n                broadcast (Z_SOUND_1 v)\n            end\n        end\n        verifica_bordo\n    end\nend\n\ndefine Sword\ngo to x: (-196) y: (-146)\nwait (1) seconds\nstart sound [ltsaberon01 v]\nswitch costume to (jedi_13 v)\nwait (0.1) seconds\nswitch costume to (jedi_12 v)\nwait (0.1) seconds\nswitch costume to (jedi_11 v)\nwait (0.1) seconds\nswitch costume to (cube_01 v)\nwait (1) seconds\nset [intro v] to [3]\nset [pause v] to [0]\n\ndefine verifica_bordo\nif <(PAUSE) = [0]> then\n    if <(y position) < [-180]> then\n        broadcast (FALL_SOUND v)\n        Death_by_fall\n    end\n    if <(x position) > [238]> then\n        hide\n        set [pause v] to [1]\n        go to x: (0) y: (0)\n        Change_Level\n    end\nend\n\nwhen I receive [end_game v]\npoint towards (vader_01 v)\nswitch costume to (cube_01 v)\nwait (4) seconds\nsay [What?] for (2) seconds\nwait (13) seconds\nsay [Someone told me that you killed him!] for (2) seconds\nwait (10) seconds\nsay [No! That's not true! That's impossible!] for (3) seconds\nbroadcast (VERY END v)\n\nwhen I receive [level_change v]\nset [fire_premuto v] to [0]\nset [pause v] to [0]\nshow\n\nwhen I start as a clone\ngo to [front v] layer\ngo [backward v] (7) layers\nset [ghost v] effect to (70)\nrepeat (10)\n    change [ghost v] effect by (3)\n    change y by (ADD_VY)\nend\ndelete this clone\n\nwhen I receive [very end v]\nhide\n\nwhen flag clicked\nforever\n    if <key (space v) pressed?> then\n        if <<(PAUSE) = [0]> and <(Ghost_Effect) = [3]>> then\n            set [ghost_effect v] to [0]\n        end\n        if <<(PAUSE) = [0]> and <(Ghost_Effect) = [1]>> then\n            set [ghost_effect v] to [2]\n        end\n    else\n        if <(Ghost_Effect) = [0]> then\n            set [ghost_effect v] to [1]\n        end\n        if <(Ghost_Effect) = [2]> then\n            set [ghost_effect v] to [3]\n        end\n    end\nend\n\nwhen flag clicked\nset [ghost_effect v] to [1]\nhide\ngo to x: (-196) y: (-146)\n\ndefine Death_by_fall\nhide\nif <(Sprite_N) = [10]> then\n    set [sprite_n v] to [1]\n    switch costume to (cube_01 v)\n    point in direction (90)\n    set [vx v] to [0]\n    set [vy v] to [0]\n    set [pause v] to [1]\n    broadcast (DEATH_FALL v)\n    wait (0.3) seconds\n    show\n    set [pause v] to [0]\nelse\n    set [sprite_n v] to [1]\n    switch costume to (cube_01 v)\n    point in direction (90)\n    set [vx v] to [0]\n    set [vy v] to [0]\n    set [pause v] to [1]\n    broadcast (DEATH_FALL v)\n    wait (0.3) seconds\n    go to x: ([x position v] of [sprite1 v]) y: ([y position v] of [sprite1 v])\n    show\n    wait (0.2) seconds\n    set [ghost v] effect to (50)\n    wait (0.2) seconds\n    set [ghost v] effect to (0)\n    wait (0.2) seconds\n    set [ghost v] effect to (50)\n    wait (0.2) seconds\n    set [ghost v] effect to (0)\n    set [pause v] to [0]\nend\n\n@Sprite2\n\nwhen I receive [restart v]\ngo to [front v] layer\ngo [backward v] (11) layers\ngo to x: (0) y: (0)\n\nwhen flag clicked\nhide\n\nwhen I receive [go v]\nshow\ngo to [front v] layer\ngo [backward v] (11) layers\ngo to x: (0) y: (0)\nforever\n    if <(PROGRESSI) = [0]> then\n        switch costume to (costume1 v)\n    end\n    if <(PROGRESSI) = [1]> then\n        switch costume to (costume2 v)\n    end\n    if <(PROGRESSI) = [2]> then\n        switch costume to (stage3 v)\n    end\n    if <(PROGRESSI) = [3]> then\n        switch costume to (stage2 v)\n    end\n    if <(PROGRESSI) = [4]> then\n        switch costume to (stage4 v)\n    end\n    if <(PROGRESSI) = [5]> then\n        switch costume to (stage5 v)\n    end\n    if <(PROGRESSI) = [6]> then\n        switch costume to (stage6 v)\n    end\n    if <(PROGRESSI) = [7]> then\n        switch costume to (stage7 v)\n    end\n    if <(PROGRESSI) = [8]> then\n        switch costume to (stage8 v)\n    end\n    if <(PROGRESSI) = [9]> then\n        switch costume to (stage9 v)\n    end\n    if <(PROGRESSI) = [10]> then\n        switch costume to (stage10 v)\n    end\n    if <(PROGRESSI) = [11]> then\n        switch costume to (stage11 v)\n    end\n    if <(PROGRESSI) = [12]> then\n        switch costume to (stage12 v)\n    end\n    if <(PROGRESSI) = [13]> then\n        switch costume to (stage13 v)\n    end\n    if <(PROGRESSI) = [14]> then\n        switch costume to (stage14 v)\n    end\n    if <(PROGRESSI) = [15]> then\n        switch costume to (stage15 v)\n    end\n    if <(PROGRESSI) = [16]> then\n        switch costume to (stage16 v)\n    end\n    if <(PROGRESSI) = [17]> then\n        switch costume to (stage17 v)\n    end\n    if <(PROGRESSI) = [18]> then\n        switch costume to (stage18 v)\n    end\n    if <(PROGRESSI) = [19]> then\n        switch costume to (stage19 v)\n    end\n    if <(PROGRESSI) = [20]> then\n        switch costume to (stage20 v)\n    end\n    if <(PROGRESSI) = [21]> then\n        switch costume to (stage21 v)\n    end\n    if <(PROGRESSI) = [22]> then\n        switch costume to (stage22 v)\n    end\nend\n\nwhen I receive [very end v]\nhide\n\n@stage1_2\n\nwhen I receive [restart v]\ngo to x: (0) y: (0)\ngo to [front v] layer\ngo [backward v] (10) layers\n\nwhen flag clicked\nhide\n\nwhen I receive [go v]\nshow\ngo to x: (0) y: (0)\ngo to [front v] layer\ngo [backward v] (10) layers\nforever\n    if <(PROGRESSI) = [0]> then\n        switch costume to (stage1_2 v)\n    end\n    if <(PROGRESSI) = [1]> then\n        switch costume to (stage1_2 v)\n    end\n    if <(PROGRESSI) = [2]> then\n        switch costume to (stage2_2 v)\n    end\n    if <(PROGRESSI) = [3]> then\n        switch costume to (stage2_2 v)\n    end\n    if <(PROGRESSI) = [4]> then\n        switch costume to (stage3_2 v)\n    end\n    if <(PROGRESSI) = [5]> then\n        switch costume to (stage3_2 v)\n    end\n    if <(PROGRESSI) = [6]> then\n        switch costume to (stage4_2 v)\n    end\n    if <(PROGRESSI) = [7]> then\n        switch costume to (stage4_2 v)\n    end\n    if <(PROGRESSI) = [8]> then\n        switch costume to (stage5_2 v)\n    end\n    if <(PROGRESSI) = [9]> then\n        switch costume to (stage5_2 v)\n    end\n    if <(PROGRESSI) = [10]> then\n        switch costume to (stage6_2 v)\n    end\n    if <(PROGRESSI) = [11]> then\n        switch costume to (stage6_2 v)\n    end\n    if <(PROGRESSI) = [12]> then\n        switch costume to (stage7_2 v)\n    end\n    if <(PROGRESSI) = [13]> then\n        switch costume to (stage7_2 v)\n    end\n    if <(PROGRESSI) = [14]> then\n        switch costume to (stage8_2 v)\n    end\n    if <(PROGRESSI) = [15]> then\n        switch costume to (stage8_2 v)\n    end\n    if <(PROGRESSI) = [16]> then\n        switch costume to (stage9_2 v)\n    end\n    if <(PROGRESSI) = [17]> then\n        switch costume to (stage9_2 v)\n    end\n    if <(PROGRESSI) = [18]> then\n        switch costume to (stage10_2 v)\n    end\n    if <(PROGRESSI) = [19]> then\n        switch costume to (stage10_2 v)\n    end\n    if <(PROGRESSI) = [20]> then\n        switch costume to (stage11_2 v)\n    end\n    if <(PROGRESSI) = [21]> then\n        switch costume to (stage11_2 v)\n    end\n    if <(PROGRESSI) = [22]> then\n        switch costume to (stage12_2 v)\n    end\nend\n\nwhen I receive [very end v]\nhide\n\n@Door_01\n\ndefine Destroyed\nbroadcast (DOOR_DESTROYED v)\nset [brightness v] effect to (25)\nwait (0.1) seconds\nset [costume v] to ((Costume) + (1))\nswitch costume to (Costume)\nwait (0.01) seconds\nset [costume v] to ((Costume) + (1))\nswitch costume to (Costume)\nwait (0.01) seconds\nset [costume v] to ((Costume) + (1))\nswitch costume to (Costume)\nwait (0.01) seconds\nset [progressi v] to ((PROGRESSI) + (1))\nset [costume v] to ((Costume) + (1))\nswitch costume to (Costume)\nwait (0.01) seconds\nset [costume v] to ((Costume) + (1))\nswitch costume to (Costume)\nwait (0.01) seconds\nset [costume v] to ((Costume) + (1))\nswitch costume to (Costume)\nwait (0.01) seconds\nhide\nset [brightness v] effect to (0)\n\nwhen I receive [restart v]\nwait (0.05) seconds\nset [destroyed v] to [0]\nset [costume v] to [1]\ngo to x: (151) y: (106)\nswitch costume to (door_01 v)\nshow\ngo to [front v] layer\ngo [backward v] (9) layers\n\nwhen I receive [death_fall v]\nwait (0.3) seconds\nif <(PROGRESSI) = [1]> then\n    set [costume v] to [1]\n    set [destroyed v] to [0]\n    set [progressi v] to [0]\n    switch costume to (door_01 v)\n    show\nend\nif <(PROGRESSI) = [3]> then\n    set [costume v] to [1]\n    set [destroyed v] to [0]\n    set [progressi v] to [2]\n    switch costume to (door_01 v)\n    show\nend\nif <(PROGRESSI) = [5]> then\n    set [costume v] to [1]\n    set [destroyed v] to [0]\n    set [progressi v] to [4]\n    switch costume to (door_01 v)\n    show\nend\nif <(PROGRESSI) = [7]> then\n    set [costume v] to [1]\n    set [destroyed v] to [0]\n    set [progressi v] to [6]\n    switch costume to (door_01 v)\n    show\nend\nif <(PROGRESSI) = [9]> then\n    set [costume v] to [1]\n    set [destroyed v] to [0]\n    set [progressi v] to [8]\n    switch costume to (door_01 v)\n    show\nend\nif <(PROGRESSI) = [11]> then\n    set [costume v] to [1]\n    set [destroyed v] to [0]\n    set [progressi v] to [10]\n    switch costume to (door_01 v)\n    show\nend\nif <(PROGRESSI) = [13]> then\n    set [costume v] to [1]\n    set [destroyed v] to [0]\n    set [progressi v] to [12]\n    switch costume to (door_01 v)\n    show\nend\nif <(PROGRESSI) = [15]> then\n    set [costume v] to [1]\n    set [destroyed v] to [0]\n    set [progressi v] to [14]\n    switch costume to (door_01 v)\n    show\nend\nif <(PROGRESSI) = [17]> then\n    set [costume v] to [1]\n    set [destroyed v] to [0]\n    set [progressi v] to [16]\n    switch costume to (door_01 v)\n    show\nend\nif <(PROGRESSI) = [19]> then\n    set [costume v] to [1]\n    set [destroyed v] to [0]\n    set [progressi v] to [18]\n    switch costume to (door_01 v)\n    show\nend\nif <(PROGRESSI) = [21]> then\n    set [costume v] to [1]\n    set [destroyed v] to [0]\n    set [progressi v] to [20]\n    switch costume to (door_01 v)\n    show\nend\n\nwhen I receive [level_change v]\nif <(PROGRESSI) = [2]> then\n    set [costume v] to [1]\n    set [destroyed v] to [0]\n    switch costume to (door_01 v)\n    go to x: (220) y: (107)\n    show\nend\nif <(PROGRESSI) = [4]> then\n    set [costume v] to [1]\n    set [destroyed v] to [0]\n    switch costume to (door_01 v)\n    go to x: (227) y: (-123)\n    show\nend\nif <(PROGRESSI) = [6]> then\n    set [costume v] to [1]\n    set [destroyed v] to [0]\n    switch costume to (door_01 v)\n    go to x: (57) y: (107)\n    show\nend\nif <(PROGRESSI) = [8]> then\n    set [costume v] to [1]\n    set [destroyed v] to [0]\n    switch costume to (door_01 v)\n    go to x: (200) y: (-120)\n    show\nend\nif <(PROGRESSI) = [10]> then\n    set [costume v] to [1]\n    set [destroyed v] to [0]\n    switch costume to (door_01 v)\n    go to x: (225) y: (124)\n    show\nend\nif <(PROGRESSI) = [12]> then\n    set [costume v] to [1]\n    set [destroyed v] to [0]\n    switch costume to (door_01 v)\n    go to x: (207) y: (-111)\n    show\nend\nif <(PROGRESSI) = [14]> then\n    set [costume v] to [1]\n    set [destroyed v] to [0]\n    switch costume to (door_01 v)\n    go to x: (226) y: (-111)\n    show\nend\nif <(PROGRESSI) = [16]> then\n    set [costume v] to [1]\n    set [destroyed v] to [0]\n    switch costume to (door_01 v)\n    go to x: (227) y: (106)\n    show\nend\nif <(PROGRESSI) = [18]> then\n    set [costume v] to [1]\n    set [destroyed v] to [0]\n    switch costume to (door_01 v)\n    go to x: (227) y: (-111)\n    show\nend\nif <(PROGRESSI) = [20]> then\n    set [costume v] to [1]\n    set [destroyed v] to [0]\n    switch costume to (door_01 v)\n    go to x: (227) y: (106)\n    show\nend\nif <(PROGRESSI) = [22]> then\n    hide\n    set [costume v] to [1]\n    set [destroyed v] to [1]\n    switch costume to (door_01 v)\nend\n\nwhen flag clicked\nhide\n\nwhen I receive [go v]\nwait (0.05) seconds\nset [destroyed v] to [0]\nset [costume v] to [1]\ngo to x: (151) y: (106)\nswitch costume to (door_01 v)\nshow\ngo to [front v] layer\ngo [backward v] (9) layers\nforever\n    if <<(PAUSE) = [0]> and <(Destroyed) = [0]>> then\n        if <touching (cube_01 v)?> then\n            if <(Sprite_N) > [3]> then\n                set [destroyed v] to [1]\n                Destroyed\n            end\n        end\n    end\nend\n\n@Enemy_1_01\n\nwhen I receive [end_fire_1 v]\nif <(firing) < [2]> then\n    set [firing v] to [0]\n    set [contatore v] to [0]\nend\n\ndefine Destroyed\nbroadcast (DESTROYED v)\nset [brightness v] effect to (25)\nwait (0.1) seconds\nset [costume v] to [3]\nswitch costume to (Costume)\nif <([direction v] of [cube_01 v]) = [90]> then\n    change x by (20)\nelse\n    change x by (-20)\nend\nwait (0.01) seconds\nset [costume v] to ((Costume) + (1))\nswitch costume to (Costume)\nwait (0.01) seconds\nset [costume v] to ((Costume) + (1))\nswitch costume to (Costume)\nwait (0.01) seconds\nset [costume v] to ((Costume) + (1))\nswitch costume to (Costume)\nwait (0.01) seconds\nset [costume v] to ((Costume) + (1))\nswitch costume to (Costume)\nwait (0.01) seconds\nset [costume v] to ((Costume) + (1))\nswitch costume to (Costume)\nwait (0.01) seconds\nset [costume v] to ((Costume) + (1))\nswitch costume to (Costume)\nwait (0.01) seconds\nset [costume v] to ((Costume) + (1))\nswitch costume to (Costume)\nwait (0.01) seconds\nset [costume v] to ((Costume) + (1))\nswitch costume to (Costume)\nwait (0.01) seconds\nset [costume v] to ((Costume) + (1))\nswitch costume to (Costume)\nwait (0.01) seconds\nhide\nset [brightness v] effect to (0)\n\ndefine Fire\nswitch costume to (enemy_1_02 v)\nset [firing v] to [1]\nbroadcast (FIRE_1 v)\n\nwhen I receive [death_fall v]\nwait (0.3) seconds\nset [firing v] to [0]\nset [contatore v] to [0]\nswitch costume to (enemy_1_01 v)\nif <(PROGRESSI) < [2]> then\n    point in direction (90)\n    go to x: ((X_Sinistra) + (1)) y: (y position)\n    show\nend\nif <<(PROGRESSI) = [2]> or <(PROGRESSI) = [3]>> then\n    point in direction (90)\n    go to x: ((X_Sinistra) + (1)) y: (y position)\n    show\nend\nif <<(PROGRESSI) = [4]> or <(PROGRESSI) = [5]>> then\n    point in direction (-90)\n    go to x: ((X_destra) - (1)) y: (y position)\n    show\nend\nif <<(PROGRESSI) = [6]> or <(PROGRESSI) = [7]>> then\n    set [firing v] to [2]\n    hide\nend\nif <<(PROGRESSI) = [8]> or <(PROGRESSI) = [9]>> then\n    hide\n    set [firing v] to [2]\nend\nif <<(PROGRESSI) = [10]> or <(PROGRESSI) = [11]>> then\n    point in direction (-90)\n    go to x: ((X_destra) - (1)) y: (y position)\n    show\nend\nif <<(PROGRESSI) = [12]> or <(PROGRESSI) = [13]>> then\n    point in direction (-90)\n    go to x: ((X_destra) - (1)) y: (y position)\n    show\nend\nif <<(PROGRESSI) = [14]> or <(PROGRESSI) = [15]>> then\n    hide\n    set [firing v] to [2]\nend\nif <<(PROGRESSI) = [16]> or <(PROGRESSI) = [17]>> then\n    point in direction (-90)\n    go to x: ((X_destra) - (1)) y: (y position)\n    show\nend\nif <<(PROGRESSI) = [18]> or <(PROGRESSI) = [19]>> then\n    point in direction (-90)\n    go to x: ((X_destra) - (1)) y: (y position)\n    show\nend\nif <<(PROGRESSI) = [20]> or <(PROGRESSI) = [21]>> then\n    point in direction (-90)\n    go to x: ((X_destra) - (1)) y: (y position)\n    show\nend\nif <(PROGRESSI) = [22]> then\n    hide\n    set [firing v] to [2]\nend\n\nwhen I receive [level_change v]\nset rotation style [left-right v]\nset [firing v] to [0]\nset [contatore v] to [0]\nset [restart_speed v] to [0]\nset [velocità v] to (Velocità_max)\npoint in direction (90)\nswitch costume to (enemy_1_01 v)\nif <(PROGRESSI) = [2]> then\n    set [visible v] to [1]\n    go to x: (-146) y: (-121)\n    set [x_sinistra v] to [-146]\n    set [x_destra v] to [19]\n    show\nend\nif <(PROGRESSI) = [4]> then\n    set [visible v] to [1]\n    go to x: (108) y: (107)\n    set [x_sinistra v] to [-49]\n    set [x_destra v] to [108]\n    show\nend\nif <(PROGRESSI) = [6]> then\n    set [visible v] to [0]\n    set [firing v] to [2]\n    hide\nend\nif <(PROGRESSI) = [8]> then\n    set [visible v] to [0]\n    set [firing v] to [2]\n    hide\nend\nif <(PROGRESSI) = [10]> then\n    set [velocità_max v] to [3]\n    set [delay v] to [12]\n    set [visible v] to [1]\n    go to x: (-101) y: (-107)\n    set [x_sinistra v] to [-207]\n    set [x_destra v] to [-107]\n    show\nend\nif <(PROGRESSI) = [12]> then\n    set [velocità_max v] to [3]\n    set [delay v] to [15]\n    set [visible v] to [1]\n    go to x: (156) y: (125)\n    set [x_sinistra v] to [-21]\n    set [x_destra v] to [156]\n    show\nend\nif <(PROGRESSI) = [14]> then\n    set [visible v] to [0]\n    set [firing v] to [2]\n    hide\nend\nif <(PROGRESSI) = [16]> then\n    set [velocità_max v] to [4]\n    set [delay v] to [12]\n    set [visible v] to [1]\n    go to x: (161) y: (109)\n    set [x_sinistra v] to [-37]\n    set [x_destra v] to [161]\n    show\nend\nif <(PROGRESSI) = [18]> then\n    set [velocità_max v] to [4]\n    set [delay v] to [10]\n    set [visible v] to [1]\n    go to x: (170) y: (-112)\n    set [x_sinistra v] to [-56]\n    set [x_destra v] to [170]\n    show\nend\nif <(PROGRESSI) = [20]> then\n    set [velocità_max v] to [4]\n    set [delay v] to [10]\n    set [visible v] to [1]\n    go to x: (170) y: (-112)\n    set [x_sinistra v] to [-56]\n    set [x_destra v] to [170]\n    show\nend\nif <(PROGRESSI) = [22]> then\n    set [visible v] to [0]\n    set [firing v] to [2]\n    hide\nend\n\nwhen I receive [restart v]\nset [visible v] to [1]\nset [x_sinistra v] to [-151]\nset [x_destra v] to [-75]\nset rotation style [left-right v]\nset [firing v] to [0]\nset [delay v] to [20]\nset [contatore v] to [0]\nset [h v] to [30]\nset [restart_speed v] to [0]\nset [dy v] to [60]\nset [velocità_max v] to [2]\nset [velocità v] to (Velocità_max)\ngo to x: (-151) y: (67)\npoint in direction (90)\nshow\ngo to [front v] layer\ngo [backward v] (2) layers\nswitch costume to (enemy_1_01 v)\n\nwhen flag clicked\nhide\n\nwhen I receive [go v]\nshow\nset [visible v] to [1]\nset [x_sinistra v] to [-151]\nset [x_destra v] to [-75]\nset rotation style [left-right v]\nset [firing v] to [0]\nset [delay v] to [20]\nset [contatore v] to [0]\nset [h v] to [30]\nset [restart_speed v] to [0]\nset [dy v] to [60]\nset [velocità_max v] to [2]\nset [velocità v] to (Velocità_max)\ngo to x: (-151) y: (67)\npoint in direction (90)\nshow\ngo to [front v] layer\ngo [backward v] (2) layers\nswitch costume to (enemy_1_01 v)\nforever\n    if <<(PAUSE) = [0]> and <(Visible) = [1]>> then\n        if <<touching (cube_01 v)?> and <(Sprite_N) > [3]>> then\n            set [firing v] to [2]\n            Destroyed\n        else\n            if <(firing) = [1]> then\n                if <([abs v] of (([x position v] of [enemy_1_03_laser v]) - (x position)) ) > [40]> then\n                    switch costume to (enemy_1_01 v)\n                end\n            else\n                switch costume to (enemy_1_01 v)\n            end\n            change x by (Velocità)\n            if <(x position) < (X_Sinistra)> then\n                set [velocità v] to (Velocità_max)\n                point in direction (90)\n            end\n            if <(x position) > (X_destra)> then\n                set [velocità v] to ((Velocità_max) * (-1))\n                point in direction (-90)\n            end\n            if <<(([y position v] of [sprite1 v]) + (H)) > ((y position) - (DY))> and <(([y position v] of [sprite1 v]) + (H)) < ((y position) + (DY))>> then\n                set [contatore v] to ((Contatore) + (1))\n                if <not <(Velocità) = [0]>> then\n                    set [restart_speed v] to (Velocità)\n                end\n                set [velocità v] to [0]\n                point towards (sprite1 v)\n                if <<(Contatore) = (Delay)> and <(firing) = [0]>> then\n                    Fire\n                end\n            else\n                set [contatore v] to [0]\n                if <(Velocità) = [0]> then\n                    set [velocità v] to (Restart_speed)\n                    if <(Restart_speed) > [0]> then\n                        point in direction (90)\n                    else\n                        point in direction (-90)\n                    end\n                end\n            end\n        end\n    end\nend\n\n@Enemy_1_03_laser\n\ndefine animate\nswitch costume to (enemy_1_03_laser_01 v)\nwait (0.01) seconds\nswitch costume to (enemy_1_03_laser_02 v)\nwait (0.05) seconds\nswitch costume to (enemy_1_03_laser_03 v)\nwait (0.05) seconds\nswitch costume to (enemy_1_03_laser_04 v)\nwait (0.05) seconds\nhide\ngo to x: (0) y: (0)\nswitch costume to (enemy_1_03_laser v)\n\ndefine animate2\nbroadcast (Z_SOUND_2 v)\ncreate clone of (_myself_ v)\n\nwhen I receive [fire_1 v]\nshow\nset rotation style [left-right v]\nif <<([direction v] of [enemy_1_01 v]) > [0]> and <([direction v] of [enemy_1_01 v]) < [180]>> then\n    point in direction (90)\nelse\n    point in direction (-90)\nend\ngo to x: ([x position v] of [enemy_1_01 v]) y: ([y position v] of [enemy_1_01 v])\nset [moving v] to [1]\nset [rimbalzo v] to [0]\n\nwhen I receive [level_change v]\nhide\nset [rimbalzo v] to [0]\nset [moving v] to [0]\nset rotation style [left-right v]\nswitch costume to (enemy_1_03_laser v)\n\nwhen I receive [death_fall v]\nwait (0.3) seconds\nhide\nset [rimbalzo v] to [0]\nset [moving v] to [0]\nset rotation style [left-right v]\nswitch costume to (enemy_1_03_laser v)\n\nwhen I start as a clone\ngo to [front v] layer\nswitch costume to (enemy_1_03_laser_02 v)\nwait (0.01) seconds\nswitch costume to (enemy_1_03_laser_01 v)\nwait (0.01) seconds\nswitch costume to (enemy_1_03_laser v)\nset [velocità_2 v] to (((-1) * (Velocità)) * (2))\nforever\n    if <(moving) = [1]> then\n        move (Velocità_2) steps\n    end\n    if <touching (_edge_ v)?> then\n        set [moving v] to [0]\n        set [rimbalzo v] to [0]\n        hide\n        broadcast (END_FIRE_1 v)\n        delete this clone\n    end\nend\n\nwhen I receive [restart v]\nset [rimbalzo v] to [0]\nset [moving v] to [0]\nset [velocità v] to [10]\nset rotation style [left-right v]\ngo to [front v] layer\ngo [backward v] (3) layers\nhide\nswitch costume to (enemy_1_03_laser v)\n\ndefine rimbalza\nif <<([x position v] of [cube_01 v]) > (x position)> and <([direction v] of [cube_01 v]) = [-90]>> then\n    set rotation style [all around v]\n    point in direction (pick random (75) to (135))\n    go to x: ((x position) - (10)) y: (y position)\n    set [velocità_2 v] to [0]\n    set [rimbalzo v] to [1]\n    animate2\nelse\n    if <<([x position v] of [cube_01 v]) < (x position)> and <([direction v] of [cube_01 v]) = [90]>> then\n        set rotation style [all around v]\n        point in direction (pick random (-135) to (-75))\n        go to x: ((x position) + (10)) y: (y position)\n        set [velocità_2 v] to [0]\n        set [rimbalzo v] to [1]\n        animate2\n    else\n        set [rimbalzo v] to [0]\n        set [vx v] to [0]\n        set [vy v] to [0]\n        set [moving v] to [0]\n        broadcast (DEATH_1 v)\n        animate\n        broadcast (END_FIRE_1 v)\n    end\nend\n\nwhen flag clicked\nhide\n\nwhen I receive [go v]\nset [rimbalzo v] to [0]\nset [moving v] to [0]\nset [velocità v] to [10]\nset rotation style [left-right v]\ngo to [front v] layer\ngo [backward v] (3) layers\nhide\nswitch costume to (enemy_1_03_laser v)\nforever\n    if <(PAUSE) = [0]> then\n        if <(rimbalzo) = [0]> then\n            if <(moving) = [1]> then\n                move (Velocità) steps\n            end\n            if <touching (sprite1 v)?> then\n                if <(Sprite_N) > [2]> then\n                    rimbalza\n                else\n                    set [vx v] to [0]\n                    set [vy v] to [0]\n                    set [moving v] to [0]\n                    broadcast (DEATH_1 v)\n                    animate\n                    broadcast (END_FIRE_1 v)\n                end\n            else\n                if <touching (sprite2 v)?> then\n                    set [moving v] to [0]\n                    animate\n                    broadcast (END_FIRE_1 v)\n                end\n                if <touching (door_01 v)?> then\n                    if <([costume # v] of [door_01 v]) < [4]> then\n                        set [moving v] to [0]\n                        animate\n                        broadcast (END_FIRE_1 v)\n                    end\n                end\n                if <touching (_edge_ v)?> then\n                    set [moving v] to [0]\n                    hide\n                    animate\n                    broadcast (END_FIRE_1 v)\n                end\n            end\n        else\n            hide\n        end\n    end\nend\n\n@plaat_01\n\nwhen flag clicked\nhide\ngo to [front v] layer\ngo [backward v] (6) layers\nset [visible v] to [0]\nset [y_giu v] to [0]\nset [y_su v] to [0]\nset [vy_addizionale v] to [4]\nforever\n    set [delta_y v] to ((y position) - ([y position v] of [cube_01 v]))\n    if <(PROGRESSI) < [2]> then\n        hide\n    end\n    if <<(PROGRESSI) = [2]> or <(PROGRESSI) = [3]>> then\n        if <(PAUSE) = [0]> then\n            show\n            change y by (VY_addizionale)\n            if <(y position) < (Y_giu)> then\n                set [vy_addizionale v] to ((VY_addizionale) * (-1))\n            end\n            if <(y position) > (Y_su)> then\n                set [vy_addizionale v] to ((VY_addizionale) * (-1))\n            end\n        end\n    end\n    if <<(PROGRESSI) = [4]> or <(PROGRESSI) = [5]>> then\n        hide\n    end\n    if <<(PROGRESSI) = [6]> or <(PROGRESSI) = [7]>> then\n        hide\n    end\n    if <<(PROGRESSI) = [8]> or <(PROGRESSI) = [9]>> then\n        hide\n    end\n    if <<(PROGRESSI) = [10]> or <(PROGRESSI) = [11]>> then\n        if <(PAUSE) = [0]> then\n            show\n            change y by (VY_addizionale)\n            if <(y position) < (Y_giu)> then\n                set [vy_addizionale v] to ((VY_addizionale) * (-1))\n            end\n            if <(y position) > (Y_su)> then\n                set [vy_addizionale v] to ((VY_addizionale) * (-1))\n            end\n        end\n    end\n    if <<(PROGRESSI) = [12]> or <(PROGRESSI) = [13]>> then\n        hide\n    end\n    if <<(PROGRESSI) = [14]> or <(PROGRESSI) = [15]>> then\n        hide\n    end\n    if <<(PROGRESSI) = [16]> or <(PROGRESSI) = [17]>> then\n        hide\n    end\n    if <<(PROGRESSI) = [18]> or <(PROGRESSI) = [19]>> then\n        hide\n    end\n    if <<(PROGRESSI) = [20]> or <(PROGRESSI) = [21]>> then\n        hide\n    end\n    if <(PROGRESSI) = [22]> then\n        hide\n    end\nend\n\nwhen I receive [level_change v]\nif <(PROGRESSI) < [2]> then\n    hide\nend\nif <<(PROGRESSI) = [2]> or <(PROGRESSI) = [3]>> then\n    go to [front v] layer\n    go [backward v] (6) layers\n    show\n    go to x: (106) y: (-141)\n    set [y_giu v] to [-141]\n    set [y_su v] to [44]\nend\nif <<(PROGRESSI) = [4]> or <(PROGRESSI) = [5]>> then\n    hide\nend\nif <<(PROGRESSI) = [6]> or <(PROGRESSI) = [7]>> then\n    hide\nend\nif <<(PROGRESSI) = [8]> or <(PROGRESSI) = [9]>> then\n    hide\nend\nif <<(PROGRESSI) = [10]> or <(PROGRESSI) = [11]>> then\n    go to [front v] layer\n    go [backward v] (6) layers\n    show\n    go to x: (12) y: (120)\n    set [y_giu v] to [-140]\n    set [y_su v] to [120]\nend\nif <<(PROGRESSI) = [12]> or <(PROGRESSI) = [13]>> then\n    hide\nend\nif <<(PROGRESSI) = [14]> or <(PROGRESSI) = [15]>> then\n    hide\nend\nif <<(PROGRESSI) = [16]> or <(PROGRESSI) = [17]>> then\n    hide\nend\nif <<(PROGRESSI) = [18]> or <(PROGRESSI) = [19]>> then\n    hide\nend\nif <<(PROGRESSI) = [20]> or <(PROGRESSI) = [21]>> then\n    hide\nend\nif <(PROGRESSI) = [22]> then\n    hide\nend\n\nwhen I receive [restart v]\nhide\ngo to [front v] layer\ngo [backward v] (6) layers\nset [visible v] to [0]\nset [y_giu v] to [0]\nset [y_su v] to [0]\nset [vy_addizionale v] to [4]\n\n@plaat_01_shadow\n\nwhen flag clicked\ngo to [front v] layer\ngo [backward v] (8) layers\nforever\n    go to x: ([x position v] of [plaat_01 v]) y: ([y position v] of [plaat_01 v])\n    if <(PROGRESSI) < [2]> then\n        hide\n    end\n    if <<(PROGRESSI) = [2]> or <(PROGRESSI) = [3]>> then\n        show\n    end\n    if <<(PROGRESSI) = [4]> or <(PROGRESSI) = [5]>> then\n        hide\n    end\n    if <<(PROGRESSI) = [6]> or <(PROGRESSI) = [7]>> then\n        hide\n    end\n    if <<(PROGRESSI) = [8]> or <(PROGRESSI) = [9]>> then\n        hide\n    end\n    if <<(PROGRESSI) = [10]> or <(PROGRESSI) = [11]>> then\n        show\n    end\n    if <<(PROGRESSI) = [12]> or <(PROGRESSI) = [13]>> then\n        hide\n    end\n    if <<(PROGRESSI) = [14]> or <(PROGRESSI) = [15]>> then\n        hide\n    end\n    if <<(PROGRESSI) = [16]> or <(PROGRESSI) = [17]>> then\n        hide\n    end\n    if <<(PROGRESSI) = [18]> or <(PROGRESSI) = [19]>> then\n        hide\n    end\n    if <<(PROGRESSI) = [20]> or <(PROGRESSI) = [21]>> then\n        hide\n    end\n    if <(PROGRESSI) = [22]> then\n        hide\n    end\nend\n\nwhen I receive [restart v]\ngo to [front v] layer\ngo [backward v] (8) layers\n\n@Enemy_1_2\n\nwhen flag clicked\nset [visible v] to [0]\nset [x_sinistra v] to [-151]\nset [x_destra v] to [-75]\nset rotation style [left-right v]\nset [firing v] to [2]\nset [delay v] to [15]\nset [contatore v] to [0]\nset [h v] to [30]\nset [restart_speed v] to [0]\nset [dy v] to [60]\nset [velocità_max v] to [3]\nset [velocità v] to (Velocità_max)\ngo to x: (-151) y: (67)\npoint in direction (90)\ngo to [front v] layer\ngo [backward v] (4) layers\nhide\nswitch costume to (enemy_1_01 v)\nforever\n    if <<(PAUSE) = [0]> and <(Visible) = [1]>> then\n        if <<touching (cube_01 v)?> and <(Sprite_N) > [3]>> then\n            set [firing v] to [2]\n            Destroyed\n        else\n            if <(firing) = [1]> then\n                if <([abs v] of (([x position v] of [enemy_1_03_laser2 v]) - (x position)) ) > [40]> then\n                    switch costume to (enemy_1_01 v)\n                end\n            else\n                switch costume to (enemy_1_01 v)\n            end\n            change x by (Velocità)\n            if <(x position) < (X_Sinistra)> then\n                set [velocità v] to (Velocità_max)\n                point in direction (90)\n            end\n            if <(x position) > (X_destra)> then\n                set [velocità v] to ((Velocità_max) * (-1))\n                point in direction (-90)\n            end\n            if <<(([y position v] of [sprite1 v]) + (H)) > ((y position) - (DY))> and <(([y position v] of [sprite1 v]) + (H)) < ((y position) + (DY))>> then\n                set [contatore v] to ((Contatore) + (1))\n                if <not <(Velocità) = [0]>> then\n                    set [restart_speed v] to (Velocità)\n                end\n                set [velocità v] to [0]\n                point towards (sprite1 v)\n                if <<(Contatore) = (Delay)> and <(firing) = [0]>> then\n                    Fire\n                end\n            else\n                set [contatore v] to [0]\n                if <(Velocità) = [0]> then\n                    set [velocità v] to (Restart_speed)\n                    if <(Restart_speed) > [0]> then\n                        point in direction (90)\n                    else\n                        point in direction (-90)\n                    end\n                end\n            end\n        end\n    end\nend\n\ndefine Fire\nswitch costume to (enemy_1_02 v)\nset [firing v] to [1]\nbroadcast (FIRE_2 v)\n\ndefine Destroyed\nbroadcast (DESTROYED v)\nset [brightness v] effect to (25)\nwait (0.1) seconds\nset [costume v] to [3]\nswitch costume to (Costume)\nwait (0.01) seconds\nif <([direction v] of [cube_01 v]) = [90]> then\n    change x by (20)\nelse\n    change x by (-20)\nend\nset [costume v] to ((Costume) + (1))\nswitch costume to (Costume)\nwait (0.01) seconds\nset [costume v] to ((Costume) + (1))\nswitch costume to (Costume)\nwait (0.01) seconds\nset [costume v] to ((Costume) + (1))\nswitch costume to (Costume)\nwait (0.01) seconds\nset [costume v] to ((Costume) + (1))\nswitch costume to (Costume)\nwait (0.01) seconds\nset [costume v] to ((Costume) + (1))\nswitch costume to (Costume)\nwait (0.01) seconds\nset [costume v] to ((Costume) + (1))\nswitch costume to (Costume)\nwait (0.01) seconds\nset [costume v] to ((Costume) + (1))\nswitch costume to (Costume)\nwait (0.01) seconds\nset [costume v] to ((Costume) + (1))\nswitch costume to (Costume)\nwait (0.01) seconds\nset [costume v] to ((Costume) + (1))\nswitch costume to (Costume)\nwait (0.01) seconds\nhide\nset [brightness v] effect to (0)\n\nwhen I receive [level_change v]\nset rotation style [left-right v]\nset [firing v] to [0]\nset [contatore v] to [0]\nset [restart_speed v] to [0]\nset [velocità v] to (Velocità_max)\npoint in direction (90)\nswitch costume to (enemy_1_01 v)\nif <(PROGRESSI) < [4]> then\n    hide\n    set [firing v] to [2]\n    set [visible v] to [0]\nend\nif <(PROGRESSI) = [4]> then\n    show\n    go to [front v] layer\n    go [backward v] (1) layers\n    set [firing v] to [0]\n    go to x: (-126) y: (1)\n    set [x_sinistra v] to [-126]\n    set [x_destra v] to [59]\n    set [visible v] to [1]\nend\nif <(PROGRESSI) = [6]> then\n    show\n    go to [front v] layer\n    go [backward v] (1) layers\n    set [firing v] to [0]\n    go to x: (-111) y: (37)\n    set [x_sinistra v] to [-111]\n    set [x_destra v] to [-34]\n    set [delay v] to [10]\n    set [visible v] to [1]\nend\nif <(PROGRESSI) = [8]> then\n    hide\n    set [firing v] to [2]\n    set [visible v] to [0]\nend\nif <(PROGRESSI) = [10]> then\n    hide\n    set [firing v] to [2]\n    set [visible v] to [0]\nend\nif <(PROGRESSI) = [12]> then\n    hide\n    set [firing v] to [2]\n    set [visible v] to [0]\nend\nif <(PROGRESSI) = [14]> then\n    hide\n    set [firing v] to [2]\n    set [visible v] to [0]\nend\nif <(PROGRESSI) = [16]> then\n    hide\n    set [firing v] to [2]\n    set [visible v] to [0]\nend\nif <(PROGRESSI) = [18]> then\n    show\n    go to [front v] layer\n    go [backward v] (1) layers\n    set [firing v] to [0]\n    go to x: (171) y: (108)\n    set [x_sinistra v] to [70]\n    set [x_destra v] to [171]\n    set [delay v] to [10]\n    set [visible v] to [1]\n    set [velocità_max v] to [3]\nend\nif <(PROGRESSI) = [20]> then\n    show\n    go to [front v] layer\n    go [backward v] (1) layers\n    set [firing v] to [0]\n    go to x: (171) y: (108)\n    set [x_sinistra v] to [70]\n    set [x_destra v] to [171]\n    set [delay v] to [10]\n    set [visible v] to [1]\n    set [velocità_max v] to [3]\nend\nif <(PROGRESSI) = [22]> then\n    hide\n    set [firing v] to [2]\n    set [visible v] to [0]\nend\n\nwhen I receive [death_fall v]\nwait (0.3) seconds\nset [firing v] to [0]\nset [contatore v] to [0]\nswitch costume to (enemy_1_01 v)\nif <(PROGRESSI) < [4]> then\n    hide\n    set [firing v] to [2]\nend\nif <<(PROGRESSI) = [4]> or <(PROGRESSI) = [5]>> then\n    show\n    set [firing v] to [0]\n    point in direction (-90)\n    go to x: ((X_destra) - (1)) y: (y position)\nend\nif <<(PROGRESSI) = [6]> or <(PROGRESSI) = [7]>> then\n    show\n    set [firing v] to [0]\n    point in direction (-90)\n    go to x: ((X_destra) - (1)) y: (y position)\nend\nif <<(PROGRESSI) = [8]> or <(PROGRESSI) = [9]>> then\n    hide\n    set [firing v] to [2]\nend\nif <<(PROGRESSI) = [10]> or <(PROGRESSI) = [11]>> then\n    hide\n    set [firing v] to [2]\nend\nif <<(PROGRESSI) = [12]> or <(PROGRESSI) = [13]>> then\n    hide\n    set [firing v] to [2]\nend\nif <<(PROGRESSI) = [14]> or <(PROGRESSI) = [15]>> then\n    hide\n    set [firing v] to [2]\nend\nif <<(PROGRESSI) = [16]> or <(PROGRESSI) = [17]>> then\n    hide\n    set [firing v] to [2]\nend\nif <<(PROGRESSI) = [18]> or <(PROGRESSI) = [19]>> then\n    show\n    set [firing v] to [0]\n    point in direction (-90)\n    go to x: ((X_destra) + (1)) y: (y position)\nend\nif <<(PROGRESSI) = [20]> or <(PROGRESSI) = [21]>> then\n    show\n    set [firing v] to [0]\n    point in direction (-90)\n    go to x: ((X_destra) + (1)) y: (y position)\nend\nif <(PROGRESSI) = [22]> then\n    hide\n    set [firing v] to [2]\nend\n\nwhen I receive [restart v]\nset [visible v] to [0]\nset [x_sinistra v] to [-151]\nset [x_destra v] to [-75]\nset rotation style [left-right v]\nset [firing v] to [2]\nset [delay v] to [15]\nset [contatore v] to [0]\nset [h v] to [30]\nset [restart_speed v] to [0]\nset [dy v] to [60]\nset [velocità_max v] to [3]\nset [velocità v] to (Velocità_max)\ngo to x: (-151) y: (67)\npoint in direction (90)\ngo to [front v] layer\ngo [backward v] (4) layers\nhide\nswitch costume to (enemy_1_01 v)\n\nwhen I receive [end_fire_2 v]\nif <(firing) < [2]> then\n    set [firing v] to [0]\n    set [contatore v] to [0]\nend\n\n@Enemy_1_03_laser2\n\nwhen flag clicked\nset [rimbalzo v] to [0]\nset [moving v] to [0]\nset [velocità v] to [12]\nset rotation style [left-right v]\ngo to [front v] layer\ngo [backward v] (5) layers\nhide\nswitch costume to (enemy_1_03_laser v)\nforever\n    if <(PAUSE) = [0]> then\n        if <(rimbalzo) = [0]> then\n            if <(moving) = [1]> then\n                move (Velocità) steps\n            end\n            if <touching (sprite1 v)?> then\n                if <(Sprite_N) > [2]> then\n                    rimbalza\n                else\n                    set [vx v] to [0]\n                    set [vy v] to [0]\n                    set [moving v] to [0]\n                    broadcast (DEATH_1 v)\n                    animate\n                    broadcast (END_FIRE_2 v)\n                end\n            else\n                if <touching (sprite2 v)?> then\n                    set [moving v] to [0]\n                    animate\n                    broadcast (END_FIRE_2 v)\n                end\n                if <touching (door_01 v)?> then\n                    if <([costume # v] of [door_01 v]) < [4]> then\n                        set [moving v] to [0]\n                        animate\n                        broadcast (END_FIRE_2 v)\n                    end\n                end\n                if <touching (_edge_ v)?> then\n                    set [moving v] to [0]\n                    hide\n                    animate\n                    broadcast (END_FIRE_2 v)\n                end\n            end\n        else\n            hide\n        end\n    end\nend\n\ndefine animate\nswitch costume to (enemy_1_03_laser_01 v)\nwait (0.01) seconds\nswitch costume to (enemy_1_03_laser_02 v)\nwait (0.05) seconds\nswitch costume to (enemy_1_03_laser_03 v)\nwait (0.05) seconds\nswitch costume to (enemy_1_03_laser_04 v)\nwait (0.05) seconds\nhide\ngo to x: (0) y: (0)\nswitch costume to (enemy_1_03_laser v)\n\ndefine animate2\ncreate clone of (_myself_ v)\n\nwhen I receive [level_change v]\nhide\nset [rimbalzo v] to [0]\nset [moving v] to [0]\nset rotation style [left-right v]\nswitch costume to (enemy_1_03_laser v)\n\nwhen I receive [death_fall v]\nwait (0.3) seconds\nhide\nset [rimbalzo v] to [0]\nset [moving v] to [0]\nset rotation style [left-right v]\nswitch costume to (enemy_1_03_laser v)\n\nwhen I start as a clone\ngo to [front v] layer\nswitch costume to (enemy_1_03_laser_02 v)\nwait (0.01) seconds\nswitch costume to (enemy_1_03_laser_01 v)\nwait (0.01) seconds\nswitch costume to (enemy_1_03_laser v)\nset [velocità_2 v] to (((-1) * (Velocità)) * (2))\nforever\n    if <(moving) = [1]> then\n        move (Velocità_2) steps\n    end\n    if <touching (_edge_ v)?> then\n        set [moving v] to [0]\n        set [rimbalzo v] to [0]\n        hide\n        broadcast (END_FIRE_2 v)\n        delete this clone\n    end\nend\n\nwhen I receive [restart v]\nset [rimbalzo v] to [0]\nset [moving v] to [0]\nset [velocità v] to [12]\nset rotation style [left-right v]\ngo to [front v] layer\ngo [backward v] (5) layers\nhide\nswitch costume to (enemy_1_03_laser v)\n\nwhen I receive [fire_2 v]\nshow\ngo to [front v] layer\ngo [backward v] (2) layers\nset rotation style [left-right v]\nif <<([direction v] of [enemy_1_2 v]) > [0]> and <([direction v] of [enemy_1_2 v]) < [180]>> then\n    point in direction (90)\nelse\n    point in direction (-90)\nend\ngo to x: ([x position v] of [enemy_1_2 v]) y: ([y position v] of [enemy_1_2 v])\nset [moving v] to [1]\nset [rimbalzo v] to [0]\n\ndefine rimbalza\nif <<([x position v] of [cube_01 v]) > (x position)> and <([direction v] of [cube_01 v]) = [-90]>> then\n    set rotation style [all around v]\n    point in direction (pick random (75) to (135))\n    go to x: ((x position) - (10)) y: (y position)\n    set [velocità_2 v] to [0]\n    set [rimbalzo v] to [1]\n    animate2\nelse\n    if <<([x position v] of [cube_01 v]) < (x position)> and <([direction v] of [cube_01 v]) = [90]>> then\n        set rotation style [all around v]\n        point in direction (pick random (-135) to (-75))\n        go to x: ((x position) + (10)) y: (y position)\n        set [velocità_2 v] to [0]\n        set [rimbalzo v] to [1]\n        animate2\n    else\n        set [rimbalzo v] to [0]\n        set [vx v] to [0]\n        set [vy v] to [0]\n        set [moving v] to [0]\n        broadcast (DEATH_1 v)\n        animate\n        broadcast (END_FIRE_2 v)\n    end\nend\n\n@Enemy_1_3\n\nwhen I receive [end_fire_3 v]\nif <(firing) < [2]> then\n    set [firing v] to [0]\n    set [contatore v] to [0]\nend\n\ndefine Destroyed\nif <(dying) = [1]> then\n    broadcast (DESTROYED v)\n    set [brightness v] effect to (25)\n    wait (0.1) seconds\n    set [costume v] to [3]\n    switch costume to (Costume)\n    wait (0.01) seconds\n    if <([direction v] of [cube_01 v]) = [90]> then\n        change x by (40)\n    else\n        change x by (-40)\n    end\n    set [costume v] to ((Costume) + (1))\n    switch costume to (Costume)\n    wait (0.01) seconds\n    set [costume v] to ((Costume) + (1))\n    switch costume to (Costume)\n    wait (0.01) seconds\n    set [costume v] to ((Costume) + (1))\n    switch costume to (Costume)\n    wait (0.01) seconds\n    set [costume v] to ((Costume) + (1))\n    switch costume to (Costume)\n    wait (0.01) seconds\n    set [costume v] to ((Costume) + (1))\n    switch costume to (Costume)\n    wait (0.01) seconds\n    set [costume v] to ((Costume) + (1))\n    switch costume to (Costume)\n    wait (0.01) seconds\n    set [costume v] to ((Costume) + (1))\n    switch costume to (Costume)\n    wait (0.01) seconds\n    set [dying v] to [0]\n    hide\n    set [brightness v] effect to (0)\nend\n\ndefine Cammina_o_Fermo\nif <(Velocità) = [0]> then\n    switch costume to (enemy_1_01 v)\nelse\n    if <(Walk_Delay) = [0]> then\n        if <(Walk_Costume) > [20]> then\n            set [walk_costume v] to [11]\n        end\n        switch costume to (Walk_Costume)\n    end\n    set [walk_delay v] to ((Walk_Delay) + (1))\n    if <(Walk_Delay) > [2]> then\n        set [walk_delay v] to [0]\n        set [walk_costume v] to ((Walk_Costume) + (1))\n    end\nend\n\nwhen I receive [level_change v]\nset rotation style [left-right v]\nset [firing v] to [0]\nset [contatore v] to [0]\nset [restart_speed v] to [0]\nset [velocità v] to (Velocità_max)\npoint in direction (90)\nswitch costume to (enemy_1_01 v)\nif <(PROGRESSI) < [4]> then\n    hide\n    set [firing v] to [2]\n    set [visible v] to [0]\nend\nif <(PROGRESSI) = [4]> then\n    hide\n    set [firing v] to [2]\n    set [visible v] to [0]\nend\nif <(PROGRESSI) = [6]> then\n    set [dying v] to [0]\n    show\n    go to [front v] layer\n    go [backward v] (1) layers\n    set [firing v] to [0]\n    go to x: (206) y: (102)\n    set [x_sinistra v] to [97]\n    set [x_destra v] to [206]\n    set [delay v] to [15]\n    set [visible v] to [1]\nend\nif <(PROGRESSI) = [8]> then\n    set [dying v] to [0]\n    show\n    go to [front v] layer\n    go [backward v] (1) layers\n    set [firing v] to [0]\n    go to x: (151) y: (120)\n    set [x_sinistra v] to [17]\n    set [x_destra v] to [151]\n    set [delay v] to [10]\n    set [visible v] to [1]\nend\nif <(PROGRESSI) = [10]> then\n    set [dying v] to [0]\n    show\n    go to [front v] layer\n    go [backward v] (1) layers\n    set [firing v] to [0]\n    go to x: (175) y: (-2)\n    set [x_sinistra v] to [114]\n    set [x_destra v] to [175]\n    set [delay v] to [10]\n    set [visible v] to [1]\nend\nif <(PROGRESSI) = [12]> then\n    set [dying v] to [0]\n    show\n    go to [front v] layer\n    go [backward v] (1) layers\n    set [firing v] to [0]\n    go to x: (22) y: (-3)\n    set [x_sinistra v] to [22]\n    set [x_destra v] to [143]\n    set [delay v] to [10]\n    set [visible v] to [1]\nend\nif <(PROGRESSI) = [14]> then\n    hide\n    set [firing v] to [2]\n    set [visible v] to [0]\nend\nif <(PROGRESSI) = [16]> then\n    set [dying v] to [0]\n    show\n    go to [front v] layer\n    go [backward v] (1) layers\n    set [firing v] to [0]\n    go to x: (-159) y: (-3)\n    set [x_sinistra v] to [-159]\n    set [x_destra v] to [-64]\n    set [delay v] to [10]\n    set [visible v] to [1]\nend\nif <(PROGRESSI) = [18]> then\n    set [dying v] to [0]\n    show\n    go to [front v] layer\n    go [backward v] (1) layers\n    set [firing v] to [0]\n    go to x: (-148) y: (-3)\n    set [x_sinistra v] to [-148]\n    set [x_destra v] to [-76]\n    set [delay v] to [10]\n    set [visible v] to [1]\nend\nif <(PROGRESSI) = [20]> then\n    hide\n    set [firing v] to [2]\n    set [visible v] to [0]\nend\nif <(PROGRESSI) = [22]> then\n    hide\n    set [firing v] to [2]\n    set [visible v] to [0]\nend\n\nwhen flag clicked\nset [dying v] to [0]\nset [visible v] to [0]\nset [walk_delay v] to [0]\nset [walk_costume v] to [11]\nset [x_sinistra v] to [-151]\nset [x_destra v] to [-75]\nset rotation style [left-right v]\nset [firing v] to [2]\nset [delay v] to [15]\nset [contatore v] to [0]\nset [h v] to [30]\nset [restart_speed v] to [0]\nset [dy v] to [60]\nset [velocità_max v] to [2]\nset [velocità v] to (Velocità_max)\ngo to x: (-151) y: (67)\npoint in direction (90)\ngo to [front v] layer\ngo [backward v] (4) layers\nhide\nswitch costume to (enemy_1_01 v)\nforever\n    if <<(PAUSE) = [0]> and <(Visible) = [1]>> then\n        if <<touching (cube_01 v)?> and <(Sprite_N) > [3]>> then\n            set [firing v] to [2]\n            set [dying v] to [1]\n            Destroyed\n        else\n            if <(firing) = [1]> then\n                if <([abs v] of (([x position v] of [enemy_1_03_laser3 v]) - (x position)) ) > [40]> then\n                    switch costume to (enemy_1_01 v)\n                end\n            else\n                Cammina_o_Fermo\n            end\n            change x by (Velocità)\n            if <(x position) < (X_Sinistra)> then\n                set [velocità v] to (Velocità_max)\n                point in direction (90)\n            end\n            if <(x position) > (X_destra)> then\n                set [velocità v] to ((Velocità_max) * (-1))\n                point in direction (-90)\n            end\n            if <<(([y position v] of [sprite1 v]) + (H)) > ((y position) - (DY))> and <(([y position v] of [sprite1 v]) + (H)) < ((y position) + (DY))>> then\n                set [contatore v] to ((Contatore) + (1))\n                if <not <(Velocità) = [0]>> then\n                    set [restart_speed v] to (Velocità)\n                end\n                set [velocità v] to [0]\n                point towards (sprite1 v)\n                if <<(Contatore) = (Delay)> and <(firing) = [0]>> then\n                    Fire\n                end\n            else\n                set [contatore v] to [0]\n                if <(Velocità) = [0]> then\n                    set [velocità v] to (Restart_speed)\n                    if <(Restart_speed) > [0]> then\n                        point in direction (90)\n                    else\n                        point in direction (-90)\n                    end\n                end\n            end\n        end\n    end\nend\n\nwhen I receive [restart v]\nset [dying v] to [0]\nset [visible v] to [0]\nset [walk_delay v] to [0]\nset [walk_costume v] to [11]\nset [x_sinistra v] to [-151]\nset [x_destra v] to [-75]\nset rotation style [left-right v]\nset [firing v] to [2]\nset [delay v] to [15]\nset [contatore v] to [0]\nset [h v] to [30]\nset [restart_speed v] to [0]\nset [dy v] to [60]\nset [velocità_max v] to [2]\nset [velocità v] to (Velocità_max)\ngo to x: (-151) y: (67)\npoint in direction (90)\ngo to [front v] layer\ngo [backward v] (4) layers\nhide\nswitch costume to (enemy_1_01 v)\n\ndefine Fire\nswitch costume to (enemy_1_02 v)\nset [firing v] to [1]\nbroadcast (FIRE_3 v)\n\nwhen I receive [death_fall v]\nwait (0.3) seconds\nset [firing v] to [0]\nset [contatore v] to [0]\nswitch costume to (enemy_1_01 v)\nif <(PROGRESSI) < [4]> then\n    hide\n    set [firing v] to [2]\nend\nif <<(PROGRESSI) = [4]> or <(PROGRESSI) = [5]>> then\n    hide\n    set [firing v] to [2]\nend\nif <<(PROGRESSI) = [6]> or <(PROGRESSI) = [7]>> then\n    show\n    set [dying v] to [0]\n    set [firing v] to [0]\n    point in direction (-90)\n    go to x: ((X_destra) - (1)) y: (y position)\nend\nif <<(PROGRESSI) = [8]> or <(PROGRESSI) = [9]>> then\n    show\n    set [dying v] to [0]\n    set [firing v] to [0]\n    point in direction (-90)\n    go to x: ((X_destra) - (1)) y: (y position)\nend\nif <<(PROGRESSI) = [10]> or <(PROGRESSI) = [11]>> then\n    show\n    set [dying v] to [0]\n    set [firing v] to [0]\n    point in direction (-90)\n    go to x: ((X_destra) - (1)) y: (y position)\nend\nif <<(PROGRESSI) = [12]> or <(PROGRESSI) = [13]>> then\n    show\n    set [dying v] to [0]\n    set [firing v] to [0]\n    point in direction (-90)\n    go to x: ((X_destra) - (1)) y: (y position)\nend\nif <<(PROGRESSI) = [14]> or <(PROGRESSI) = [15]>> then\n    hide\n    set [firing v] to [2]\nend\nif <<(PROGRESSI) = [16]> or <(PROGRESSI) = [17]>> then\n    show\n    set [dying v] to [0]\n    set [firing v] to [0]\n    point in direction (90)\n    go to x: ((X_Sinistra) - (1)) y: (y position)\nend\nif <<(PROGRESSI) = [18]> or <(PROGRESSI) = [19]>> then\n    show\n    set [dying v] to [0]\n    set [firing v] to [0]\n    point in direction (90)\n    go to x: ((X_Sinistra) - (1)) y: (y position)\nend\nif <<(PROGRESSI) = [20]> or <(PROGRESSI) = [21]>> then\n    hide\n    set [firing v] to [2]\nend\nif <(PROGRESSI) = [22]> then\n    hide\n    set [firing v] to [2]\nend\n\n@Enemy_1_03_laser3\n\nwhen flag clicked\nset [rimbalzo v] to [0]\nset [moving v] to [0]\nset [velocità v] to [12]\nset rotation style [left-right v]\ngo to [front v] layer\ngo [backward v] (5) layers\nhide\nswitch costume to (enemy_1_03_laser v)\nforever\n    if <(PAUSE) = [0]> then\n        if <(rimbalzo) = [0]> then\n            if <(moving) = [1]> then\n                move (Velocità) steps\n            end\n            if <touching (sprite1 v)?> then\n                if <(Sprite_N) > [2]> then\n                    rimbalza\n                else\n                    set [vx v] to [0]\n                    set [vy v] to [0]\n                    set [moving v] to [0]\n                    broadcast (DEATH_1 v)\n                    animate\n                    broadcast (END_FIRE_3 v)\n                end\n            else\n                if <touching (sprite2 v)?> then\n                    set [moving v] to [0]\n                    animate\n                    broadcast (END_FIRE_3 v)\n                end\n                if <touching (door_01 v)?> then\n                    if <([costume # v] of [door_01 v]) < [4]> then\n                        set [moving v] to [0]\n                        animate\n                        broadcast (END_FIRE_3 v)\n                    end\n                end\n                if <touching (_edge_ v)?> then\n                    set [moving v] to [0]\n                    hide\n                    animate\n                    broadcast (END_FIRE_3 v)\n                end\n            end\n        else\n            hide\n        end\n    end\nend\n\ndefine animate\nswitch costume to (enemy_1_03_laser_01 v)\nwait (0.01) seconds\nswitch costume to (enemy_1_03_laser_02 v)\nwait (0.05) seconds\nswitch costume to (enemy_1_03_laser_03 v)\nwait (0.05) seconds\nswitch costume to (enemy_1_03_laser_04 v)\nwait (0.05) seconds\nhide\ngo to x: (0) y: (0)\nswitch costume to (enemy_1_03_laser v)\n\ndefine animate2\ncreate clone of (_myself_ v)\n\nwhen I receive [level_change v]\nhide\nset [rimbalzo v] to [0]\nset [moving v] to [0]\nset rotation style [left-right v]\nswitch costume to (enemy_1_03_laser v)\n\nwhen I receive [death_fall v]\nwait (0.3) seconds\nhide\nset [rimbalzo v] to [0]\nset [moving v] to [0]\nset rotation style [left-right v]\nswitch costume to (enemy_1_03_laser v)\n\nwhen I start as a clone\ngo to [front v] layer\nswitch costume to (enemy_1_03_laser_02 v)\nwait (0.01) seconds\nswitch costume to (enemy_1_03_laser_01 v)\nwait (0.01) seconds\nswitch costume to (enemy_1_03_laser v)\nset [velocità_2 v] to (((-1) * (Velocità)) * (2))\nforever\n    if <(moving) = [1]> then\n        move (Velocità_2) steps\n    end\n    if <touching (_edge_ v)?> then\n        set [moving v] to [0]\n        set [rimbalzo v] to [0]\n        hide\n        broadcast (END_FIRE_3 v)\n        delete this clone\n    end\nend\n\nwhen I receive [restart v]\nset [rimbalzo v] to [0]\nset [moving v] to [0]\nset [velocità v] to [12]\nset rotation style [left-right v]\ngo to [front v] layer\ngo [backward v] (5) layers\nhide\nswitch costume to (enemy_1_03_laser v)\n\nwhen I receive [fire_3 v]\nshow\ngo to [front v] layer\ngo [backward v] (2) layers\nset rotation style [left-right v]\nif <<([direction v] of [enemy_1_3 v]) > [0]> and <([direction v] of [enemy_1_3 v]) < [180]>> then\n    point in direction (90)\nelse\n    point in direction (-90)\nend\ngo to x: ([x position v] of [enemy_1_3 v]) y: ([y position v] of [enemy_1_3 v])\nset [moving v] to [1]\nset [rimbalzo v] to [0]\n\ndefine rimbalza\nif <<([x position v] of [cube_01 v]) > (x position)> and <([direction v] of [cube_01 v]) = [-90]>> then\n    set rotation style [all around v]\n    point in direction (pick random (75) to (135))\n    go to x: ((x position) - (10)) y: (y position)\n    set [velocità_2 v] to [0]\n    set [rimbalzo v] to [1]\n    animate2\nelse\n    if <<([x position v] of [cube_01 v]) < (x position)> and <([direction v] of [cube_01 v]) = [90]>> then\n        set rotation style [all around v]\n        point in direction (pick random (-135) to (-75))\n        go to x: ((x position) + (10)) y: (y position)\n        set [velocità_2 v] to [0]\n        set [rimbalzo v] to [1]\n        animate2\n    else\n        set [rimbalzo v] to [0]\n        set [vx v] to [0]\n        set [vy v] to [0]\n        set [moving v] to [0]\n        broadcast (DEATH_1 v)\n        animate\n        broadcast (END_FIRE_3 v)\n    end\nend\n\n@Enemy_1_4\n\nwhen I receive [end_fire_4 v]\nif <(firing) < [2]> then\n    set [firing v] to [0]\n    set [contatore v] to [0]\nend\n\ndefine Destroyed\nbroadcast (DESTROYED v)\nset [brightness v] effect to (25)\nwait (0.1) seconds\nset [costume v] to [3]\nswitch costume to (Costume)\nwait (0.01) seconds\nif <([direction v] of [cube_01 v]) = [90]> then\n    change x by (40)\nelse\n    change x by (-40)\nend\nset [costume v] to ((Costume) + (1))\nswitch costume to (Costume)\nwait (0.01) seconds\nset [costume v] to ((Costume) + (1))\nswitch costume to (Costume)\nwait (0.01) seconds\nset [costume v] to ((Costume) + (1))\nswitch costume to (Costume)\nwait (0.01) seconds\nset [costume v] to ((Costume) + (1))\nswitch costume to (Costume)\nwait (0.01) seconds\nset [costume v] to ((Costume) + (1))\nswitch costume to (Costume)\nwait (0.01) seconds\nset [costume v] to ((Costume) + (1))\nswitch costume to (Costume)\nwait (0.01) seconds\nset [costume v] to ((Costume) + (1))\nswitch costume to (Costume)\nwait (0.01) seconds\nhide\nset [brightness v] effect to (0)\n\ndefine Cammina_o_Fermo\nif <(Velocità) = [0]> then\n    switch costume to (enemy_1_01 v)\nelse\n    if <(Walk_Delay) = [0]> then\n        if <(Walk_Costume) > [20]> then\n            set [walk_costume v] to [11]\n        end\n        switch costume to (Walk_Costume)\n    end\n    set [walk_delay v] to ((Walk_Delay) + (1))\n    if <(Walk_Delay) > [2]> then\n        set [walk_delay v] to [0]\n        set [walk_costume v] to ((Walk_Costume) + (1))\n    end\nend\n\nwhen flag clicked\nset [visible v] to [0]\nset [walk_delay v] to [0]\nset [walk_costume v] to [11]\nset [x_sinistra v] to [-151]\nset [x_destra v] to [-75]\nset rotation style [left-right v]\nset [firing v] to [2]\nset [delay v] to [15]\nset [contatore v] to [0]\nset [h v] to [30]\nset [restart_speed v] to [0]\nset [dy v] to [60]\nset [velocità_max v] to [2]\nset [velocità v] to (Velocità_max)\ngo to x: (-151) y: (67)\npoint in direction (90)\ngo to [front v] layer\ngo [backward v] (4) layers\nhide\nswitch costume to (enemy_1_01 v)\nforever\n    if <<(PAUSE) = [0]> and <(Visible) = [1]>> then\n        if <<touching (cube_01 v)?> and <(Sprite_N) > [3]>> then\n            set [firing v] to [2]\n            Destroyed\n        else\n            if <(firing) = [1]> then\n                if <([abs v] of (([x position v] of [enemy_1_03_laser4 v]) - (x position)) ) > [40]> then\n                    switch costume to (enemy_1_01 v)\n                end\n            else\n                Cammina_o_Fermo\n            end\n            change x by (Velocità)\n            if <(x position) < (X_Sinistra)> then\n                set [velocità v] to (Velocità_max)\n                point in direction (90)\n            end\n            if <(x position) > (X_destra)> then\n                set [velocità v] to ((Velocità_max) * (-1))\n                point in direction (-90)\n            end\n            if <<(([y position v] of [sprite1 v]) + (H)) > ((y position) - (DY))> and <(([y position v] of [sprite1 v]) + (H)) < ((y position) + (DY))>> then\n                set [contatore v] to ((Contatore) + (1))\n                if <not <(Velocità) = [0]>> then\n                    set [restart_speed v] to (Velocità)\n                end\n                set [velocità v] to [0]\n                point towards (sprite1 v)\n                if <<(Contatore) = (Delay)> and <(firing) = [0]>> then\n                    Fire\n                end\n            else\n                set [contatore v] to [0]\n                if <(Velocità) = [0]> then\n                    set [velocità v] to (Restart_speed)\n                    if <(Restart_speed) > [0]> then\n                        point in direction (90)\n                    else\n                        point in direction (-90)\n                    end\n                end\n            end\n        end\n    end\nend\n\nwhen I receive [level_change v]\nset rotation style [left-right v]\nset [firing v] to [0]\nset [contatore v] to [0]\nset [restart_speed v] to [0]\nset [velocità v] to (Velocità_max)\npoint in direction (90)\nswitch costume to (enemy_1_01 v)\nif <(PROGRESSI) < [4]> then\n    hide\n    set [firing v] to [2]\n    set [visible v] to [0]\nend\nif <(PROGRESSI) = [4]> then\n    hide\n    set [firing v] to [2]\n    set [visible v] to [0]\nend\nif <(PROGRESSI) = [6]> then\n    hide\n    set [firing v] to [2]\n    set [visible v] to [0]\nend\nif <(PROGRESSI) = [8]> then\n    show\n    go to [front v] layer\n    go [backward v] (1) layers\n    set [firing v] to [0]\n    go to x: (17) y: (-3)\n    set [x_sinistra v] to [17]\n    set [x_destra v] to [151]\n    set [delay v] to [15]\n    set [visible v] to [1]\nend\nif <(PROGRESSI) = [10]> then\n    show\n    go to [front v] layer\n    go [backward v] (1) layers\n    set [firing v] to [0]\n    go to x: (194) y: (119)\n    set [x_sinistra v] to [140]\n    set [x_destra v] to [194]\n    set [delay v] to [15]\n    set [visible v] to [1]\nend\nif <(PROGRESSI) = [12]> then\n    show\n    go to [front v] layer\n    go [backward v] (1) layers\n    set [firing v] to [0]\n    go to x: (148) y: (-116)\n    set [x_sinistra v] to [-69]\n    set [x_destra v] to [148]\n    set [delay v] to [15]\n    set [visible v] to [1]\nend\nif <(PROGRESSI) = [14]> then\n    hide\n    set [firing v] to [2]\n    set [visible v] to [0]\nend\nif <(PROGRESSI) = [16]> then\n    show\n    go to [front v] layer\n    go [backward v] (1) layers\n    set [firing v] to [0]\n    go to x: (184) y: (-3)\n    set [x_sinistra v] to [78]\n    set [x_destra v] to [184]\n    set [delay v] to [10]\n    set [visible v] to [1]\nend\nif <(PROGRESSI) = [18]> then\n    show\n    go to [front v] layer\n    go [backward v] (1) layers\n    set [firing v] to [0]\n    go to x: (191) y: (-2)\n    set [x_sinistra v] to [55]\n    set [x_destra v] to [191]\n    set [delay v] to [10]\n    set [visible v] to [1]\nend\nif <(PROGRESSI) = [20]> then\n    hide\n    set [firing v] to [2]\n    set [visible v] to [0]\nend\nif <(PROGRESSI) = [22]> then\n    hide\n    set [firing v] to [2]\n    set [visible v] to [0]\nend\n\nwhen I receive [death_fall v]\nwait (0.3) seconds\nset [firing v] to [0]\nset [contatore v] to [0]\nswitch costume to (enemy_1_01 v)\nif <(PROGRESSI) < [4]> then\n    hide\n    set [firing v] to [2]\nend\nif <<(PROGRESSI) = [4]> or <(PROGRESSI) = [5]>> then\n    hide\n    set [firing v] to [2]\nend\nif <<(PROGRESSI) = [6]> or <(PROGRESSI) = [7]>> then\n    hide\n    set [firing v] to [2]\nend\nif <<(PROGRESSI) = [8]> or <(PROGRESSI) = [9]>> then\n    show\n    set [firing v] to [0]\n    point in direction (-90)\n    go to x: ((X_destra) - (1)) y: (y position)\nend\nif <<(PROGRESSI) = [10]> or <(PROGRESSI) = [11]>> then\n    show\n    set [firing v] to [0]\n    point in direction (-90)\n    go to x: ((X_destra) - (1)) y: (y position)\nend\nif <<(PROGRESSI) = [12]> or <(PROGRESSI) = [13]>> then\n    show\n    set [firing v] to [0]\n    point in direction (-90)\n    go to x: ((X_destra) - (1)) y: (y position)\nend\nif <<(PROGRESSI) = [14]> or <(PROGRESSI) = [15]>> then\n    hide\n    set [firing v] to [2]\nend\nif <<(PROGRESSI) = [16]> or <(PROGRESSI) = [17]>> then\n    show\n    set [firing v] to [0]\n    point in direction (-90)\n    go to x: ((X_destra) + (1)) y: (y position)\nend\nif <<(PROGRESSI) = [18]> or <(PROGRESSI) = [19]>> then\n    show\n    set [firing v] to [0]\n    point in direction (-90)\n    go to x: ((X_destra) + (1)) y: (y position)\nend\nif <<(PROGRESSI) = [20]> or <(PROGRESSI) = [21]>> then\n    hide\n    set [firing v] to [2]\nend\nif <(PROGRESSI) = [22]> then\n    hide\n    set [firing v] to [2]\nend\n\ndefine Fire\nswitch costume to (enemy_1_02 v)\nset [firing v] to [1]\nbroadcast (FIRE_4 v)\n\nwhen I receive [restart v]\nset [visible v] to [0]\nset [walk_delay v] to [0]\nset [walk_costume v] to [11]\nset [x_sinistra v] to [-151]\nset [x_destra v] to [-75]\nset rotation style [left-right v]\nset [firing v] to [2]\nset [delay v] to [15]\nset [contatore v] to [0]\nset [h v] to [30]\nset [restart_speed v] to [0]\nset [dy v] to [60]\nset [velocità_max v] to [2]\nset [velocità v] to (Velocità_max)\ngo to x: (-151) y: (67)\npoint in direction (90)\ngo to [front v] layer\ngo [backward v] (4) layers\nhide\nswitch costume to (enemy_1_01 v)\n\n@Enemy_1_03_laser4\n\nwhen flag clicked\nset [rimbalzo v] to [0]\nset [moving v] to [0]\nset [velocità v] to [12]\nset rotation style [left-right v]\ngo to [front v] layer\ngo [backward v] (5) layers\nhide\nswitch costume to (enemy_1_03_laser v)\nforever\n    if <(PAUSE) = [0]> then\n        if <(rimbalzo) = [0]> then\n            if <(moving) = [1]> then\n                move (Velocità) steps\n            end\n            if <touching (sprite1 v)?> then\n                if <(Sprite_N) > [2]> then\n                    rimbalza\n                else\n                    set [vx v] to [0]\n                    set [vy v] to [0]\n                    set [moving v] to [0]\n                    broadcast (DEATH_1 v)\n                    animate\n                    broadcast (END_FIRE_4 v)\n                end\n            else\n                if <touching (sprite2 v)?> then\n                    set [moving v] to [0]\n                    animate\n                    broadcast (END_FIRE_4 v)\n                end\n                if <touching (door_01 v)?> then\n                    if <([costume # v] of [door_01 v]) < [4]> then\n                        set [moving v] to [0]\n                        animate\n                        broadcast (END_FIRE_4 v)\n                    end\n                end\n                if <touching (_edge_ v)?> then\n                    set [moving v] to [0]\n                    hide\n                    animate\n                    broadcast (END_FIRE_4 v)\n                end\n            end\n        else\n            hide\n        end\n    end\nend\n\ndefine animate\nswitch costume to (enemy_1_03_laser_01 v)\nwait (0.01) seconds\nswitch costume to (enemy_1_03_laser_02 v)\nwait (0.05) seconds\nswitch costume to (enemy_1_03_laser_03 v)\nwait (0.05) seconds\nswitch costume to (enemy_1_03_laser_04 v)\nwait (0.05) seconds\nhide\ngo to x: (0) y: (0)\nswitch costume to (enemy_1_03_laser v)\n\ndefine animate2\ncreate clone of (_myself_ v)\n\nwhen I receive [level_change v]\nhide\nset [rimbalzo v] to [0]\nset [moving v] to [0]\nset rotation style [left-right v]\nswitch costume to (enemy_1_03_laser v)\n\nwhen I receive [death_fall v]\nwait (0.3) seconds\nhide\nset [rimbalzo v] to [0]\nset [moving v] to [0]\nset rotation style [left-right v]\nswitch costume to (enemy_1_03_laser v)\n\nwhen I start as a clone\ngo to [front v] layer\nswitch costume to (enemy_1_03_laser_02 v)\nwait (0.01) seconds\nswitch costume to (enemy_1_03_laser_01 v)\nwait (0.01) seconds\nswitch costume to (enemy_1_03_laser v)\nset [velocità_2 v] to (((-1) * (Velocità)) * (2))\nforever\n    if <(moving) = [1]> then\n        move (Velocità_2) steps\n    end\n    if <touching (_edge_ v)?> then\n        set [moving v] to [0]\n        set [rimbalzo v] to [0]\n        hide\n        broadcast (END_FIRE_4 v)\n        delete this clone\n    end\nend\n\nwhen I receive [restart v]\nset [rimbalzo v] to [0]\nset [moving v] to [0]\nset [velocità v] to [12]\nset rotation style [left-right v]\ngo to [front v] layer\ngo [backward v] (5) layers\nhide\nswitch costume to (enemy_1_03_laser v)\n\nwhen I receive [fire_4 v]\nshow\ngo to [front v] layer\ngo [backward v] (2) layers\nset rotation style [left-right v]\nif <<([direction v] of [enemy_1_4 v]) > [0]> and <([direction v] of [enemy_1_4 v]) < [180]>> then\n    point in direction (90)\nelse\n    point in direction (-90)\nend\ngo to x: ([x position v] of [enemy_1_4 v]) y: ([y position v] of [enemy_1_4 v])\nset [moving v] to [1]\nset [rimbalzo v] to [0]\n\ndefine rimbalza\nif <<([x position v] of [cube_01 v]) > (x position)> and <([direction v] of [cube_01 v]) = [-90]>> then\n    set rotation style [all around v]\n    point in direction (pick random (75) to (135))\n    go to x: ((x position) - (10)) y: (y position)\n    set [velocità_2 v] to [0]\n    set [rimbalzo v] to [1]\n    animate2\nelse\n    if <<([x position v] of [cube_01 v]) < (x position)> and <([direction v] of [cube_01 v]) = [90]>> then\n        set rotation style [all around v]\n        point in direction (pick random (-135) to (-75))\n        go to x: ((x position) + (10)) y: (y position)\n        set [velocità_2 v] to [0]\n        set [rimbalzo v] to [1]\n        animate2\n    else\n        set [rimbalzo v] to [0]\n        set [vx v] to [0]\n        set [vy v] to [0]\n        set [moving v] to [0]\n        broadcast (DEATH_1 v)\n        animate\n        broadcast (END_FIRE_4 v)\n    end\nend\n\n@Laser_death_1\n\nwhen flag clicked\nhide\ngo to [front v] layer\ngo [backward v] (5) layers\nforever\n    if <(PAUSE) = [0]> then\n        if <touching (sprite1 v)?> then\n            set [vy v] to [0]\n            broadcast (DEATH_1 v)\n        end\n    end\nend\n\nwhen I receive [level_change v]\nif <(PROGRESSI) < [2]> then\n    hide\nend\nif <<(PROGRESSI) = [2]> or <(PROGRESSI) = [3]>> then\n    hide\nend\nif <<(PROGRESSI) = [4]> or <(PROGRESSI) = [5]>> then\n    hide\nend\nif <<(PROGRESSI) = [6]> or <(PROGRESSI) = [7]>> then\n    hide\nend\nif <<(PROGRESSI) = [8]> or <(PROGRESSI) = [9]>> then\n    show\n    go to [front v] layer\n    go [backward v] (5) layers\n    switch costume to (laser_death_1 v)\n    go to x: (-100) y: (84)\nend\nif <<(PROGRESSI) = [10]> or <(PROGRESSI) = [11]>> then\n    show\n    go to [front v] layer\n    go [backward v] (5) layers\n    switch costume to (laser_death_1 v)\n    go to x: (10) y: (164)\nend\nif <<(PROGRESSI) = [12]> or <(PROGRESSI) = [13]>> then\n    show\n    go to [front v] layer\n    go [backward v] (5) layers\n    switch costume to (laser_death_1_2 v)\n    go to x: (-52) y: (-45)\nend\nif <<(PROGRESSI) = [14]> or <(PROGRESSI) = [15]>> then\n    hide\nend\nif <<(PROGRESSI) = [16]> or <(PROGRESSI) = [17]>> then\n    hide\nend\nif <<(PROGRESSI) = [18]> or <(PROGRESSI) = [19]>> then\n    show\n    go to [front v] layer\n    go [backward v] (5) layers\n    switch costume to (laser_death_1 v)\n    go to x: (-9) y: (-45)\nend\nif <<(PROGRESSI) = [20]> or <(PROGRESSI) = [21]>> then\n    hide\nend\n\nwhen I receive [restart v]\nhide\ngo to [front v] layer\ngo [backward v] (5) layers\n\n@Laser_death_2\n\nwhen flag clicked\nset [transparency v] to [100]\nset [contatore_max v] to [40]\nset [contatore v] to (Contatore_MAX)\nhide\ngo to [front v] layer\ngo [backward v] (5) layers\nforever\n    if <(PAUSE) = [0]> then\n        if <<touching (sprite1 v)?> and <(Transparency) = [0]>> then\n            broadcast (DEATH_1 v)\n        end\n        if <<(PROGRESSI) = [8]> or <(PROGRESSI) = [9]>> then\n            set [contatore v] to ((Contatore) + (1))\n            if <<(Contatore) > ((Contatore_MAX) - (5))> and <(Contatore) < (Contatore_MAX)>> then\n                show\n                set [transparency v] to ((Transparency) - (20))\n                set [ghost v] effect to (Transparency)\n            end\n            if <(Contatore) = (Contatore_MAX)> then\n                set [transparency v] to [0]\n                set [ghost v] effect to (0)\n                show\n                go to [front v] layer\n                go [backward v] (5) layers\n                go to x: (-47) y: (-107)\n            end\n            if <<(Contatore) > (((Contatore_MAX) * (2)) - (5))> and <(Contatore) < ((Contatore_MAX) * (2))>> then\n                set [transparency v] to ((Transparency) + (20))\n                set [ghost v] effect to (Transparency)\n            end\n            if <(Contatore) = ((Contatore_MAX) * (2))> then\n                hide\n                set [contatore v] to [0]\n                set [transparency v] to [100]\n            end\n        end\n        if <<(PROGRESSI) = [12]> or <(PROGRESSI) = [13]>> then\n            set [contatore v] to ((Contatore) + (1))\n            if <<(Contatore) > ((Contatore_MAX) - (5))> and <(Contatore) < (Contatore_MAX)>> then\n                show\n                set [transparency v] to ((Transparency) - (20))\n                set [ghost v] effect to (Transparency)\n            end\n            if <(Contatore) = (Contatore_MAX)> then\n                set [transparency v] to [0]\n                set [ghost v] effect to (0)\n                show\n                go to [front v] layer\n                go [backward v] (5) layers\n                go to x: (-158) y: (-98)\n            end\n            if <<(Contatore) > (((Contatore_MAX) * (2)) - (5))> and <(Contatore) < ((Contatore_MAX) * (2))>> then\n                set [transparency v] to ((Transparency) + (20))\n                set [ghost v] effect to (Transparency)\n            end\n            if <(Contatore) = ((Contatore_MAX) * (2))> then\n                hide\n                set [contatore v] to [0]\n                set [transparency v] to [100]\n            end\n        end\n    end\nend\n\nwhen I receive [restart v]\nset [transparency v] to [100]\nset [contatore_max v] to [40]\nset [contatore v] to (Contatore_MAX)\nhide\ngo to [front v] layer\ngo [backward v] (5) layers\n\nwhen I receive [level_change v]\nif <(PROGRESSI) < [2]> then\n    hide\nend\nif <<(PROGRESSI) = [2]> or <(PROGRESSI) = [3]>> then\n    hide\nend\nif <<(PROGRESSI) = [4]> or <(PROGRESSI) = [5]>> then\n    hide\nend\nif <<(PROGRESSI) = [6]> or <(PROGRESSI) = [7]>> then\n    hide\nend\nif <<(PROGRESSI) = [8]> or <(PROGRESSI) = [9]>> then\n    set [contatore v] to [0]\n    show\n    go to [front v] layer\n    go [backward v] (5) layers\n    go to x: (-48) y: (-107)\nend\nif <<(PROGRESSI) = [10]> or <(PROGRESSI) = [11]>> then\n    hide\nend\nif <<(PROGRESSI) = [12]> or <(PROGRESSI) = [13]>> then\n    set [contatore v] to [0]\n    show\n    go to [front v] layer\n    go [backward v] (5) layers\n    go to x: (-158) y: (-98)\nend\nif <<(PROGRESSI) = [14]> or <(PROGRESSI) = [15]>> then\n    set [contatore v] to [0]\n    set [transparency v] to [0]\n    set [ghost v] effect to (0)\n    show\n    go to [front v] layer\n    go [backward v] (5) layers\n    go to x: (165) y: (-97)\nend\nif <<(PROGRESSI) = [16]> or <(PROGRESSI) = [17]>> then\n    hide\nend\nif <<(PROGRESSI) = [20]> or <(PROGRESSI) = [21]>> then\n    hide\nend\n\nwhen I receive [end_laser v]\nshow\nset [transparency v] to ((Transparency) - (20))\nset [ghost v] effect to (Transparency)\nwait (0.1) seconds\nset [transparency v] to ((Transparency) - (20))\nset [ghost v] effect to (Transparency)\nwait (0.1) seconds\nset [transparency v] to ((Transparency) - (20))\nset [ghost v] effect to (Transparency)\nwait (0.1) seconds\nset [transparency v] to ((Transparency) - (20))\nset [ghost v] effect to (Transparency)\nwait (0.1) seconds\nhide\n\n@Enemy_1_5\n\nwhen I receive [end_fire_5 v]\nif <(firing) < [2]> then\n    set [firing v] to [0]\n    set [contatore v] to [0]\nend\n\ndefine Hit\nbroadcast (DESTROYED v)\nset [brightness v] effect to (25)\nswitch costume to (enemy_1_04 v)\nwait (0.1) seconds\nif <([direction v] of [cube_01 v]) = [90]> then\n    glide (0.2) secs to x: ((x position) + (70)) y: (y position)\nelse\n    glide (0.2) secs to x: ((x position) - (70)) y: (y position)\nend\nswitch costume to (enemy_1_01 v)\nwait (0.1) seconds\nset [damage v] to ((damage) + (1))\nset [boss_health v] to ((damage) + (1))\nif <(damage) < [8]> then\n    set [brightness v] effect to (0)\n    switch costume to (storm04 v)\n    Fly\nelse\n    die\nend\n\nwhen flag clicked\nset [damage v] to [0]\nset [visible v] to [0]\nset rotation style [left-right v]\nset [firing v] to [2]\nset [delay v] to [15]\nset [contatore v] to [0]\nset [h v] to [30]\nset [restart_speed v] to [0]\nset [dy v] to [60]\nset [velocità_max v] to [2]\nset [velocità v] to (Velocità_max)\ngo to x: (-151) y: (67)\npoint in direction (90)\ngo to [front v] layer\nhide\nswitch costume to (enemy_1_01 v)\nforever\n    if <<(PAUSE) = [0]> and <(Visible) = [1]>> then\n        if <<touching (cube_01 v)?> and <(Sprite_N) > [3]>> then\n            set [firing v] to [2]\n            Hit\n        else\n            if <([x position v] of [cube_01 v]) > (x position)> then\n                point in direction (90)\n            else\n                point in direction (-90)\n            end\n            if <(firing) = [1]> then\n                if <([abs v] of (([x position v] of [enemy_1_03_laser4 v]) - (x position)) ) > [40]> then\n                    switch costume to (enemy_1_01 v)\n                end\n            end\n            if <<(([y position v] of [sprite1 v]) + (H)) > ((y position) - (DY))> and <(([y position v] of [sprite1 v]) + (H)) < ((y position) + (DY))>> then\n                set [contatore v] to ((Contatore) + (1))\n                if <not <(Velocità) = [0]>> then\n                    set [restart_speed v] to (Velocità)\n                end\n                set [velocità v] to [0]\n                point towards (sprite1 v)\n                if <<(Contatore) = (Delay)> and <(firing) = [0]>> then\n                    Fire\n                end\n            else\n                set [contatore v] to [0]\n            end\n        end\n    end\nend\n\nwhen I receive [level_change v]\nset rotation style [left-right v]\nset [firing v] to [0]\nset [contatore v] to [0]\nset [restart_speed v] to [0]\nset [velocità v] to (Velocità_max)\npoint in direction (90)\nswitch costume to (enemy_1_01 v)\nif <(PROGRESSI) < [14]> then\n    hide\n    set [firing v] to [2]\n    set [visible v] to [0]\nend\nif <(PROGRESSI) = [14]> then\n    show\n    go to [front v] layer\n    go [backward v] (1) layers\n    set [firing v] to [0]\n    go to x: (59) y: (-106)\n    set [delay v] to [12]\n    set [visible v] to [1]\n    set [damage v] to [0]\nend\nif <(PROGRESSI) > [15]> then\n    hide\n    set [firing v] to [2]\n    set [visible v] to [0]\nend\n\nwhen I receive [death_fall v]\nwait (0.3) seconds\nset [firing v] to [0]\nset [contatore v] to [0]\nswitch costume to (enemy_1_01 v)\nif <(PROGRESSI) < [14]> then\n    hide\n    set [firing v] to [2]\nend\nif <<(PROGRESSI) = [14]> or <(PROGRESSI) = [15]>> then\n    go to x: (59) y: (-106)\n    show\n    set [firing v] to [0]\n    set [damage v] to [0]\n    point in direction (-90)\nend\nif <(PROGRESSI) > [15]> then\n    hide\n    set [firing v] to [2]\nend\n\ndefine Cammina_o_Fermo\nif <(Velocità) = [0]> then\n    switch costume to (enemy_1_01 v)\nelse\n    if <(Walk_Delay) = [0]> then\n        if <(Walk_Costume) > [20]> then\n            set [walk_costume v] to [11]\n        end\n        switch costume to (Walk_Costume)\n    end\n    set [walk_delay v] to ((Walk_Delay) + (1))\n    if <(Walk_Delay) > [2]> then\n        set [walk_delay v] to [0]\n        set [walk_costume v] to ((Walk_Costume) + (1))\n    end\nend\n\ndefine die\nbroadcast (DOOR_DESTROYED v)\nset [firing v] to [2]\nwait (0.05) seconds\nswitch costume to (enemy_1_04 v)\nwait (0.05) seconds\nswitch costume to (enemy_1_05 v)\nwait (0.05) seconds\nswitch costume to (enemy_1_06 v)\nwait (0.05) seconds\nswitch costume to (enemy_1_07 v)\nwait (0.05) seconds\nswitch costume to (enemy_1_08 v)\nwait (0.05) seconds\nswitch costume to (storm17 v)\nwait (0.05) seconds\nswitch costume to (storm16 v)\nwait (0.05) seconds\nswitch costume to (storm2 v)\nwait (0.05) seconds\nhide\nbroadcast (END_LASER v)\n\ndefine Fly\nif <(y position) = [-106]> then\n    set [position_y v] to [7]\nend\nif <(y position) = [7]> then\n    set [position_y v] to [129]\nend\nif <(y position) = [129]> then\n    set [position_y v] to [-106]\nend\nglide (1) secs to x: (x position) y: (POSITION_Y)\nglide (0.2) secs to x: (59) y: (y position)\nset [firing v] to [0]\nset [contatore v] to [0]\nswitch costume to (enemy_1_01 v)\n\nwhen I receive [restart v]\nset [damage v] to [0]\nset [visible v] to [0]\nset [walk_delay v] to [0]\nset [walk_costume v] to [11]\nset [x_sinistra v] to [-151]\nset [x_destra v] to [-75]\nset rotation style [left-right v]\nset [firing v] to [2]\nset [delay v] to [15]\nset [contatore v] to [0]\nset [h v] to [30]\nset [restart_speed v] to [0]\nset [dy v] to [60]\nset [velocità_max v] to [2]\nset [velocità v] to (Velocità_max)\ngo to x: (59) y: (-106)\npoint in direction (90)\ngo to [front v] layer\ngo [backward v] (4) layers\nhide\nswitch costume to (enemy_1_01 v)\n\ndefine Fire\nswitch costume to (enemy_1_02 v)\nset [firing v] to [1]\nbroadcast (FIRE_5 v)\n\n@Enemy_1_03_laser5\n\nwhen flag clicked\nset [rimbalzo v] to [0]\nset [moving v] to [0]\nset [velocità v] to [12]\nset rotation style [left-right v]\ngo to [front v] layer\ngo [backward v] (5) layers\nhide\nswitch costume to (enemy_1_03_laser v)\nforever\n    if <(PAUSE) = [0]> then\n        if <(rimbalzo) = [0]> then\n            if <(moving) = [1]> then\n                move (Velocità) steps\n            end\n            if <touching (sprite1 v)?> then\n                if <(Sprite_N) > [2]> then\n                    rimbalza\n                else\n                    set [vx v] to [0]\n                    set [vy v] to [0]\n                    set [moving v] to [0]\n                    broadcast (DEATH_1 v)\n                    animate\n                    broadcast (END_FIRE_5 v)\n                end\n            else\n                if <touching (sprite2 v)?> then\n                    set [moving v] to [0]\n                    animate\n                    broadcast (END_FIRE_5 v)\n                end\n                if <touching (door_01 v)?> then\n                    if <([costume # v] of [door_01 v]) < [4]> then\n                        set [moving v] to [0]\n                        animate\n                        broadcast (END_FIRE_5 v)\n                    end\n                end\n                if <touching (_edge_ v)?> then\n                    set [moving v] to [0]\n                    hide\n                    animate\n                    broadcast (END_FIRE_5 v)\n                end\n            end\n        else\n            hide\n        end\n    end\nend\n\ndefine animate\nswitch costume to (enemy_1_03_laser_01 v)\nwait (0.01) seconds\nswitch costume to (enemy_1_03_laser_02 v)\nwait (0.05) seconds\nswitch costume to (enemy_1_03_laser_03 v)\nwait (0.05) seconds\nswitch costume to (enemy_1_03_laser_04 v)\nwait (0.05) seconds\nhide\ngo to x: (0) y: (0)\nswitch costume to (enemy_1_03_laser v)\n\ndefine animate2\ncreate clone of (_myself_ v)\n\nwhen I receive [level_change v]\nhide\nset [rimbalzo v] to [0]\nset [moving v] to [0]\nset rotation style [left-right v]\nswitch costume to (enemy_1_03_laser v)\n\nwhen I receive [death_fall v]\nwait (0.3) seconds\nhide\nset [rimbalzo v] to [0]\nset [moving v] to [0]\nset rotation style [left-right v]\nswitch costume to (enemy_1_03_laser v)\n\nwhen I start as a clone\ngo to [front v] layer\nswitch costume to (enemy_1_03_laser_02 v)\nwait (0.01) seconds\nswitch costume to (enemy_1_03_laser_01 v)\nwait (0.01) seconds\nswitch costume to (enemy_1_03_laser v)\nset [velocità_2 v] to (((-1) * (Velocità)) * (2))\nforever\n    if <(moving) = [1]> then\n        move (Velocità_2) steps\n    end\n    if <touching (_edge_ v)?> then\n        set [moving v] to [0]\n        set [rimbalzo v] to [0]\n        hide\n        broadcast (END_FIRE_5 v)\n        delete this clone\n    end\nend\n\nwhen I receive [restart v]\nset [rimbalzo v] to [0]\nset [moving v] to [0]\nset [velocità v] to [12]\nset rotation style [left-right v]\ngo to [front v] layer\ngo [backward v] (5) layers\nhide\nswitch costume to (enemy_1_03_laser v)\n\nwhen I receive [fire_5 v]\nshow\ngo to [front v] layer\ngo [backward v] (2) layers\nset rotation style [left-right v]\nif <<([direction v] of [enemy_1_5 v]) > [0]> and <([direction v] of [enemy_1_5 v]) < [180]>> then\n    point in direction (90)\nelse\n    point in direction (-90)\nend\ngo to x: ([x position v] of [enemy_1_5 v]) y: (([y position v] of [enemy_1_5 v]) - (7))\nset [moving v] to [1]\nset [rimbalzo v] to [0]\n\ndefine rimbalza\nif <<([x position v] of [cube_01 v]) > (x position)> and <([direction v] of [cube_01 v]) = [-90]>> then\n    set rotation style [all around v]\n    point in direction (pick random (75) to (135))\n    go to x: ((x position) - (10)) y: (y position)\n    set [velocità_2 v] to [0]\n    set [rimbalzo v] to [1]\n    animate2\nelse\n    if <<([x position v] of [cube_01 v]) < (x position)> and <([direction v] of [cube_01 v]) = [90]>> then\n        set rotation style [all around v]\n        point in direction (pick random (-135) to (-75))\n        go to x: ((x position) + (10)) y: (y position)\n        set [velocità_2 v] to [0]\n        set [rimbalzo v] to [1]\n        animate2\n    else\n        set [rimbalzo v] to [0]\n        set [vx v] to [0]\n        set [vy v] to [0]\n        set [moving v] to [0]\n        broadcast (DEATH_1 v)\n        animate\n        broadcast (END_FIRE_5 v)\n    end\nend\n\n@health_01\n\nwhen I receive [restart v]\nhide\nset [boss_health v] to [1]\n\nwhen I receive [level_change v]\nset [boss_health v] to [1]\n\nwhen flag clicked\nhide\ngo to [front v] layer\nset [boss_health v] to [1]\nforever\n    if <(PROGRESSI) < [14]> then\n        hide\n    end\n    if <<(PROGRESSI) = [14]> or <(PROGRESSI) = [15]>> then\n        if <(BOSS_HEALTH) = [9]> then\n            hide\n        else\n            show\n            switch costume to (BOSS_HEALTH)\n        end\n    end\n    if <(PROGRESSI) > [15]> then\n        hide\n    end\nend\n\nwhen I receive [death_fall v]\nset [boss_health v] to [1]\n\n@falling_plaat\n\nwhen flag clicked\nhide\ngo to [front v] layer\ngo [backward v] (6) layers\nset [visible v] to [0]\nset [velocità_caduta v] to [0]\nset [contatore v] to [0]\nforever\n    if <(Visible) = [1]> then\n        if <<(on_a_falling_plat) = [1]> and <(Velocità_caduta) = [0]>> then\n            set [contatore v] to ((Contatore) + (1))\n            if <(Contatore) = [10]> then\n                set [velocità_caduta v] to [-10]\n            end\n        end\n        if <(Velocità_caduta) < [0]> then\n            change y by (Velocità_caduta)\n            set [velocità_caduta v] to ((Velocità_caduta) - (4))\n        end\n        if <touching (_edge_ v)?> then\n            set [visible v] to [0]\n            hide\n        end\n    end\nend\n\nwhen I receive [restart v]\nhide\ngo to [front v] layer\ngo [backward v] (6) layers\nset [visible v] to [0]\nset [velocità_caduta v] to [0]\nset [contatore v] to [0]\n\nwhen I receive [death_fall v]\nif <(PROGRESSI) < [20]> then\n    hide\n    set [visible v] to [0]\nend\nif <<(PROGRESSI) = [20]> or <(PROGRESSI) = [21]>> then\n    go to x: (-119) y: (-81)\n    set [on_a_falling_plat v] to [0]\n    set [velocità_caduta v] to [0]\n    set [visible v] to [1]\n    set [contatore v] to [0]\n    show\nend\nif <(PROGRESSI) > [21]> then\n    hide\n    set [visible v] to [0]\nend\n\nwhen I receive [level_change v]\nif <(PROGRESSI) < [20]> then\n    hide\n    set [visible v] to [0]\nend\nif <<(PROGRESSI) = [20]> or <(PROGRESSI) = [21]>> then\n    go to x: (-119) y: (-81)\n    set [on_a_falling_plat v] to [0]\n    set [velocità_caduta v] to [0]\n    set [visible v] to [1]\n    set [contatore v] to [0]\n    show\nend\nif <(PROGRESSI) > [21]> then\n    hide\n    set [visible v] to [0]\nend\n\n@falling_plaat2\n\nwhen flag clicked\nhide\ngo to [front v] layer\ngo [backward v] (6) layers\nset [visible v] to [0]\nset [velocità_caduta v] to [0]\nset [contatore v] to [0]\nforever\n    if <(Visible) = [1]> then\n        if <<(on_a_falling_plat2) = [1]> and <(Velocità_caduta) = [0]>> then\n            set [contatore v] to ((Contatore) + (1))\n            if <(Contatore) = [10]> then\n                set [velocità_caduta v] to [-10]\n            end\n        end\n        if <(Velocità_caduta) < [0]> then\n            change y by (Velocità_caduta)\n            set [velocità_caduta v] to ((Velocità_caduta) - (4))\n        end\n        if <touching (_edge_ v)?> then\n            set [visible v] to [0]\n            hide\n        end\n    end\nend\n\nwhen I receive [restart v]\nhide\ngo to [front v] layer\ngo [backward v] (6) layers\nset [visible v] to [0]\nset [velocità_caduta v] to [0]\n\nwhen I receive [death_fall v]\nif <(PROGRESSI) < [20]> then\n    hide\n    set [visible v] to [0]\nend\nif <<(PROGRESSI) = [20]> or <(PROGRESSI) = [21]>> then\n    go to x: (-25) y: (2)\n    set [on_a_falling_plat2 v] to [0]\n    set [velocità_caduta v] to [0]\n    set [visible v] to [1]\n    set [contatore v] to [0]\n    show\nend\nif <(PROGRESSI) > [21]> then\n    hide\n    set [visible v] to [0]\nend\n\nwhen I receive [level_change v]\nif <(PROGRESSI) < [20]> then\n    hide\n    set [visible v] to [0]\nend\nif <<(PROGRESSI) = [20]> or <(PROGRESSI) = [21]>> then\n    go to x: (-25) y: (2)\n    set [on_a_falling_plat2 v] to [0]\n    set [velocità_caduta v] to [0]\n    set [visible v] to [1]\n    set [contatore v] to [0]\n    show\nend\nif <(PROGRESSI) > [21]> then\n    hide\n    set [visible v] to [0]\nend\n\n@falling_plaat3\n\nwhen flag clicked\nhide\ngo to [front v] layer\ngo [backward v] (6) layers\nset [visible v] to [0]\nset [velocità_caduta v] to [0]\nset [contatore v] to [0]\nforever\n    if <(Visible) = [1]> then\n        if <<(on_a_falling_plat3) = [1]> and <(Velocità_caduta) = [0]>> then\n            set [contatore v] to ((Contatore) + (1))\n            if <(Contatore) = [10]> then\n                set [velocità_caduta v] to [-10]\n            end\n        end\n        if <(Velocità_caduta) < [0]> then\n            change y by (Velocità_caduta)\n            set [velocità_caduta v] to ((Velocità_caduta) - (4))\n        end\n        if <touching (_edge_ v)?> then\n            set [visible v] to [0]\n            hide\n        end\n    end\nend\n\nwhen I receive [restart v]\nhide\ngo to [front v] layer\ngo [backward v] (6) layers\nset [visible v] to [0]\nset [velocità_caduta v] to [0]\n\nwhen I receive [death_fall v]\nif <(PROGRESSI) < [20]> then\n    hide\n    set [visible v] to [0]\nend\nif <<(PROGRESSI) = [20]> or <(PROGRESSI) = [21]>> then\n    go to x: (97) y: (-10)\n    set [on_a_falling_plat3 v] to [0]\n    set [velocità_caduta v] to [0]\n    set [visible v] to [1]\n    set [contatore v] to [0]\n    show\nend\nif <(PROGRESSI) > [21]> then\n    hide\n    set [visible v] to [0]\nend\n\nwhen I receive [level_change v]\nif <(PROGRESSI) < [20]> then\n    hide\n    set [visible v] to [0]\nend\nif <<(PROGRESSI) = [20]> or <(PROGRESSI) = [21]>> then\n    go to x: (97) y: (-10)\n    set [on_a_falling_plat3 v] to [0]\n    set [velocità_caduta v] to [0]\n    set [visible v] to [1]\n    set [contatore v] to [0]\n    show\nend\nif <(PROGRESSI) > [21]> then\n    hide\n    set [visible v] to [0]\nend\n\n@Vader_01\n\nwhen flag clicked\nhide\ngo to [front v] layer\nswitch costume to (vader_01 v)\nset [damage v] to [0]\nset [rimbalzo v] to [0]\nset [taking_damage v] to [0]\nset [gravity v] to [-3]\nset [vel_y v] to [0]\nset [contatore_1 v] to [0]\nset [probability v] to [0]\nset [attack_distance v] to [60]\nset [is_swording v] to [0]\nset [sword_retard v] to [20]\nset [sword_delay v] to [15]\nforever\n    if <<(PAUSE) = [0]> and <(Visible) = [1]>> then\n        if <(taking_damage) = [0]> then\n            set [delta_x v] to ((x position) - ([x position v] of [sprite1 v]))\n            Direction_calc\n            Jump_Calc\n            Move\n            if <([abs v] of (Delta_X) ) < (Attack_Distance)> then\n                if <<(Is_Swording) = [1]> and <<([costume # v] of [cube_01 v]) > [2]> and <([costume # v] of [cube_01 v]) < [9]>>> then\n                    if <(Probability) > [1]> then\n                        Sword\n                    end\n                else\n                    if <(Is_Swording) = [1]> then\n                        if <(Contatore_1) = (Sword_Retard)> then\n                            Sword\n                        end\n                    else\n                        Sword\n                    end\n                end\n                if <(Contatore_1) < (Sword_Retard)> then\n                    set [contatore_1 v] to ((Contatore_1) + (1))\n                end\n            else\n                set [contatore_1 v] to [0]\n                if <(Is_Swording) > [1]> then\n                    Sword\n                end\n            end\n            if <([abs v] of (Delta_X) ) > ((Attack_Distance) - (1))> then\n                if <(BOSS_2_HEALTH) < [5]> then\n                    set [probability v] to (pick random (1) to (3))\n                else\n                    set [probability v] to (pick random (1) to (2))\n                end\n            end\n            if <touching (sprite1 v)?> then\n                hit\n            end\n        end\n        if <<(taking_damage) = [1]> and <([costume # v] of [vader_01 v]) = [1]>> then\n            set [taking_damage v] to [0]\n            set [probability v] to [2]\n        end\n        if <(rimbalzo) = [1]> then\n            if <([abs v] of (Delta_X) ) > [70]> then\n                set [rimbalzo v] to [0]\n            end\n        end\n    end\nend\n\ndefine Direction_calc\nif <(Delta_X) > [0]> then\n    point in direction (-90)\nelse\n    point in direction (90)\nend\n\ndefine Sword\nset [contatore_1 v] to [0]\nset [is_swording v] to ((Is_Swording) + (1))\nif <(Is_Swording) < [9]> then\n    switch costume to (Is_Swording)\nend\nif <(Is_Swording) = [9]> then\n    switch costume to (vader_09 v)\nend\nif <(Is_Swording) > [9]> then\n    switch costume to (vader_01 v)\n    if <(Is_Swording) = (sword_delay)> then\n        set [is_swording v] to [1]\n    end\nend\n\ndefine Jump_Calc\nif <<(Vy) > [0]> and <([abs v] of (Delta_X) ) < [150]>> then\n    if <(Vel_y) = [0]> then\n        set [vel_y v] to [20]\n    end\nend\nif <not <(Vel_y) = [0]>> then\n    change [vel_y v] by (Gravity)\n    change y by (Vel_y)\nend\nif <(y position) < [-141]> then\n    set [vel_y v] to [0]\n    set y to (-141)\nend\n\ndefine hit\nif <<([costume # v] of [cube_01 v]) > [4]> and <([costume # v] of [cube_01 v]) < [8]>> then\n    if <<([costume # v] of [vader_01 v]) > [2]> and <([costume # v] of [vader_01 v]) < [9]>> then\n        if <(Delta_X) > [0]> then\n            if <<key (right arrow v) pressed?> or <key (left arrow v) pressed?>> then\n                set [vx v] to [-15]\n            else\n                set [vx v] to [-20]\n            end\n            set [rimbalzo v] to [1]\n            broadcast (SCONTRO v)\n        else\n            if <<key (right arrow v) pressed?> or <key (left arrow v) pressed?>> then\n                set [vx v] to [15]\n            else\n                set [vx v] to [20]\n            end\n            set [rimbalzo v] to [1]\n            broadcast (SCONTRO v)\n        end\n    else\n        if <(taking_damage) = [0]> then\n            switch costume to (vader_10 v)\n            set [taking_damage v] to [1]\n            set [contatore_1 v] to ((Sword_Retard) / (2))\n            Damage\n        end\n    end\nelse\n    set [taking_damage v] to [0]\n    if <(rimbalzo) = [0]> then\n        if <<([costume # v] of [vader_01 v]) > [4]> and <([costume # v] of [vader_01 v]) < [7]>> then\n            broadcast (DEATH_2 v)\n        end\n    end\nend\n\ndefine Damage\nbroadcast (VADER_HIT v)\nset [brightness v] effect to (50)\nswitch costume to (vader_10 v)\nwait (0.1) seconds\nset [brightness v] effect to (25)\nswitch costume to (vader_11 v)\nwait (0.1) seconds\nset [brightness v] effect to (0)\nswitch costume to (vader_12 v)\nwait (0.1) seconds\nswitch costume to (vader_01 v)\nset [damage v] to ((damage) + (1))\nset [boss_2_health v] to ((damage) + (1))\nif <(damage) > [7]> then\n    set [pause v] to [1]\n    END\nend\n\ndefine Move\nif <([x position v] of [sprite1 v]) < [0]> then\n    if <([x position v] of [sprite1 v]) > [-120]> then\n        if <(Delta_X) > [50]> then\n            change x by (-5)\n        end\n    end\nelse\n    if <([x position v] of [sprite1 v]) < [120]> then\n        if <(Delta_X) < [-50]> then\n            change x by (5)\n        end\n    end\nend\nif <(x position) < [-165]> then\n    set x to (-165)\nend\nif <(x position) > [165]> then\n    set x to (165)\nend\n\ndefine END\nbroadcast (END_GAME v)\nrepeat until <(y position) = [-141]>\n    if <not <(Vel_y) = [0]>> then\n        change [vel_y v] by (Gravity)\n        change y by (Vel_y)\n    end\n    if <(y position) < [-141]> then\n        set [vel_y v] to [0]\n        set y to (-141)\n    end\nend\npoint towards (sprite1 v)\nwait (0.5) seconds\nsay [Wait!] for (2) seconds\nwait (6) seconds\nsay [If only you knew the power of the Dark Side] for (4) seconds\nwait (1) seconds\nsay [Do you know what happened to your father?] for (4) seconds\nwait (8) seconds\nsay [No, I am your father!] for (3) seconds\n\nSword\n\nwhen I receive [level_change v]\nif <(PROGRESSI) = [22]> then\n    set [damage v] to [0]\n    set [rimbalzo v] to [0]\n    set [vel_y v] to [0]\n    set [contatore_1 v] to [0]\n    set [probability v] to [0]\n    set [is_swording v] to [1]\n    switch costume to (vader_01 v)\n    go to x: (76) y: (-141)\n    set rotation style [left-right v]\n    point in direction (-90)\n    set [visible v] to [1]\n    set [taking_damage v] to [0]\n    show\n    go to [front v] layer\nend\n\nwhen I receive [death_fall v]\nif <(PROGRESSI) = [22]> then\n    set [damage v] to [0]\n    set [rimbalzo v] to [0]\n    set [vel_y v] to [0]\n    set [contatore_1 v] to [0]\n    set [probability v] to [0]\n    set [is_swording v] to [1]\n    switch costume to (vader_01 v)\n    go to x: (76) y: (-141)\n    set rotation style [left-right v]\n    point in direction (-90)\n    set [visible v] to [1]\n    set [taking_damage v] to [0]\n    show\n    go to [front v] layer\nend\n\nwhen I receive [very end v]\nhide\n\n@Vader_HIT\n\nwhen flag clicked\nhide\nset rotation style [left-right v]\nset [delay v] to [0.01]\n\nwhen I receive [scontro v]\npoint in direction ([direction v] of [vader_01 v])\ngo to x: ([x position v] of [vader_01 v]) y: ([y position v] of [vader_01 v])\ngo to [front v] layer\nshow\nset [ghost v] effect to (50)\nwait (delay) seconds\nhide\n\n@health_2\n\nwhen I receive [restart v]\nhide\nset [boss_2_health v] to [1]\n\nwhen I receive [level_change v]\nset [boss_2_health v] to [1]\n\nwhen flag clicked\nhide\ngo to [front v] layer\nset [boss_2_health v] to [1]\nforever\n    if <(PROGRESSI) < [22]> then\n        hide\n    end\n    if <(PROGRESSI) = [22]> then\n        if <(BOSS_2_HEALTH) = [9]> then\n            hide\n        else\n            show\n            switch costume to (BOSS_2_HEALTH)\n        end\n    end\nend\n\nwhen I receive [death_fall v]\nset [boss_2_health v] to [1]\n\n@menu4\n\nwhen I receive [intro_2 v]\ngo to x: (0) y: (0)\nset [ghost v] effect to (100)\nset volume to (100) %\nstart sound [Star Wars Theme Song \(8 Bit Remix Cover Version\) - 8 Bit Universe.mp3 v]\nwait (0.5) seconds\nshow\nrepeat (20)\n    set [ghost v] to ((ghost) - (5))\n    set [ghost v] effect to (ghost)\nend\nwait (3) seconds\nrepeat (20)\n    set [ghost v] to ((ghost) + (5))\n    set [ghost v] effect to (ghost)\nend\nset [ghost v] effect to (0)\nhide\nwait (1) seconds\nswitch costume to (menu5 v)\nset size to (2) %\nshow\nrepeat (50)\n    change size by (2)\nend\nwait (6) seconds\nset [ghost v] to [0]\nrepeat (50)\n    set [ghost v] to ((ghost) + (2))\n    set [ghost v] effect to (ghost)\nend\nhide\nwait (1) seconds\nswitch costume to (z1 v)\nset [ghost v] effect to (0)\nset size to (100) %\ngo to x: (0) y: (-50)\nset [clone_n v] to [1]\ncreate clone of (_myself_ v)\nset [clone_n v] to [2]\ncreate clone of (_myself_ v)\nset [clone_n v] to [3]\ncreate clone of (_myself_ v)\nset [clone_n v] to [4]\ncreate clone of (_myself_ v)\nset [clone_n v] to [5]\ncreate clone of (_myself_ v)\nset [clone_n v] to [6]\ncreate clone of (_myself_ v)\nset [clone_n v] to [7]\ncreate clone of (_myself_ v)\nset [clone_n v] to [8]\ncreate clone of (_myself_ v)\nwait (52) seconds\nif <(Intro) = [1]> then\n    stop all sounds\n    set volume to (60) %\n    stop [other scripts in sprite v]\n    hide\n    broadcast (GO v)\n    set [intro v] to [2]\nend\n\nwhen flag clicked\nset size to (100) %\nswitch costume to (menu4 v)\nset [ghost v] to [100]\nhide\ngo to x: (0) y: (0)\n\ndefine Title_1\nrepeat until <(y position) = [120]>\n    if <(y position) < [-62]> then\n        change y by (0.1)\n    else\n        change y by (0.05)\n    end\n    change size by (-0.1)\n    change [ghost v] effect by (0.15)\nend\ndelete this clone\n\nwhen [space v] key pressed\nif <(Intro) = [1]> then\n    stop all sounds\n    set volume to (60) %\n    stop [other scripts in sprite v]\n    hide\n    broadcast (GO v)\n    set [intro v] to [2]\nend\n\nwhen I start as a clone\nif <(Clone_N) = [1]> then\n    show\n    switch costume to (z1 v)\n    Title_1\nend\nif <(Clone_N) = [2]> then\n    wait (3) seconds\n    show\n    switch costume to (z2 v)\n    Title_1\nend\nif <(Clone_N) = [3]> then\n    wait (6) seconds\n    show\n    switch costume to (z3 v)\n    Title_1\nend\nif <(Clone_N) = [4]> then\n    wait (12) seconds\n    show\n    switch costume to (z4 v)\n    Title_1\nend\nif <(Clone_N) = [5]> then\n    wait (15) seconds\n    show\n    switch costume to (z5 v)\n    Title_1\nend\nif <(Clone_N) = [6]> then\n    wait (18) seconds\n    show\n    switch costume to (z6 v)\n    Title_1\nend\nif <(Clone_N) = [7]> then\n    wait (24) seconds\n    show\n    switch costume to (z7 v)\n    Title_1\nend\nif <(Clone_N) = [8]> then\n    wait (27) seconds\n    show\n    switch costume to (z8 v)\n    Title_1\nend\n\nwhen I receive [very end v]\nset [ghost v] effect to (0)\nswitch costume to (menu6 v)\nshow\nwait (4) seconds\nset [intro v] to [4]\nstop all sounds\nstart sound [Star Wars Theme Song \(8 Bit Remix Cover Version\) - 8 Bit Universe.mp3 v]\nset [ghost v] effect to (0)\nswitch costume to (menu7 v)\nwait (6) seconds\nhide\nswitch costume to (menu5 v)\nset size to (2) %\nshow\nrepeat (50)\n    change size by (2)\nend\nwait (6) seconds\nset [ghost v] to [0]\nrepeat (50)\n    set [ghost v] to ((ghost) + (2))\n    set [ghost v] effect to (ghost)\nend\nhide\nwait (1) seconds\nswitch costume to (menu8 v)\nset [ghost v] effect to (100)\nset size to (100) %\nshow\nrepeat (50)\n    set [ghost v] to ((ghost) - (2))\n    set [ghost v] effect to (ghost)\nend\nset [ghost v] effect to (0)\nset size to (100) %\nwait (6) seconds\nrepeat (50)\n    set [ghost v] to ((ghost) + (2))\n    set [ghost v] effect to (ghost)\nend\nhide\nset [ghost v] effect to (0)\nset size to (100) %\n\n@menu1\n\nwhen flag clicked\nset [intro v] to [0]\nset [tempo v] to [0]\ngo to x: (0) y: (0)\nswitch costume to (menu1 v)\nset [ghost v] effect to (0)\nrepeat until <(Intro) = [1]>\n    if <(Intro) = [0]> then\n        set [tempo v] to ((tempo) + (1))\n        if <(tempo) = [800]> then\n            switch costume to (menu1 v)\n        end\n        if <(tempo) = [1200]> then\n            switch costume to (menu2 v)\n            set [tempo v] to [0]\n        end\n    end\n    if <(Intro) = [1]> then\n        switch costume to (menu1 v)\n        set [ghost v] effect to (100)\n    end\n    if <(Intro) = [3]> then\n        switch costume to (menu1 v)\n        set [ghost v] effect to (100)\n    end\nend\nforever\n    go to [front v] layer\nend\n\nwhen I receive [intro_2 v]\nset [ghost v] effect to (100)\nswitch costume to (menu1 v)\n\n
Press Arrow keys to move\nPress A to FIRE\nPress Z to JUMP\nPress SPACE BAR to skip the intro\n\nUPDATE: v1.2 : \nYou can jump pressing UP ARROW as well\nDuring the game, press SPACE BAR to turn Ghost effect OFF and ON\n\nUPDATE: v1.3 : \nMade a jump in stage 5 easier\n\nUPDATE: v1.4 :\nFixed some bugs caused by the Scratch 3.0 porting