lightseeker rpg combat platformer

Instructions: if you heart this game, please leave a comment of why you left a heart. if you did not heart this game, please leave a comment of what I can do to fix whatever caused you not to leave a heart. enjoy!\n

@Stage\n\n@player\n\nwhen flag clicked\nset [speed_x v] to [0]\nset [speed_y v] to [0]\nset [hero_attack_position v] to [0]\ngo to x: (150) y: (-50)\nset rotation style [left-right v]\nforever\n    run_game\nend\n\ndefine run_game\nif <<<key (left arrow v) pressed?> or <key (a v) pressed?>> and <(hero_movement) = [1]>> then\n    set [hero_player_dirrection v] to [0]\n    change [speed_x v] by (-0.25)\n    if <[2] < (speed_X)> then\n        change [speed_x v] by (-0.7)\n    end\nelse\n    if <<<key (right arrow v) pressed?> or <key (d v) pressed?>> and <(hero_movement) = [1]>> then\n        set [hero_player_dirrection v] to [1]\n        change [speed_x v] by (0.25)\n        if <[-2] > (speed_X)> then\n            change [speed_x v] by (0.7)\n        end\n    else\n        set [speed_x v] to ((speed_X) * (0.8))\n    end\nend\nif <(speed_X) < [-5.1]> then\n    change [speed_x v] by (1)\nend\nif <(speed_X) > [5.1]> then\n    change [speed_x v] by (-1)\nend\nchange [speed_y v] by (-1)\nif <(speed_Y) < [-30]> then\n    set [speed_y v] to [-30]\nend\nchange x by (speed_X)\nif <touching (ground v)?> then\n    change y by (1)\n    if <touching (ground v)?> then\n        change y by (1)\n        if <touching (ground v)?> then\n            change y by (1)\n            if <touching (ground v)?> then\n                change y by (1)\n                if <touching (ground v)?> then\n                    change y by (1)\n                    if <touching (ground v)?> then\n                        change y by (1)\n                        if <touching (ground v)?> then\n                            change y by (1)\n                            if <touching (ground v)?> then\n                                change y by (1)\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\nif <touching (ground v)?> then\n    change y by (-8)\n    repeat until <not <touching (ground v)?>>\n        change x by ((speed_X) * (-1))\n    end\n    set [speed_x v] to [0]\nend\nchange y by (speed_Y)\nif <touching (ground v)?> then\n    repeat until <not <touching (ground v)?>>\n        change y by ((speed_Y) * (-1))\n    end\n    set [speed_y v] to [0]\nend\nchange y by (-1)\nif <<<touching (ground v)?> and <<key (z v) pressed?> or <key (k v) pressed?>>> and <(hero_movement) = [1]>> then\n    set [speed_y v] to ((11) + (([abs v] of (speed_X) ) * (0.4)))\n    set [pitch v] effect to ((speed_X) * (10))\n    start sound [Low Whoosh v]\nend\nchange y by (1)\nset [hero_location_reference_x v] to (x position)\nset [hero_location_reference_y v] to (y position)\n\nwhen flag clicked\ngo to [front v] layer\nforever\n    if <(hero_player_dirrection) = [1]> then\n        point in direction (90)\n    else\n        point in direction (-90)\n    end\nend\n\nwhen I receive [hero_knockback_right v]\nset [speed_x v] to [-15]\nchange [speed_y v] by (7)\n\nwhen I receive [hero_knockback_left v]\nset [speed_x v] to [15]\nset [speed_y v] to [7]\n\nwhen I receive [hero_boosted_upwards v]\nset [speed_y v] to [9]\n\nwhen flag clicked\nforever\n    if <(invunerability_frames) < [5]> then\n        set [brightness v] effect to (100)\n    else\n        set [brightness v] effect to (player_heal_time)\n    end\nend\n\nwhen flag clicked\nforever\n    if <(lockdoors) = [0]> then\n        if <(x position) > [235]> then\n            set x to (-230)\n            change [world_map_ground_x v] by (1)\n            broadcast (enter_new_room v)\n        end\n        if <(x position) < [-235]> then\n            set x to (230)\n            change [world_map_ground_x v] by (-1)\n            broadcast (enter_new_room v)\n        end\n        if <(y position) < [-175]> then\n            set y to (170)\n            change [world_map_ground_y v] by (-1)\n            broadcast (enter_new_room v)\n        end\n        if <(y position) > [175]> then\n            set y to (-170)\n            set [speed_y v] to [12]\n            change [world_map_ground_y v] by (1)\n            broadcast (enter_new_room v)\n        end\n    end\nend\n\nwhen I receive [hero_hurt v]\nchange [player_health v] by (-1)\n\nwhen I receive [go_to_plylon v]\nwait (0.12) seconds\ngo to x: (pylon_x) y: (pylon_y)\n\n@ground\n\nwhen flag clicked\nforever\n    switch costume to (join [x] (join (world_map_ground_X) (join [-y] (world_map_ground_Y))))\nend\n\ndefine set_enemy_spawning (room_x) (room_y) (location_x) (location_y) (enemy_type)\nadd (room_x) to [enemy_spawn_list v]\nadd (room_y) to [enemy_spawn_list v]\nadd (location_x) to [enemy_spawn_list v]\nadd (location_y) to [enemy_spawn_list v]\nadd (enemy_type) to [enemy_spawn_list v]\n\nwhen flag clicked\ndelete all of [enemy_spawn_list v]\nset_enemy_spawning [-1] [5] [-116] [-147] [big_slime]\nset_enemy_spawning [0] [4] [200] [15] [weak_slime]\nset_enemy_spawning [0] [4] [-102] [-3] [big_slime]\nset_enemy_spawning [1] [0] [132] [-119] [weak_slime]\nset_enemy_spawning [2] [0] [74] [-87] [weak_slime]\nset_enemy_spawning [2] [0] [100] [-87] [big_slime]\nset_enemy_spawning [3] [0] [-70] [-158] [spikes]\nset_enemy_spawning [3] [0] [25] [-158] [spikes]\nset_enemy_spawning [4] [0] [182] [103] [fast_slime]\nset_enemy_spawning [4] [0] [-208] [56] [fast_slime]\nset_enemy_spawning [4] [0] [-14] [103] [fast_slime]\nset_enemy_spawning [5] [0] [-195] [-18] [weak_slime]\nset_enemy_spawning [5] [0] [-180] [150] [big_slime]\nset_enemy_spawning [5] [0] [170] [150] [weak_slime]\nset_enemy_spawning [-1] [0] [-20] [-70] [weak_slime]\nset_enemy_spawning [-2] [0] [37] [-70] [big_slime]\nset_enemy_spawning [-2] [0] [-33] [-85] [weak_slime]\nset_enemy_spawning [-3] [0] [105] [-128] [spikes]\nset_enemy_spawning [-3] [0] [-25] [-105] [spikes]\nset_enemy_spawning [-4] [0] [130] [88] [weak_slime]\nset_enemy_spawning [-4] [0] [-71] [-16] [fast_slime]\nset_enemy_spawning [-4] [0] [39] [37] [weak_slime]\nset_enemy_spawning [-6] [1] [0] [-100] [boss_slime]\nset_enemy_spawning [-7] [1] [-156] [-128] [weak_slime]\nset_enemy_spawning [-7] [1] [-86] [-128] [weak_slime]\nset_enemy_spawning [-7] [1] [-86] [-128] [fast_slime]\nset_enemy_spawning [-7] [1] [-86] [-128] [big_slime]\n\nwhen flag clicked\nwait (0.2) seconds\nif <(editing_game) = [0]> then\n    set [world_map_ground_x v] to [0]\n    set [world_map_ground_y v] to [6]\nelse\n    set [world_map_ground_x v] to [-8]\n    set [world_map_ground_y v] to [1]\nend\nbroadcast (enter_new_room v)\n\nwhen flag clicked\nset [music v] to [1]\nforever\n    if <(music) = [1]> then\n        play sound [hollow-knight-ost-enter-hallownest-youtubemp3free v] until done\n    else\n        if <(music) = [2]> then\n            play sound [04 - False Knight v] until done\n        end\n    end\nend\n\nwhen flag clicked\nset [obtain_slime_charm v] to [0]\nset [obtained_steel_sword v] to [0]\nset [pylon_slime v] to [0]\nset [editing_game v] to [0]\n\nif <(username) = [Mcnatty]> then\n    set [editing_game v] to [1]\nend\n\n@backround\n\nwhen flag clicked\ngo [backward v] (1) layers\nforever\n    switch costume to (join [x] (join (world_map_ground_X) (join [-y] (world_map_ground_Y))))\nend\n\nwhen flag clicked\n\nforever\n    set x to ((hero_location_reference_x) * (0.1))\nend\n\n@player_attack_hitbox\n\nwhen flag clicked\nset [hero_attack_speed v] to [5]\nforever\n    if <(hero_movement) = [1]> then\n        if <<key (up arrow v) pressed?> or <key (w v) pressed?>> then\n            if <<key (x v) pressed?> or <key (l v) pressed?>> then\n                if <(hero_attack_timer) > (hero_attack_speed)> then\n                    set [hero_attack_timer v] to [0]\n                    if <(hero_attack_speed) > (hero_attack_timer)> then\n                        set [hero_attack_position v] to [1]\n                        set [pitch v] effect to (50)\n                        start sound [High Whoosh v]\n                    end\n                end\n            end\n        else\n            if <<key (down arrow v) pressed?> or <key (s v) pressed?>> then\n                if <<key (x v) pressed?> or <key (l v) pressed?>> then\n                    if <(hero_attack_timer) > (hero_attack_speed)> then\n                        set [hero_attack_timer v] to [0]\n                        if <(hero_attack_speed) > (hero_attack_timer)> then\n                            set [hero_attack_position v] to [2]\n                            set [pitch v] effect to (-80)\n                            start sound [High Whoosh v]\n                        end\n                    end\n                end\n            else\n                if <<key (x v) pressed?> or <key (l v) pressed?>> then\n                    if <(hero_attack_timer) > (hero_attack_speed)> then\n                        set [hero_attack_timer v] to [0]\n                        if <(hero_attack_speed) > (hero_attack_timer)> then\n                            if <(hero_player_dirrection) = [0]> then\n                                set [hero_attack_position v] to [3]\n                            end\n                            if <(hero_player_dirrection) = [1]> then\n                                set [hero_attack_position v] to [4]\n                            end\n                            set [pitch v] effect to (-50)\n                            start sound [High Whoosh v]\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\n\nwhen flag clicked\nforever\n    change [hero_attack_timer v] by (1)\n    change [invunerability_frames v] by (1)\n    wait (0.05) seconds\n    if <(hero_attack_timer) = [3]> then\n        set [hero_attack_position v] to [0]\n    end\nend\n\nwhen flag clicked\nforever\n    if <(hero_attack_position) = [0]> then\n        go to x: (-200) y: (-200)\n    end\n    if <(hero_attack_position) = [1]> then\n        go to x: (() + (hero_location_reference_x)) y: ((35) + (hero_location_reference_y))\n    end\n    if <(hero_attack_position) = [2]> then\n        go to x: (hero_location_reference_x) y: ((-35) + (hero_location_reference_y))\n    end\n    if <(hero_attack_position) = [3]> then\n        go to x: ((hero_location_reference_x) + (-30)) y: (hero_location_reference_y)\n    end\n    if <(hero_attack_position) = [4]> then\n        go to x: ((hero_location_reference_x) + (30)) y: (hero_location_reference_y)\n    end\nend\n\nwhen flag clicked\nforever\n    if <touching (enemy v)?> then\n        if <(hero_attack_position) = [2]> then\n            broadcast (hero_boosted_upwards v)\n        end\n    end\nend\n\nwhen flag clicked\nforever\n    set [ghost v] effect to (100)\n    set [hero_attack_reference_x v] to (x position)\n    set [hero_attack_reference_y v] to (y position)\nend\n\n@enemy\n\nwhen I start as a clone\nset [speed_x v] to [0]\nset [speed_y v] to [0]\nset [personal_max_speed_x v] to [3]\nset [enemy_personal_acceleration v] to [1]\nset [enemy_ai_type v] to (enemy_ai_transfer_type)\nset [personal_argo_distance v] to [150]\nif <(enemy_ai_type) = [weak_slime]> then\n    set rotation style [left-right v]\n    set [personal_health v] to [4]\n    set [enemy_movement_type v] to [crawler]\n    switch costume to (weak_slime v)\nelse\n    if <(enemy_ai_type) = [big_slime]> then\n        set rotation style [left-right v]\n        set [personal_health v] to [8]\n        set [enemy_movement_type v] to [crawler]\n        switch costume to (big_slime v)\n    else\n        if <(enemy_ai_type) = [weak_bee]> then\n            set rotation style [left-right v]\n            set [personal_health v] to [5]\n            set [enemy_movement_type v] to [flying]\n            switch costume to (weak_bee v)\n        else\n            if <(enemy_ai_type) = [spikes]> then\n                set [personal_health v] to [99]\n                set [enemy_movement_type v] to [none]\n                switch costume to (spikes v)\n            else\n                if <(enemy_ai_type) = [knight]> then\n                    set rotation style [left-right v]\n                    set [personal_health v] to [16]\n                    set [enemy_movement_type v] to [crawler]\n                    set [personal_max_speed_x v] to [5]\n                    set [personal_argo_distance v] to [200]\n                    switch costume to (knight v)\n                else\n                    if <(enemy_ai_type) = [knight_ranged]> then\n                        set [personal_health v] to [25]\n                        set [enemy_movement_type v] to [crawler]\n                        set [personal_max_speed_x v] to [2]\n                        switch costume to (knight_ranged v)\n                    else\n                        if <(enemy_ai_type) = [fast_slime]> then\n                            set [personal_health v] to [6]\n                            set [enemy_movement_type v] to [crawler]\n                            set [personal_max_speed_x v] to [6]\n                            switch costume to (fast_slime v)\n                        else\n                            if <(enemy_ai_type) = [boss_slime]> then\n                                set [lockdoors v] to [1]\n                                set [personal_health v] to [30]\n                                set [enemy_movement_type v] to [crawler]\n                                set [personal_max_speed_x v] to [20]\n                                set [personal_argo_distance v] to [720]\n                                set [enemy_personal_acceleration v] to [1]\n                                switch costume to (boss_slime v)\n                                set [music v] to [2]\n                                wait (1) seconds\n                                stop all sounds\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\n\nwhen I start as a clone\nforever\n    point towards (player v)\n    if <<(enemy_movement_type) = [crawler]> or <(enemy_movement_type) = [rusher]>> then\n        if <(tracking_player) = [1]> then\n            if <(hero_location_reference_x) > (x position)> then\n                change [speed_x v] by (enemy_personal_acceleration)\n            else\n                change [speed_x v] by ((enemy_personal_acceleration) * (-1))\n            end\n        end\n        if <not <(enemy_ai_type) = [rusher]>> then\n            set [speed_x v] to ((speed_X) * (0.8))\n            if <(speed_X) > (personal_max_speed_x)> then\n                change [speed_x v] by (((enemy_personal_acceleration) + (0.1)) * (-1))\n            else\n                if <(speed_X) < ((personal_max_speed_x) * (-1))> then\n                    change [speed_x v] by ((enemy_personal_acceleration) + (0.1))\n                end\n            end\n        end\n    end\n    if <not <<(enemy_movement_type) = [flying]> or <(enemy_movement_type) = [none]>>> then\n        change [speed_y v] by (-1)\n    end\n    if <not <(enemy_movement_type) = [none]>> then\n        change x by (speed_X)\n    end\n    if <touching (ground v)?> then\n        change y by (1)\n        if <touching (ground v)?> then\n            change y by (1)\n            if <touching (ground v)?> then\n                change y by (1)\n                if <touching (ground v)?> then\n                    change y by (1)\n                    if <touching (ground v)?> then\n                        change y by (1)\n                        if <touching (ground v)?> then\n                            change y by (1)\n                            if <touching (ground v)?> then\n                                change y by (1)\n                                if <touching (ground v)?> then\n                                    change y by (1)\n                                end\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\n    if <touching (ground v)?> then\n        change y by (-8)\n        repeat until <not <touching (ground v)?>>\n            change x by ((speed_X) * (-1))\n        end\n        set [speed_x v] to [0]\n    end\n    if <not <(enemy_movement_type) = [none]>> then\n        change y by (speed_Y)\n    end\n    if <touching (ground v)?> then\n        repeat until <not <touching (ground v)?>>\n            change y by ((speed_Y) * (-1))\n        end\n        set [speed_y v] to [0]\n    end\n    change y by (-1)\n    if <<(enemy_movement_type) = [crawler]> or <(enemy_movement_type) = [rusher]>> then\n        if <(tracking_player) = [1]> then\n            if <<touching (ground v)?> and <((hero_location_reference_y) - (20)) > (y position)>> then\n                set [speed_y v] to [8]\n            end\n        end\n        change y by (1)\n    else\n        if <(enemy_movement_type) = [flying]> then\n            if <(tracking_player) = [1]> then\n                if <(x position) < (hero_location_reference_x)> then\n                    change [speed_x v] by (1)\n                else\n                    change [speed_x v] by (-1)\n                end\n                if <(speed_X) > [3]> then\n                    change [speed_x v] by (-1.1)\n                else\n                    if <(speed_X) < [-3]> then\n                        change [speed_x v] by (1.1)\n                    end\n                end\n                if <((y position) + (-30)) < (hero_location_reference_y)> then\n                    change [speed_y v] by (1)\n                else\n                    change [speed_y v] by (-1)\n                end\n                if <(speed_Y) > [4]> then\n                    change [speed_y v] by (-1.1)\n                else\n                    if <(speed_Y) < [-4]> then\n                        change [speed_y v] by (1.1)\n                    end\n                end\n            end\n        end\n    end\n    if <(enemy_ai_type) = [arrow]> then\n        change y by (1)\n    end\nend\n\nwhen I start as a clone\nforever\n    if <<touching (player_attack_hitbox v)?> or <touching (player_magic v)?>> then\n        if <(personal_attack_cooldown_immunity) > [3]> then\n            if <((hero_location_reference_x) + (-5)) > (x position)> then\n                set [speed_y v] to ((pick random (2) to (15)) * (-1))\n            else\n                set [speed_y v] to ((pick random (2) to (15)) * (1))\n            end\n            start sound [Hit v]\n            if <touching (player_attack_hitbox v)?> then\n                broadcast (successful_hit v)\n            end\n            set [personal_attack_cooldown_immunity v] to [0]\n            if <touching (player_attack_hitbox v)?> then\n                change [personal_health v] by ((hero_sword_dammage) * (-1))\n            else\n                if <touching (player_magic v)?> then\n                    change [personal_health v] by (-4)\n                end\n            end\n            set [brightness v] effect to (100)\n            if <not <(enemy_ai_type) = [boss_slime]>> then\n                if <(hero_location_reference_x) > (x position)> then\n                    set [speed_x v] to ((pick random (2) to (15)) * (-1))\n                else\n                    set [speed_x v] to ((pick random (2) to (15)) * (1))\n                end\n            end\n        end\n    else\n        set [brightness v] effect to (0)\n    end\nend\n\nwhen I start as a clone\nforever\n    if <<touching (player v)?> and <[10] < (invunerability_frames)>> then\n        set [invunerability_frames v] to [0]\n        start sound [hero_damage v]\n        broadcast (hero_hurt v)\n        if <(hero_location_reference_x) > (x position)> then\n            broadcast (hero_knockback_left v)\n        else\n            broadcast (hero_knockback_right v)\n        end\n    end\nend\n\nwhen I start as a clone\nforever\n    wait (0.1) seconds\n    change [personal_attack_cooldown_immunity v] by (1)\n    change [enemy_action_timer_1 v] by (1)\nend\n\nwhen flag clicked\ngo to x: (-1000) y: (-1000)\nset [ghost v] effect to (100)\n\ndefine clone_enemy (x) (y) (enemy_type)\ngo to x: (x) y: (y)\nset [ghost v] effect to (0)\nset [enemy_ai_transfer_type v] to (enemy_type)\ncreate clone of (_myself_ v)\ngo to x: (-1000) y: (-1000)\nset [ghost v] effect to (100)\n\nwhen I start as a clone\nforever\n    set [distance_from_hero v] to ([abs v] of ((hero_location_reference_x) - (x position)) )\n    if <(distance_from_hero) < (personal_argo_distance)> then\n        set [tracking_player v] to [1]\n    else\n        set [tracking_player v] to [0]\n    end\nend\n\nwhen I start as a clone\nforever\n    if <<(personal_health) < [0]> or <(personal_health) = [0]>> then\n        start sound [Punch Sound Effect-heChAOTiC v]\n        set [dead_enemy_x v] to (x position)\n        set [dead_enemy_y v] to (y position)\n        set [dead_enemy_type v] to (enemy_ai_type)\n        broadcast (dead_enemy v)\n        if <(enemy_ai_type) = [boss_slime]> then\n            set [lockdoors v] to [0]\n            set [☁ player_1 v] to [0]\n            set [music v] to [1]\n            wait (1) seconds\n            clear sound effects\n        end\n        delete this clone\n    end\nend\n\nwhen I start as a clone\nforever\n    if <<(enemy_ai_type) = [knight]> and <(tracking_player) = [1]>> then\n        if <(enemy_action_timer_1) > [4]> then\n            set [enemy_action_timer_1 v] to [0]\n            if <(pick random (1) to (4)) = [1]> then\n                repeat until <(costume [name v]) = [knight5]>\n                    next costume\n                    wait (0.001) seconds\n                    set [personal_attack_cooldown_immunity v] to [0]\n                end\n                switch costume to (knight v)\n            else\n                if <(pick random (1) to (2)) = [1]> then\n                    switch costume to (knight6 v)\n                    repeat until <(costume [name v]) = [knight10]>\n                        next costume\n                        wait (0.001) seconds\n                        set [personal_attack_cooldown_immunity v] to [0]\n                    end\n                    switch costume to (knight v)\n                end\n            end\n        end\n    end\nend\n\nwhen I start as a clone\nforever\n    if <<(enemy_ai_type) = [knight_ranged]> and <(tracking_player) = [1]>> then\n        if <(enemy_action_timer_1) > [1]> then\n            set [enemy_action_timer_1 v] to [0]\n            if <[1] = (pick random (1) to (6))> then\n                add (x position) to [enemy_attack_requests v]\n                add (y position) to [enemy_attack_requests v]\n                broadcast (enemy_attack_request v)\n                wait (0.1) seconds\n                delete all of [enemy_attack_requests v]\n            end\n        end\n    end\nend\n\nwhen I receive [enter_new_room v]\nset [delete_all_clones v] to [1]\nwait (0.01) seconds\nset [delete_all_clones v] to [0]\nset [enemy_spawn_system_counter_list v] to [0]\nrepeat ((length of [enemy_spawn_list v]) / (5))\n    change [enemy_spawn_system_counter_list v] by (1)\n    if <<(world_map_ground_X) = (item (((enemy_spawn_system_counter_list) * (5)) - (4)) of [enemy_spawn_list v])> and <(world_map_ground_Y) = (item (((enemy_spawn_system_counter_list) * (5)) + (-3)) of [enemy_spawn_list v])>> then\n        clone_enemy (item (((enemy_spawn_system_counter_list) * (5)) + (-2)) of [enemy_spawn_list v]) (item (((enemy_spawn_system_counter_list) * (5)) + (-1)) of [enemy_spawn_list v]) (item (((enemy_spawn_system_counter_list) * (5)) + (0)) of [enemy_spawn_list v])\n    end\nend\n\nwhen I start as a clone\nforever\n    if <(delete_all_clones) = [1]> then\n        delete this clone\n    end\nend\n\n@player_attack_sprite\n\nwhen flag clicked\nforever\n    if <(hero_attack_position) = [0]> then\n        go to x: (-1000) y: (-1000)\n    else\n        go to x: (hero_location_reference_x) y: (hero_location_reference_y)\n    end\n    set rotation style [all around v]\n    if <(hero_attack_position) = [4]> then\n        change [hero_attack_dirrection_timer v] by (-20)\n    else\n        change [hero_attack_dirrection_timer v] by (20)\n    end\n    if <(hero_attack_position) = [1]> then\n        set [hero_attack_360_direction v] to [-360]\n    else\n        if <(hero_attack_position) = [2]> then\n            set [hero_attack_360_direction v] to [-180]\n        else\n            if <(hero_attack_position) = [3]> then\n                set [hero_attack_360_direction v] to [-90]\n            else\n                if <(hero_attack_position) = [4]> then\n                    set [hero_attack_360_direction v] to [-90]\n                end\n            end\n        end\n    end\n    point in direction (((hero_attack_360_direction) - (90)) + ((hero_attack_dirrection_timer) * (0.7)))\nend\n\nwhen flag clicked\nforever\n    if <(hero_attack_position) = [0]> then\n        set [hero_attack_dirrection_timer v] to [0]\n    end\nend\n\nwhen flag clicked\nforever\n    wait (0.1) seconds\n    create clone of (_myself_ v)\nend\n\nwhen I start as a clone\nrepeat (10)\n    change [ghost v] effect by (10)\nend\ndelete this clone\n\nwhen flag clicked\nset [sword_name v] to [iron_sword]\nforever\n    if <(sword_name) = [iron_sword]> then\n        switch costume to (iron_sword v)\n        set [hero_sword_dammage v] to [1]\n    else\n        if <(sword_name) = [steel_sword]> then\n            switch costume to (steel_sword v)\n            set [hero_sword_dammage v] to [1.34]\n        end\n    end\nend\n\n@enemy_ranged_attack\n\nwhen I receive [enemy_attack_request v]\ngo to x: (item (1) of [enemy_attack_requests v]) y: (item (2) of [enemy_attack_requests v])\ncreate clone of (_myself_ v)\ngo to x: (-1000) y: (-1000)\n\nwhen flag clicked\nset [ghost v] effect to (0)\ngo to x: (-1000) y: (-1000)\n\nwhen I start as a clone\nset rotation style [left-right v]\npoint towards (player v)\nif <(x position) < (hero_location_reference_x)> then\n    set [enemy_arrow_facing_dirrection v] to [1]\nelse\n    set [enemy_arrow_facing_dirrection v] to [-1]\nend\nforever\n    change x by ((15) * (enemy_Arrow_facing_Dirrection))\n    if <touching (_edge_ v)?> then\n        delete this clone\n    end\nend\n\n@death_effects \n\nwhen flag clicked\nset [ghost v] effect to (100)\ngo to x: (-1000) y: (-1000)\n\nwhen I receive [dead_enemy v]\ngo to x: (dead_enemy_X) y: (dead_enemy_Y)\nswitch costume to (leave empty!!! v)\nset [ghost v] effect to (0)\nif <<(dead_enemy_type) = [weak_slime]> or <(dead_enemy_type) = [fast_slime]>> then\n    repeat (10)\n        create clone of (_myself_ v)\n    end\nelse\n    if <<(dead_enemy_type) = [big_slime]> or <(dead_enemy_type) = [chest]>> then\n        repeat (20)\n            create clone of (_myself_ v)\n        end\n    else\n        if <<(dead_enemy_type) = [knight]> or <(dead_enemy_type) = [knight_ranged]>> then\n            repeat (1)\n                create clone of (_myself_ v)\n            end\n        else\n            if <(dead_enemy_type) = [hero]> then\n                repeat (1)\n                    create clone of (_myself_ v)\n                end\n            end\n        end\n    end\nend\nset [ghost v] effect to (100)\ngo to x: (-1000) y: (-1000)\n\nwhen I start as a clone\nif <<<(dead_enemy_type) = [weak_slime]> or <(dead_enemy_type) = [big_slime]>> or <(dead_enemy_type) = [fast_slime]>> then\n    set [ran_1 v] to (pick random (1) to (3))\n    if <(ran_1) = [1]> then\n        switch costume to (slime_1 v)\n    end\n    if <(ran_1) = [2]> then\n        switch costume to (slime_2 v)\n    end\n    if <(ran_1) = [3]> then\n        switch costume to (slime_3 v)\n    end\nelse\n    if <<(dead_enemy_type) = [knight]> or <(dead_enemy_type) = [ranged_knight]>> then\n        switch costume to (costume1 v)\n    else\n        if <(dead_enemy_type) = [chest]> then\n            set [ran_1 v] to (pick random (1) to (2))\n            if <(ran_1) = [1]> then\n                switch costume to (wood_1 v)\n            end\n            if <(ran_1) = [2]> then\n                switch costume to (wood_2 v)\n            end\n        end\n    end\nend\nset [death_animation_speed_x v] to (pick random (-10) to (10))\nset [death_animation_speed_y v] to (pick random (4) to (7))\nforever\n    repeat until <<touching (ground v)?> or <touching (_edge_ v)?>>\n        set [death_animation_speed_x v] to ((death_animation_speed_X) * (0.8))\n        change [death_animation_speed_y v] by (-0.5)\n        change x by (death_animation_speed_X)\n        change y by (death_animation_speed_Y)\n    end\n    repeat (20)\n        change [ghost v] effect by (5)\n    end\n    delete this clone\nend\n\n@coin_1\n\nwhen flag clicked\nset [ghost v] effect to (100)\ngo to x: (-1000) y: (-1000)\n\nwhen I receive [dead_enemy v]\nif <(dead_enemy_loot_cooldown) > [50]> then\n    set [dead_enemy_loot_cooldown v] to [0]\n    go to x: (dead_enemy_X) y: (dead_enemy_Y)\n    switch costume to (empty v)\n    set [ghost v] effect to (0)\n    if <(dead_enemy_type) = [chest]> then\n        repeat (50)\n            create clone of (_myself_ v)\n        end\n    else\n        repeat (5)\n            create clone of (_myself_ v)\n        end\n    end\n    set [ghost v] effect to (100)\n    go to x: (-1000) y: (-1000)\nend\n\nwhen I start as a clone\nswitch costume to (coin v)\ngo to [front v] layer\nset [death_animation_speed_x v] to (pick random (-10) to (10))\nset [death_animation_speed_y v] to (pick random (6) to (11))\nforever\n    repeat until <<touching (ground v)?> or <touching (_edge_ v)?>>\n        set [death_animation_speed_x v] to ((death_animation_speed_X) * (0.9))\n        change [death_animation_speed_y v] by (-0.5)\n        change x by (death_animation_speed_X)\n        change y by (death_animation_speed_Y)\n    end\n    wait (5) seconds\n    repeat (20)\n        change [ghost v] effect by (5)\n    end\n    delete this clone\nend\n\nwhen I start as a clone\nforever\n    if <touching (player v)?> then\n        change [coins v] by (1)\n        start sound [Coin v]\n        delete this clone\n    end\nend\n\nwhen flag clicked\nforever\n    change [dead_enemy_loot_cooldown v] by (1)\nend\n\n@loot_chest\n\nwhen flag clicked\nforever\n    if <<touching (player v)?> and <(chest_active) = [1]>> then\n        add (join [x] (join (world_map_ground_X) (join [-] (join [y] (world_map_ground_Y))))) to [chests_looted_list v]\n        set [chest_active v] to [0]\n        set [dead_enemy_type v] to [chest]\n        set [dead_enemy_x v] to (x position)\n        set [dead_enemy_y v] to ((20) + (y position))\n        broadcast (dead_enemy v)\n        go to x: (-1000) y: (-1000)\n    end\nend\n\nwhen flag clicked\ngo to x: (-1000) y: (-1000)\nset [chest_active v] to [0]\ndelete all of [chests_looted_list v]\nforever\n    if <not <[chests_looted_list v] contains (join [x] (join (world_map_ground_X) (join [-] (join [y] (world_map_ground_Y)))))?>> then\n        if <<(world_map_ground_X) = [4]> and <(world_map_ground_Y) = [1]>> then\n            go to x: (-148) y: (-170)\n            set [chest_active v] to [1]\n        else\n            if <<(world_map_ground_X) = [-4]> and <(world_map_ground_Y) = [1]>> then\n                go to x: (-148) y: (-170)\n                set [chest_active v] to [1]\n            else\n                go to x: (-1000) y: (-1000)\n                set [chest_active v] to [0]\n            end\n        end\n    else\n        go to x: (-1000) y: (-1000)\n        set [chest_active v] to [0]\n    end\nend\n\nwhen flag clicked\nforever\n    if <(chest_active) = [0]> then\n        go to x: (-1000) y: (-1000)\n        set [ghost v] effect to (100)\n    else\n        set [ghost v] effect to (0)\n    end\nend\n\n@shopkeeper_npc\n\nwhen flag clicked\ndelete all of [items_locations_purchased_list v]\nforever\n    if <(shopkeeper_active) = [0]> then\n        set [ghost v] effect to (0)\n        go to x: (-1000) y: (-1000)\n    else\n        set [ghost v] effect to (0)\n    end\nend\n\nwhen flag clicked\nset rotation style [left-right v]\nforever\n    point towards (player v)\n    if <<(world_map_ground_X) = [-6]> and <(world_map_ground_Y) = [0]>> then\n        switch costume to (hood v)\n        set [shopkeeper_active v] to [1]\n        set [price v] to [-1]\n        go to x: (-139) y: (0)\n        if <touching (player v)?> then\n            if <(item_location_bought) = [0]> then\n                say [Hello! what might a feisty little guy like you be  doing in my lab? I have quite a fiesty little spell for a fiesty little guy like you! would you like it?  becase there are some slimes in the room above us, and if you could use the spell to take them out, then, well.. \(click space to accept\)]\n            else\n                say [I knew somone like you might enjoy it! to use the spell, hold  right or left arrow key, and press C! of coarse, you will need to have some light to use it!]\n            end\n        end\n    else\n        if <<(world_map_ground_X) = [7]> and <(world_map_ground_Y) = [-1]>> then\n            switch costume to (old man v)\n            set [shopkeeper_active v] to [1]\n            set [price v] to [49]\n            go to x: (-138) y: (-159)\n            if <(item_location_bought) = [0]> then\n                say [after the attack, I used to live here with my sons, until they all died. I don't have much to offer, but would you like to buy my steel sword for 50 coins? \(steel sword does 34% more dammage then defualt sword, press space to buy\)]\n            else\n                say [thank you. now I do not have to have a reminder of how I failed to defend them...]\n            end\n        else\n            if <<(world_map_ground_X) = [-8]> and <(world_map_ground_Y) = [1]>> then\n                switch costume to (item v)\n                set [shopkeeper_active v] to [1]\n                set [price v] to [-1]\n                go to x: (-138) y: (-110)\n                if <(item_location_bought) = [0]> then\n                    say [click space to collect the charm!]\n                else\n                    say [slime charm; this charm is soaked in disgusting slime. equipting it at a pylon will allow the user to swing thier blade faster.]\n                end\n            else\n                set [shopkeeper_active v] to [0]\n            end\n        end\n    end\n    if <not <touching (player v)?>> then\n        say []\n    end\n    if <<<touching (player v)?> and <(item_location_bought) = [0]>> and <(coins) > (price)>> then\n        if <key (space v) pressed?> then\n            add (join [x] (join (world_map_ground_X) (join [-] (join [y] (world_map_ground_Y))))) to [items_locations_purchased_list v]\n            change [coins v] by ((price) * (-1))\n        end\n    end\n    if <[items_locations_purchased_list v] contains (join [x] (join (world_map_ground_X) (join [-] (join [y] (world_map_ground_Y)))))?> then\n        set [item_location_bought v] to [1]\n    else\n        set [item_location_bought v] to [0]\n    end\nend\n\nwhen flag clicked\nset [coins v] to [0]\n\nadd [x-6-y0] to [items_locations_purchased_list v]\n\nwhen flag clicked\nforever\n    if <[items_locations_purchased_list v] contains [x7-y-1]?> then\n        set [obtained_steel_sword v] to [1]\n    end\n    if <[items_locations_purchased_list v] contains [x-8-y1]?> then\n        set [obtain_slime_charm v] to [1]\n    end\nend\n\n@health_bar\n\nwhen flag clicked\nforever\n    switch costume to (player_health)\nend\n\nwhen flag clicked\nset [lockdoors v] to [0]\nforever\n    if <(player_health) < [1]> then\n        set [lockdoors v] to [0]\n        set [world_map_ground_x v] to [0]\n        set [world_map_ground_y v] to [0]\n        clear sound effects\n        wait (1) seconds\n        set [delete_all_clones v] to [1]\n        set [music v] to [1]\n        broadcast (enter_new_room v)\n        broadcast (go_to_plylon v)\n        set [delete_all_clones v] to [0]\n        set [player_health v] to (player_maxhealth)\n    end\n    if <(player_health) > (player_maxhealth)> then\n        set [player_health v] to (player_maxhealth)\n    end\nend\n\nwhen flag clicked\ngo to [front v] layer\nforever\n    if <<(hero_location_reference_x) < [74]> and <[80] < (hero_location_reference_y)>> then\n        set [ghost v] effect to (75)\n    else\n        set [ghost v] effect to (10)\n    end\nend\n\n@magic_bar\n\nwhen flag clicked\nforever\n    if <(player_magic) > [80]> then\n        switch costume to (4-1 v)\n        wait (0.2) seconds\n        switch costume to (4-2 v)\n        wait (0.2) seconds\n        switch costume to (4-3 v)\n        wait (0.2) seconds\n    else\n        if <(player_magic) > [45]> then\n            switch costume to (3-1 v)\n            wait (0.2) seconds\n            switch costume to (3-2 v)\n            wait (0.2) seconds\n            switch costume to (3-3 v)\n            wait (0.2) seconds\n            switch costume to (3-4 v)\n            wait (0.2) seconds\n        else\n            if <(player_magic) > [25]> then\n                switch costume to (2-1 v)\n            else\n                if <(player_magic) > [10]> then\n                    switch costume to (1-1 v)\n                else\n                    switch costume to (empty v)\n                end\n            end\n        end\n    end\nend\n\nwhen I receive [successful_hit v]\nif <(player_magic) < [100]> then\n    change [player_magic v] by (6)\n    set [brightness v] effect to (100)\n    repeat (10)\n        wait (0.0001) seconds\n        change [brightness v] effect by (-10)\n    end\n    set [brightness v] effect to (0)\nend\n\nwhen flag clicked\nforever\n    if <(player_magic) > [100]> then\n        set [player_magic v] to [100]\n    end\n    if <(player_magic) < [0]> then\n        set [player_magic v] to [0]\n    end\nend\n\nwhen flag clicked\ngo to [front v] layer\nset [player_magic v] to [0]\nset [player_health v] to [5]\nforever\n    if <<(hero_location_reference_x) < [74]> and <[70] < (hero_location_reference_y)>> then\n        set [ghost v] effect to (75)\n    else\n        set [ghost v] effect to (10)\n    end\nend\n\n@player_magic\n\nwhen flag clicked\nset rotation style [left-right v]\nforever\n    if <<key (d v) pressed?> or <key (right arrow v) pressed?>> then\n        if <<<<key (c v) pressed?> and <(hero_magic_attack_cooldown) > [50]>> and <(player_magic) > [45]>> and <[items_locations_purchased_list v] contains [x-6-y0]?>> then\n            set [hero_magic_attack_cooldown v] to [0]\n            change [player_magic v] by (-45)\n            go to x: (hero_location_reference_x) y: (hero_location_reference_y)\n            set [velocity_x v] to [20]\n            point in direction (90)\n            broadcast (hero_knockback_right v)\n        end\n    else\n        if <<key (a v) pressed?> or <key (left arrow v) pressed?>> then\n            if <<<<key (c v) pressed?> and <(hero_magic_attack_cooldown) > [50]>> and <(player_magic) > [45]>> and <[items_locations_purchased_list v] contains [x-6-y0]?>> then\n                set [hero_magic_attack_cooldown v] to [0]\n                change [player_magic v] by (-45)\n                go to x: (hero_location_reference_x) y: (hero_location_reference_y)\n                set [velocity_x v] to [-20]\n                point in direction (-90)\n                broadcast (hero_knockback_left v)\n            end\n        else\n            if <key (c v) pressed?> then\n                if <<(player_magic) > [19]> and <(player_health) < (player_maxhealth)>> then\n                    set [hero_movement v] to [0]\n                    change [player_heal_time v] by (10)\n                end\n            else\n                set [hero_movement v] to [1]\n                set [player_heal_time v] to [0]\n            end\n            if <[99] < (player_heal_time)> then\n                start sound [focus_health_heal v]\n                set [player_heal_time v] to [0]\n                change [player_health v] by (1)\n                change [player_magic v] by (-20)\n            end\n        end\n    end\nend\n\nwhen flag clicked\nforever\n    change x by (velocity_X)\n    change y by (velocity_Y)\n    change [hero_magic_attack_cooldown v] by (1)\nend\n\nwhen flag clicked\nforever\n    if <(x position) > [320]> then\n        set [ghost v] effect to (100)\n    else\n        if <[-320] > (x position)> then\n            set [ghost v] effect to (100)\n        else\n            set [ghost v] effect to (0)\n        end\n    end\nend\n\nwhen flag clicked\nset [player_maxhealth v] to [5]\n\n@door_down\n\nwhen flag clicked\nforever\n    if <<(world_map_ground_X) = [7]> and <(world_map_ground_Y) = [0]>> then\n        go to x: (66) y: (-138)\n        set [door_1_active v] to [1]\n    else\n        set [door_1_active v] to [0]\n    end\nend\n\nwhen flag clicked\nforever\n    if <(door_1_active) = [1]> then\n        set [ghost v] effect to (0)\n    else\n        set [ghost v] effect to (100)\n        go to x: (-1000) y: (-1000)\n    end\nend\n\nwhen flag clicked\nforever\n    if <<touching (player v)?> and <(door_1_active) = [1]>> then\n        if <key (down arrow v) pressed?> then\n            change [world_map_ground_y v] by (-1)\n        end\n    end\nend\n\n@door_up\n\nwhen flag clicked\nforever\n    if <<(world_map_ground_X) = [7]> and <(world_map_ground_Y) = [-1]>> then\n        go to x: (66) y: (-138)\n        set [door_1_active v] to [1]\n    else\n        set [door_1_active v] to [0]\n    end\nend\n\nwhen flag clicked\nforever\n    if <(door_1_active) = [1]> then\n        set [ghost v] effect to (0)\n    else\n        set [ghost v] effect to (100)\n        go to x: (-1000) y: (-1000)\n    end\nend\n\nwhen flag clicked\nforever\n    if <<touching (player v)?> and <(door_1_active) = [1]>> then\n        if <key (up arrow v) pressed?> then\n            change [world_map_ground_y v] by (1)\n        end\n    end\nend\n\n@pylon\n\nwhen flag clicked\nif <(editing_game) = [0]> then\n    set [pylon_central v] to [0]\n    set [pylon_left v] to [0]\n    set [pylon_right v] to [0]\n    set [pylon_slime v] to [0]\nelse\n    set [pylon_central v] to [1]\n    set [pylon_left v] to [1]\n    set [pylon_right v] to [1]\n    set [pylon_slime v] to [1]\nend\nforever\n    turn right (1) degrees\n    if <<(world_map_ground_X) = [0]> and <(world_map_ground_Y) = [0]>> then\n        go to x: (0) y: (-20)\n        set [pylon_active v] to [1]\n        if <touching (player v)?> then\n            set [pylon_central v] to [1]\n        end\n    else\n        if <<(world_map_ground_X) = [6]> and <(world_map_ground_Y) = [0]>> then\n            go to x: (129) y: (-130)\n            set [pylon_active v] to [1]\n            if <touching (player v)?> then\n                set [pylon_right v] to [1]\n            end\n        else\n            if <<(world_map_ground_X) = [-5]> and <(world_map_ground_Y) = [0]>> then\n                go to x: (40) y: (-130)\n                set [pylon_active v] to [1]\n                if <touching (player v)?> then\n                    set [pylon_left v] to [1]\n                end\n            else\n                if <<(world_map_ground_X) = [-8]> and <(world_map_ground_Y) = [1]>> then\n                    go to x: (93) y: (-90)\n                    set [pylon_active v] to [1]\n                    if <touching (player v)?> then\n                        set [pylon_slime v] to [1]\n                    end\n                else\n                    go to x: (-1000) y: (-1000)\n                    set [pylon_active v] to [1]\n                end\n            end\n        end\n    end\nend\n\nwhen flag clicked\nforever\n    set [pylon_x v] to (x position)\n    set [pylon_y v] to (y position)\n    if <(pylon_active) = [1]> then\n        set [ghost v] effect to (0)\n    else\n        set [ghost v] effect to (100)\n        go to x: (-1000) y: (-1000)\n    end\nend\n\nwhen flag clicked\nforever\n    if <<touching (player v)?> and <key (space v) pressed?>> then\n        broadcast (open_map v)\n    end\n    if <not <touching (player v)?>> then\n        broadcast (close_map v)\n    end\nend\n\n@titleSprite1\n\nwhen flag clicked\nforever\n    go to [front v] layer\n    set [ghost v] effect to (100)\nend\n\n@map\n\nwhen I receive [open_map v]\nset [map_open v] to [1]\nset [ghost v] effect to (0)\nif <(pylon_central) = [1]> then\n    switch costume to (area_central v)\n    create clone of (_myself_ v)\nend\nif <(pylon_left) = [1]> then\n    switch costume to (area_left v)\n    create clone of (_myself_ v)\nend\nif <(pylon_right) = [1]> then\n    switch costume to (area_right v)\n    create clone of (_myself_ v)\nend\nif <(pylon_slime) = [1]> then\n    switch costume to (area_slime v)\n    create clone of (_myself_ v)\nend\nswitch costume to (text_box v)\n\nwhen I receive [close_map v]\nset [map_open v] to [0]\nset [ghost v] effect to (100)\n\nwhen I start as a clone\nforever\n    if <(map_open) = [0]> then\n        delete this clone\n    end\n    if <touching (mouse-pointer v)?> then\n        set [brightness v] effect to (40)\n        if <mouse down?> then\n            if <(costume [name v]) = [area_right]> then\n                broadcast (close_map v)\n                set [world_map_ground_x v] to [6]\n                set [world_map_ground_y v] to [0]\n                broadcast (go_to_plylon v)\n            else\n                if <(costume [name v]) = [area_left]> then\n                    broadcast (close_map v)\n                    set [world_map_ground_x v] to [-5]\n                    set [world_map_ground_y v] to [0]\n                    broadcast (go_to_plylon v)\n                else\n                    if <(costume [name v]) = [area_slime]> then\n                        broadcast (close_map v)\n                        set [world_map_ground_x v] to [-8]\n                        set [world_map_ground_y v] to [1]\n                        broadcast (go_to_plylon v)\n                    else\n                        broadcast (close_map v)\n                        set [world_map_ground_x v] to [0]\n                        set [world_map_ground_y v] to [0]\n                        broadcast (go_to_plylon v)\n                    end\n                end\n            end\n        end\n    else\n        set [brightness v] effect to (0)\n    end\nend\n\nwhen flag clicked\nset [ghost v] effect to (100)\n\n@hero_glow\n\nwhen flag clicked\nforever\n    go to x: (hero_location_reference_x) y: (hero_location_reference_y)\n    set size to ((10) + (player_magic)) %\n    set [brightness v] effect to ((player_health) * (5))\n    \nend\n\n@multiplayer 1.0\n\nwhen flag clicked\nforever\n    set [multiplayer_hero_location_x v] to (round ((hero_location_reference_x) + (1000)))\n    repeat until <(length of (multiplayer_hero_location_X)) = [5]>\n        set [multiplayer_hero_location_x v] to (join [0] (multiplayer_hero_location_X))\n    end\n    set [multiplayer_hero_location_y v] to (round ((hero_location_reference_y) + (1000)))\n    repeat until <(length of (multiplayer_hero_location_Y)) = [5]>\n        set [multiplayer_hero_location_y v] to (join [0] (multiplayer_hero_location_Y))\n    end\n    set [multiplayer_hero_room_x v] to ((world_map_ground_X) + (1000))\n    repeat until <(length of (multiplayer_hero_room_X)) = [5]>\n        set [multiplayer_hero_room_x v] to (join [0] (multiplayer_hero_room_X))\n    end\n    set [multiplayer_hero_room_y v] to ((world_map_ground_Y) + (1000))\n    repeat until <(length of (multiplayer_hero_room_Y)) = [5]>\n        set [multiplayer_hero_room_y v] to (join [0] (multiplayer_hero_room_Y))\n    end\n    set [multiplayer_hero_facing v] to (hero_player_dirrection)\n    if <(player_ID) = [1]> then\n        set [☁ player_1 v] to (join (multiplayer_hero_room_X) (join (multiplayer_hero_room_Y) (join (multiplayer_hero_location_X) (join (multiplayer_hero_location_Y) (multiplayer_hero_facing)))))\n    end\n    if <(player_ID) = [2]> then\n        set [☁ player_2 v] to (join (multiplayer_hero_room_X) (join (multiplayer_hero_room_Y) (join (multiplayer_hero_location_X) (join (multiplayer_hero_location_Y) (multiplayer_hero_facing)))))\n    end\nend\n\nwhen flag clicked\nset [☁ players_active v] to (join (players_active_letter_1) (join (players_active_letter_2) (join (players_active_letter_3) (players_active_letter_4))))\nset [player_id v] to (pick random (1) to (4))\n\nwhen flag clicked\nwait (0.2) seconds\ncreate clone of (_myself_ v)\nset [clone_id v] to [1]\nwait (0.2) seconds\ncreate clone of (_myself_ v)\nset [clone_id v] to [2]\nwait (0.2) seconds\ncreate clone of (_myself_ v)\nset [clone_id v] to [3]\nwait (0.2) seconds\ncreate clone of (_myself_ v)\nset [clone_id v] to [4]\nset [ghost v] effect to (100)\n\nwhen I start as a clone\nset rotation style [left-right v]\nforever\n    if <(clone_ID) = [1]> then\n        set [clone_personal_location_value v] to (☁ player_1)\n    else\n        if <(clone_ID) = [2]> then\n            set [clone_personal_location_value v] to (☁ player_2)\n        else\n            if <(clone_ID) = [3]> then\n                set [clone_personal_location_value v] to (☁ player_3)\n            else\n                if <(clone_ID) = [4]> then\n                    set [clone_personal_location_value v] to (☁ player_4)\n                end\n            end\n        end\n    end\n    if <<not <(clone_ID) = (player_ID)>> and <<((multiplayer_hero_room_X) - (1000)) = ((join (letter (1) of (clone_personal_location_value)) (join (letter (2) of (clone_personal_location_value)) (join (letter (3) of (clone_personal_location_value)) (join (letter (4) of (clone_personal_location_value)) (letter (5) of (clone_personal_location_value)))))) - (1000))> and <((multiplayer_hero_room_Y) - (1000)) = ((join (letter (6) of (clone_personal_location_value)) (join (letter (7) of (clone_personal_location_value)) (join (letter (8) of (clone_personal_location_value)) (join (letter (9) of (clone_personal_location_value)) (letter (10) of (clone_personal_location_value)))))) - (1000))>>> then\n        set x to ((join (letter (11) of (clone_personal_location_value)) (join (letter (12) of (clone_personal_location_value)) (join (letter (13) of (clone_personal_location_value)) (join (letter (14) of (clone_personal_location_value)) (letter (15) of (clone_personal_location_value)))))) - (1000))\n        set y to ((join (letter (16) of (clone_personal_location_value)) (join (letter (17) of (clone_personal_location_value)) (join (letter (18) of (clone_personal_location_value)) (join (letter (19) of (clone_personal_location_value)) (letter (20) of (clone_personal_location_value)))))) - (1000))\n        set [ghost v] effect to (0)\n        if <(letter (21) of (clone_personal_location_value)) = [1]> then\n            point in direction (90)\n        else\n            point in direction (-90)\n        end\n    else\n        go to x: (-1000) y: (-1000)\n        set [ghost v] effect to (100)\n    end\nend\n\nif <(letter (1) of (☁ players_active)) = [0]> then\n    set [players_active_letter_1 v] to [1]\n    set [player_id v] to [1]\nelse\n    if <(letter (2) of (☁ players_active)) = [0]> then\n        set [players_active_letter_2 v] to [1]\n        set [player_id v] to [2]\n    else\n        if <(letter (3) of (☁ players_active)) = [0]> then\n            set [players_active_letter_3 v] to [1]\n            set [player_id v] to [3]\n        else\n            if <(letter (4) of (☁ players_active)) = [0]> then\n                set [players_active_letter_4 v] to [1]\n                set [player_id v] to [4]\n            end\n        end\n    end\nend\nset [☁ players_active v] to (join (players_active_letter_1) (join (players_active_letter_2) (join (players_active_letter_3) (players_active_letter_4))))\n\nwhen flag clicked\nreset timer\nforever\n    set [stop_sense_timer v] to ((timer) + (0.01))\nend\n\nset [players_active_letter_1 v] to [0]\nset [players_active_letter_2 v] to [0]\nset [players_active_letter_3 v] to [0]\nset [players_active_letter_4 v] to [0]\n\nwhen [timer v] > (stop_sense_timer)\nif <(player_ID) = [1]> then\n    set [players_active_letter_1 v] to [0]\nelse\n    if <(player_ID) = [2]> then\n        set [players_active_letter_2 v] to [0]\n    else\n        if <(player_ID) = [3]> then\n            set [players_active_letter_3 v] to [0]\n        else\n            if <(player_ID) = [4]> then\n                set [players_active_letter_4 v] to [0]\n            end\n        end\n    end\nend\nset [player_id v] to [0]\nset [☁ players_active v] to (join (players_active_letter_1) (join (players_active_letter_2) (join (players_active_letter_3) (players_active_letter_4))))\n\n@switch_sword_button\n\nwhen I receive [close_map v]\nset [ghost v] effect to (100)\n\nwhen I receive [open_map v]\nset [ghost v] effect to (0)\n\nwhen flag clicked\nif <(editing_game) = [1]> then\n    set [obtained_steel_sword v] to [1]\nend\nswitch costume to (iron_sword v)\nforever\n    change [click_cooldown v] by (1)\n    if <touching (mouse-pointer v)?> then\n        if <<mouse down?> and <<(click_cooldown) > [2]> and <(map_open) = [1]>>> then\n            set [click_cooldown v] to [0]\n            set [rand_3 v] to (pick random (1) to (2))\n            if <(rand_3) = [1]> then\n                switch costume to (iron_sword v)\n                set [sword_name v] to [iron_sword]\n            end\n            if <<(rand_3) = [2]> and <(obtained_steel_sword) = [1]>> then\n                switch costume to (steel_sword v)\n                set [sword_name v] to [steel_sword]\n            end\n        end\n    end\nend\n\n@switch_charm_button\n\nwhen I receive [close_map v]\nset [ghost v] effect to (100)\n\nwhen I receive [open_map v]\nset [ghost v] effect to (0)\n\nwhen flag clicked\nif <(editing_game) = [1]> then\n    set [obtain_slime_charm v] to [1]\nend\nswitch costume to (none v)\nforever\n    change [click_cooldown v] by (1)\n    if <touching (mouse-pointer v)?> then\n        if <<mouse down?> and <<(click_cooldown) > [2]> and <(map_open) = [1]>>> then\n            set [click_cooldown v] to [0]\n            set [rand_3 v] to (pick random (1) to (2))\n            if <(rand_3) = [1]> then\n                switch costume to (none v)\n                set [charm_name v] to [none]\n            end\n            if <<(rand_3) = [2]> and <(obtain_slime_charm) = [1]>> then\n                switch costume to (slime_charm v)\n                set [charm_name v] to [slime_charm]\n            end\n        end\n    end\nend\n\nwhen flag clicked\nif <(charm_name) = [slime_charm]> then\n    set [hero_attack_speed v] to [4]\nelse\n    set [hero_attack_speed v] to [6]\nend\n\n