Forest of Monstropia | Part 1 | RPG platformer
@Stage\n\n@background\n\nwhen I start as a clone\nforever\n    go to [back v] layer\n    go [forward v] (layer_id) layers\n    if <<(current level) > [9]> and <(current level) < [18]>> then\n        switch costume to (cave v)\n        set [brightness v] effect to (-20)\n        set y to (0)\n        set size to (100) %\n    else\n        clear graphic effects\n        switch costume to (blank v)\n        set size to (140) %\n        if <<(current level) = [18]> and <(layer_id) = [8]>> then\n            set x to (0)\n            switch costume to (to be continued v)\n        else\n            switch costume to (join [layer_] ([ceiling v] of ((layer_id) / (2)) ))\n        end\n    end\n    if <(story) = []> then\n        hide\n    else\n        show\n    end\nend\n\ndefine setup\nset [background x v] to [0]\nset [layer_id v] to [0]\nswitch costume to (blank v)\nset size to (140) %\ngo to x: (0) y: (0)\nswitch costume to (layer_0 v)\ncreate clone of (_myself_ v)\nrepeat (4)\n    set [x v] to [0]\n    change [layer_id v] by (1)\n    create clone of (_myself_ v)\n    set [x v] to ((476) * ((size) / (100)))\n    change [layer_id v] by (1)\n    create clone of (_myself_ v)\nend\n\nwhen I receive [set platforms v]\nset [screen size v] to ((476) * ((size) / (100)))\nif <(layer_id) > [0]> then\n    set [screen x v] to ((x) - (((Background X) / (4)) * ([ceiling v] of ((layer_id) / (2)) )))\n    set x to (round (((screen x) mod ((screen size) * (2))) - (screen size)))\n    set y to (0)\n    if <(current level) = [18]> then\n        clear graphic effects\n        set size to (140) %\n    end\nend\n\nwhen I receive [start v]\nsetup\nswitch costume to (blank v)\nhide\n\nwhen I receive [create v]\nsetup\nswitch costume to (blank v)\n\n@Player\n\nwhen flag clicked\nset [mode v] to []\nhide\nwait (0.2) seconds\nif <[] = (mode)> then\n    set [mode v] to [Start]\n    wait (0) seconds\n    wait until <(story) = [done]>\nelse\n    ask [] and wait\nend\nbroadcast (mode) and wait\n\ndefine Detect floor or ceiling <ceiling?>\nchange [distance from ground v] by (1)\nrepeat until <not <touching (solid platforms v)?>>\n    if <ceiling?> then\n        change y by (-1)\n    else\n        change y by (1)\n        set [distance from ground v] to [0]\n    end\n    set [y velocity v] to [0]\nend\nif <touching (liquid platforms v)?> then\n    change [y velocity v] by (2)\n    change y by (round ((y velocity) / (10)))\nend\n\ndefine Walk (dir) (speed)\nset rotation style [left-right v]\nif <not <(dir) = [0]>> then\n    point in direction (dir)\nend\nchange x by (speed)\nset [slope? v] to [0]\nrepeat until <<(slope?) = [10]> or <not <touching (solid platforms v)?>>>\n    change y by (1)\n    change [slope? v] by (1)\nend\nif <(slope?) = [10]> then\n    change x by (() - (speed))\n    change y by (() - (slope?))\nend\nset [speed x v] to ((speed x) * ((1) - ((slope?) / (10))))\nif <touching (liquid platforms v)?> then\n    set [speed x v] to ((speed x) * (0.5))\nend\nchange [c_walk v] by (((player speed) / (1.5)) / ((cps) * (detect left or right key)))\nset [c_walk v] to ((c_walk) mod (4))\n\ndefine Jump on key <key>\nif <key> then\n    if <(distance from ground) < [4]> then\n        if <[player powers v] contains [High Jump]?> then\n            set [y velocity v] to [13]\n        else\n            set [y velocity v] to [15]\n            set [distance from ground v] to [6]\n        end\n    end\nend\nif <<(y velocity) < [2]> or <key>> then\n    change [y velocity v] by (-0.5)\nelse\n    change [y velocity v] by (-3)\nend\nchange [c_jump v] by ((1) / ((4) * <key>))\nset [c_jump v] to ((c_jump) mod (4))\n\nwhen I receive [set player v]\nPlayer Tick\n\ndefine Switch Costume\nif <<not <(p_atk) = [0]>> and <[player powers v] contains [Armor]?>> then\n    switch costume to (([floor v] of (((timer) - (p_atk)) * (8)) ) + (21))\n    if <(costume [number v]) = [24]> then\n        set [p_atk v] to [0]\n    end\nelse\n    if <(distance from ground) < [4]> then\n        switch costume to ([floor v] of ((3) + ((<[player powers v] contains [Armor]?> * (10)) + (c_walk))) )\n    else\n        switch costume to ([floor v] of ((7) + ((<[player powers v] contains [Armor]?> * (10)) + (c_jump))) )\n    end\nend\n\ndefine setup\npoint in direction (90)\ngo to x: (item (((current level) * (2)) - (1)) of [spawn position v]) y: (item ((current level) * (2)) of [spawn position v])\nset [skip? v] to [false]\nset [y velocity v] to [0]\nset [c_walk v] to [0]\nset [cps v] to [4]\nset [speed x v] to [0]\nset [talking? v] to [false]\nif <[player powers v] contains [armor]?> then\n    set [player health v] to [6]\nelse\n    set [player health v] to [3]\nend\nset size to (133) %\nif <(current level) > [4]> then\n    if <not <[player powers v] contains [High Jump]?>> then\n        add [High Jump] to [player powers v]\n    end\nend\nif <(current level) > [11]> then\n    if <not <[player powers v] contains [armor]?>> then\n        add [armor] to [player powers v]\n    end\nend\nif <[player powers v] contains [speed]?> then\n    set [player speed v] to [2.5]\nelse\n    set [player speed v] to [1.5]\n    if <(current level) > [15]> then\n        set [player speed v] to [2.5]\n        add [speed] to [player powers v]\n    end\nend\n\nwhen I receive [start v]\ndelete all of [player powers v]\nset [background x v] to [0]\nset [player health v] to [3]\nsetup\nshow\nset [mode v] to [Started]\nrepeat until <(length of [_levels data v]) < (current level)>\n    set [die_count v] to [0]\n    broadcast (Clear Text v)\n    broadcast (Delete All Clones v) and wait\n    broadcast (reset level list v) and wait\n    broadcast (reset v) and wait\n    broadcast (set platforms v)\n    if <(current level) = [17]> then\n        broadcast (boss health v)\n    end\n    repeat until <<touching (next level v)?> or <(skip?) = [true]>>\n        go to [front v] layer\n        broadcast (set player v)\n        if < (this level) contains [9_]?> then\n            broadcast (set Enemy v)\n        end\n        if <<(y position) < [-179]> or <key (r v) pressed?>> then\n            change [player health v] by (-1)\n        end\n        if <(player health) < [1]> then\n            repeat (3)\n                switch costume to (damaged1 v)\n                wait (0.1) seconds\n                switch costume to (damaged2 v)\n                wait (0.1) seconds\n            end\n            broadcast (Restart Player v)\n            wait until <(talking?) = [false]>\n        end\n    end\n    change [current level v] by (1)\n    change [background x v] by (240)\nend\nstop [all v]\n\nwhen flag clicked\ndelete all of [player powers v]\nrepeat until <(mode) = [Started]>\n    if <(<key (c v) pressed?> + <key (space v) pressed?>) = [2]> then\n        if <(timer) < [0.2]> then\n            broadcast (story done v)\n            set [mode v] to [Create]\n        end\n    end\nend\n\nwhen I receive [restart player v]\nset [p_atk v] to [0]\nchange [die_count v] by (1)\nsetup\n\ndefine Player Tick\nswitch costume to (hitbox v)\nchange [y velocity v] by (-1)\nchange y by (y velocity)\nDetect floor or ceiling <(y velocity) > [0]>\nset [speed x v] to ((speed x) * (0.7))\nif <<(x position) > [239]> or <[-239] > (x position)>> then\n    set [speed x v] to ((speed x) * (0))\nend\nset [detect left or right key v] to (<<key (right arrow v) pressed?> or <key (d v) pressed?>> - <<key (left arrow v) pressed?> or <key (a v) pressed?>>)\nchange [speed x v] by ((detect left or right key) * (player speed))\nWalk ((detect left or right key) * (90)) (<(p_atk) = [0]> * (speed x))\nJump on key <<key (up arrow v) pressed?> or <key (w v) pressed?>>\nSwitch Costume\nif <[player powers v] contains [armor]?> then\n    if <<key (space v) pressed?> and <(p_atk) = [0]>> then\n        set [p_atk v] to (timer)\n    end\nend\n\nwhen I receive [reset v]\nsetup\n\nwhen I receive [story done v]\nset [current level v] to [1]\n\n@solid platforms\n\nwhen I start as a clone\nforever\n    show\n    go to [front v] layer\n    go [backward v] (1) layers\n    set [ghost v] effect to (100)\n    if <touching (block hider v)?> then\n        hide\n    end\nend\n\nwhen I receive [reset v]\nsetup\n\ndefine setup\nset [id# v] to [0]\nset x to (-220)\nswitch costume to (block v)\nrepeat (12)\n    set y to (160)\n    repeat (9)\n        change [id# v] by (1)\n        if <not <<(item (id#) of [this level v]) = [0]> or <<(letter (1) of (item (id#) of [this level v])) = [6]> or <<(letter (1) of (item (id#) of [this level v])) = [5]> or <(letter (1) of (item (id#) of [this level v])) > [7]>>>>> then\n            create clone of (_myself_ v)\n        end\n        if <(item (id#) of [this level v]) = [9_3]> then\n            create clone of (_myself_ v)\n        end\n        change y by (-40)\n    end\n    change x by (40)\nend\n\nwhen I receive [delete all clones v]\ndelete this clone\n\n@platform graphics\n\ndefine add level_data to list\ndelete all of [this level v]\nset [i v] to [0]\nadd [] to [this level v]\nrepeat (length of (item (current level) of [_levels data v]))\n    if <(letter (i) of (item (current level) of [_levels data v])) = [,]> then\n        add [] to [this level v]\n        change [i v] by (1)\n    end\n    replace item (length of [this level v]) of [this level v] with (join (item (length of [this level v]) of [this level v]) (letter (i) of (item (current level) of [_levels data v])))\n    change [i v] by (1)\nend\n\ndefine detect key pressed from list (i) (max)\nif <key ((item (i) of [key to costume v]) v) pressed?> then\n    set [costume set v] to (i)\n    if <(i) = (costume set)> then\n        change [costume# v] by (1)\n    else\n        set [costume# v] to [1]\n    end\n    if <(costume set) = [11]> then\n        set [costume# v] to ((costume#) mod (13))\n    else\n        set [costume# v] to ((costume#) mod (5))\n    end\n    stop [this script v]\nend\nif <key (space v) pressed?> then\n    set [costume# v] to [0]\n    stop [this script v]\nend\nif <(max) > (i)> then\n    detect key pressed from list ((i) + (1)) (max)\nend\n\nwhen I start as a clone\nshow\nclear graphic effects\nforever\n    show\n    if <<<(item (id#) of [this level v]) = [0]> or <(item (id#) of [this level v]) = [11_12]>> or <<(id#) = [0]> or <<(letter (1) of (item (id#) of [this level v])) > [7]> and <(mode) = [Started]>>>> then\n        switch costume to (1_1 v)\n        set [ghost v] effect to (100)\n        if <(letter (1) of (item (id#) of [this level v])) = [8]> then\n            if <touching (player v)?> then\n                say [Press 'E' to Take the Special Power]\n                if <key (e v) pressed?> then\n                    add (item (letter (length of (item (id#) of [this level v])) of (item (id#) of [this level v])) of [powers v]) to [player powers v]\n                    if <[player powers v] contains [Armor]?> then\n                        set [player health v] to [6]\n                    end\n                    if <[player powers v] contains [Speed]?> then\n                        set [player speed v] to [2.5]\n                    end\n                    replace item (id#) of [this level v] with [0]\n                    say []\n                end\n            else\n                say []\n            end\n        end\n    else\n        if <touching (block hider v)?> then\n            set [ghost v] effect to (100)\n        else\n            set [ghost v] effect to (0)\n            switch costume to (item (id#) of [this level v])\n            if <(item (id#) of [this level v]) = [5_1]> then\n                switch costume to (join [_] (join [water] ([ceiling v] of (((timer) * (4)) mod (4)) )))\n            end\n            if <(item (id#) of [this level v]) = [5_3]> then\n                switch costume to (join [_] (join [lava] ([ceiling v] of ((([cos v] of ((timer) * (90)) ) * (2)) + (2)) )))\n            end\n        end\n    end\n    if <<<touching (builder_cursor v)?> and <mouse down?>> and <(mode) = [Create]>> then\n        if <(costume#) = [0]> then\n            replace item (id#) of [this level v] with [0]\n        else\n            replace item (id#) of [this level v] with (join (costume set) (join [_] (costume#)))\n        end\n    end\nend\n\ndefine setup\nset [id# v] to [0]\nswitch costume to (1_1 v)\nset x to (-220)\nrepeat (12)\n    set y to (160)\n    repeat (9)\n        change [id# v] by (1)\n        create clone of (_myself_ v)\n        change y by (-40)\n    end\n    change x by (40)\nend\n\nwhen I receive [reset v]\nsetup\nhide\n\nwhen I receive [create v]\nshow\nsetup\nforever\n    go to (builder_cursor v)\nend\n\nwhen I receive [reset level list v]\nadd level_data to list\n\nwhen I receive [delete all clones v]\ndelete this clone\n\nwhen I receive [create v]\nforever\n    if <<(costume#) = [0]> or <(id#) = [0]>> then\n        set [ghost v] effect to (100)\n    else\n        switch costume to (join (costume set) (join [_] (costume#)))\n        set [ghost v] effect to (0)\n    end\n    set size to (100) %\n    detect key pressed from list [1] [17]\n    wait until <not <key ((item (costume set) of [key to costume v]) v) pressed?>>\nend\n\nwhen flag clicked\nhide\n\n@bg_music\n\nwhen I receive [start v]\nset [music v] to [on]\nset volume to (100) %\nforever\n    if <key (m v) pressed?> then\n        if <(music) = [on]> then\n            repeat (10)\n                change volume by (-10)\n            end\n            set [music v] to [off]\n        else\n            repeat (10)\n                change volume by (10)\n            end\n            set [music v] to [on]\n        end\n        wait until <not <key (m v) pressed?>>\n    end\n    if <(current level) = [17]> then\n        stop [other scripts in sprite v]\n        stop all sounds\n        set volume to (0) %\n        wait (1) seconds\n        start sound [boss fight v]\n        repeat (100)\n            change volume by (1)\n        end\n        wait until <(boss health) = [null]>\n        change volume by (-1)\n    end\n    if <(current level) = [18]> then\n        broadcast (bg music v)\n    end\nend\n\nwhen I receive [start v]\nbroadcast (bg music v)\n\nwhen flag clicked\nset volume to (100) %\nforever\n    play sound [Main - Third Area v] until done\n    if <(story) = [done]> then\n        stop all sounds\n        stop [this script v]\n    end\nend\n\nwhen I receive [bg music v]\nstop all sounds\nforever\n    play sound [SMG2 - Battle Belt Galaxy v] until done\nend\n\n@liquid platforms\n\nwhen I start as a clone\nforever\n    show\n    go to [front v] layer\n    go [backward v] (1) layers\n    set [ghost v] effect to (100)\nend\n\nwhen I receive [reset v]\nsetup\n\ndefine setup\nset [id# v] to [0]\nset x to (-220)\nswitch costume to (block v)\nrepeat (12)\n    set y to (160)\n    repeat (9)\n        change [id# v] by (1)\n        if <<(letter (1) of (item (id#) of [this level v])) = [5]> and <(letter (3) of (item (id#) of [this level v])) < [3]>> then\n            create clone of (_myself_ v)\n        end\n        change y by (-40)\n    end\n    change x by (40)\nend\n\nwhen I receive [delete all clones v]\ndelete this clone\n\n@thumbnail\n\ncreate thumbnail\n\nwhen flag clicked\nhide\n\ndefine create thumbnail\npoint in direction (90)\ngo to x: (0) y: (0)\nclear graphic effects\nswitch costume to (thumbnail v)\ngo to [front v] layer\nset size to (100) %\nshow\n\n@Builder_cursor\n\nwhen flag clicked\nhide\n\nwhen I receive [create v]\nsetup\nforever\n    show\n    go to [front v] layer\n    go to (mouse-pointer v)\n    go to x: ((([floor v] of ((x position) / (40)) ) * (40)) + (20)) y: ((round ((y position) / (40))) * (40))\n    set [x v] to (x position)\n    set [y v] to (y position)\n    if <(y) > [160]> then\n        set [y v] to [160]\n    end\n    if <(x) > [220]> then\n        set [x v] to [220]\n    end\n    go to x: (x) y: (y)\n    if <key (q v) pressed?> then\n        if <not <[_levels data v] contains (this level)?>> then\n            set [level_data v] to []\n            add level_data to variable | loop start [1]\n            if <not <[_levels data v] contains (level_data)?>> then\n                add (level_data) to [_levels data v]\n            end\n        end\n        wait until <not <key (q v) pressed?>>\n    end\nend\n\ndefine setup\nif <(answer) < [1]> then\n    delete all of [this level v]\n    set [level width v] to [12]\n    set [level height v] to [9]\n    repeat ((level width) * (level height))\n        add [0] to [this level v]\n    end\nelse\n    add level_data to list (answer)\nend\n\ndefine add level_data to variable | loop start (i)\nif <(i) > [108]> then\n    stop [this script v]\nend\nset [level_data v] to (join (level_data) (join (item (i) of [this level v]) [,]))\nadd level_data to variable | loop start ((i) + (1))\n\ndefine add level_data to list (level #)\ndelete all of [this level v]\nset [i v] to [0]\nadd [] to [this level v]\nrepeat (length of (item (level #) of [_levels data v]))\n    if <(letter (i) of (item (level #) of [_levels data v])) = [,]> then\n        add [] to [this level v]\n        change [i v] by (1)\n    end\n    replace item (length of [this level v]) of [this level v] with (join (item (length of [this level v]) of [this level v]) (letter (i) of (item (level #) of [_levels data v])))\n    change [i v] by (1)\nend\n\nwhen I receive [create v]\nif <not <(answer) < [1]>> then\n    forever\n        if <key (w v) pressed?> then\n            set [level_data v] to []\n            add level_data to variable | loop start [1]\n            replace item (answer) of [_levels data v] with (level_data)\n            wait until <not <key (w v) pressed?>>\n        end\n    end\nend\n\nif <not <[_levels data v] contains (level_data)?>> then\n    add (level_data) to [_levels data v]\nend\n\n@Dangers//danger\n\nwhen flag clicked\nhide\n\nwhen I start as a clone\nif <<(letter (1) of (item (id#) of [this level v])) = [6]> or <(item (id#) of [this level v]) = [5_3]>> then\n    forever\n        show\n        switch costume to (item (id#) of [this level v])\n        set [ghost v] effect to (100)\n        if <<touching (player v)?> and <(player health) > [0]>> then\n            change [player health v] by (-0.15)\n        end\n    end\nend\n\nwhen I receive [delete all clones v]\ndelete this clone\n\nwhen I receive [rock-rain v]\nif  then\n    delete this clone\nend\nshow\nclear graphic effects\nrepeat (4)\n    set size to (150) %\n    go to x: (0) y: (360)\n    set size to (100) %\n    repeat until <(y position) < [-360]>\n        go to [back v] layer\n        go [forward v] (8) layers\n        set size to (150) %\n        if <<(y position) > [0]> and <[11] > (y position)>> then\n            set [id# v] to [rock]\n            switch costume to (pick random (7) to (8))\n            create clone of (_myself_ v)\n        end\n        change y by (-5)\n        set size to (100) %\n    end\nend\n\ngo to [front v] layer\n\nwhen I start as a clone\nif < (costume [name v]) contains [rock_rain]?> then\n    set size to (150) %\n    go to x: (0) y: (360)\n    set size to (100) %\n    repeat until <(y position) < [-360]>\n        go to [front v] layer\n        set size to (150) %\n        change y by (-5)\n        set size to (100) %\n        if <<touching (player v)?> and <(player health) > [0]>> then\n            change [player health v] by (-0.25)\n        end\n    end\n    delete this clone\nend\n\ndefine setup\nset [id# v] to [1]\nset x to (-220)\nrepeat (12)\n    set y to (160)\n    repeat (9)\n        if <<(letter (1) of (item (id#) of [this level v])) = [6]> or <(item (id#) of [this level v]) = [5_3]>> then\n            set [spawn x v] to ((x position) - (8))\n            set [spawn y v] to (y position)\n            create clone of (_myself_ v)\n        end\n        change y by (-40)\n        change [id# v] by (1)\n    end\n    change x by (40)\nend\n\nwhen I receive [reset v]\nhide\nsetup\n\n@Dangers//enemy spider\n\ndefine point towards x: (x) y: (y)\nset [direction v] to (([atan v] of (((x) - (x position)) / ((y) - (y position))) ) + ((180) * <(y) < (y position)>))\n\nwhen I start as a clone\nshow\nset size to (55) %\nset [health v] to [20]\n\ndefine move to (sprite name)\nif <not <touching ((sprite name) v)?>> then\n    point towards x: ([x position v] of (sprite name)) y: ([y position v] of (sprite name))\n    change x by (([sin v] of (direction) ) * (5))\n    change y by (([cos v] of (direction) ) * (5))\nend\n\ndefine setup\nset [id# v] to [1]\nset x to (-220)\nrepeat (12)\n    set y to (160)\n    repeat (9)\n        if <(letter (1) of (item (id#) of [this level v])) = [9]> then\n            if <(letter (3) of (item (id#) of [this level v])) = [2]> then\n                set [spawn x v] to ((x position) - (8))\n                set [spawn y v] to (y position)\n                create clone of (_myself_ v)\n            end\n        end\n        change y by (-40)\n        change [id# v] by (1)\n    end\n    change x by (40)\nend\n\ndefine Detect floor or ceiling <ceiling?>\nchange [distance from ground v] by (1)\nrepeat until <not <touching (solid platforms v)?>>\n    if <ceiling?> then\n        change y by (-1)\n    else\n        change y by (1)\n        set [distance from ground v] to [0]\n    end\n    set [y velocity v] to [0]\nend\nif <touching (liquid platforms v)?> then\n    change [y velocity v] by (2)\n    change y by (round ((y velocity) / (10)))\nend\n\nwhen I receive [delete all clones v]\nset [clone# v] to [0]\ndelete this clone\n\ndefine enemy tick\ngo to [front v] layer\ngo [backward v] (2) layers\nswitch costume to (hitbox v)\nchange [y velocity v] by (-1)\nchange y by (y velocity)\nDetect floor or ceiling <(y velocity) > [0]>\nset [speed x v] to ((speed x) * (0.7))\nchange [speed x v] by ((move left or right?) * (2))\nset [move left or right? v] to (<([x position v] of [player v]) > ((x position) - (28))> + (<((x position) + (28)) > ([x position v] of [player v])> * (-1)))\nWalk ((move left or right?) * (90)) (speed x)\nif <<(slope?) = [10]> or <<([y position v] of [player v]) > (x position)> or <touching ((join [] [Dangers//enemy spider]) v)?>>> then\n    if <(distance from ground) < [4]> then\n        set [y velocity v] to [5]\n        set [distance from ground v] to [6]\n    end\nend\nif <touching (player v)?> then\n    if <not <(mood) = [attack]>> then\n        set [time_stop v] to (timer)\n    end\n    set [mood v] to [attack]\nend\nswitch costume\n\nwhen I receive [set enemy v]\nif <<not <(clone#) = [0]>> and <not <(health) = [null]>>> then\n    if <(health) < [1]> then\n        set [health v] to [null]\n        hide\n        play sound [spiderdeath v] until done\n    else\n        show\n        enemy tick\n    end\n    if <<touching color (#d30003)?> or <(y position) < [-178]>> then\n        change [health v] by (-9)\n        switch costume to (spider damage1 v)\n        wait (0.2) seconds\n        switch costume to (spider damage2 v)\n    end\n    if <<touching (player v)?> and <([costume # v] of [player v]) = [23]>> then\n        change [health v] by (-2)\n        set [mood v] to [ idle]\n        switch costume to (spider damage1 v)\n        play sound (pick random (1) to (4)) until done\n        wait (0.2) seconds\n        switch costume to (spider damage2 v)\n    end\nend\n\nwhen I receive [reset v]\nhide\nsetup\n\ndefine Walk (dir) (speed)\nset rotation style [left-right v]\nif <not <(dir) = [0]>> then\n    point in direction (() - (dir))\nend\nchange x by (speed)\nset [slope? v] to [0]\nrepeat until <<(slope?) = [10]> or <not <touching (solid platforms v)?>>>\n    change y by (1)\n    change [slope? v] by (1)\nend\nif <(slope?) = [10]> then\n    change x by (() - (speed))\n    change y by (() - (slope?))\nend\n\ndefine switch costume\nif <<([abs v] of (round (speed x)) ) > [0]> and <not <(slope?) = [10]>>> then\n    switch costume to (join [spider walk] ((round (((timer) / (0.1)) mod (3))) + (1)))\nelse\n    if <(mood) = [attack]> then\n        switch costume to (join [spider attack] ((round ((((timer) - (time_stop)) / (0.12)) mod (3))) + (1)))\n    end\n    if <(costume [name v]) = [spider attack2]> then\n        if <touching (player v)?> then\n            change [player health v] by (-0.20)\n        end\n        play sound (pick random (1) to (4)) until done\n    end\n    if <(costume [name v]) = [spider attack4]> then\n        set [mood v] to [ idle]\n    end\n    if <(mood) = [ idle]> then\n        switch costume to (join [spider idle] ((round (((timer) / (0.15)) mod (3))) + (1)))\n    end\nend\n\nwhen I start as a clone\ngo to x: (spawn x) y: (spawn y)\nchange [clone# v] by (1)\n\nwhen I receive [restart player v]\nif <not <(id#) = [109]>> then\n    set [health v] to [20]\n    go to x: (spawn x) y: (spawn y)\n    clear graphic effects\n    show\nend\n\nif <<(move left or right?) = [0]> and <touching (solid platforms v)?>> then\n    set x to (spawn x)\n    set y to (spawn y)\nend\n\nwhen I receive [spider rain v]\nif  then\n    delete this clone\nend\ngo to x: (0) y: (0)\nset [clone# v] to [1]\nrepeat (round ((pick random (0.3) to (3.25)) * (2)))\n    set [spawn x v] to (pick random (-240) to (240))\n    set [spawn y v] to [0]\n    create clone of (_myself_ v)\n    wait (pick random (0.8) to (2)) seconds\nend\nset [clone# v] to [0]\ngo to x: (0) y: (0)\n\nwhen I start as a clone\ngo to x: (spawn x) y: (spawn y)\nforever\n    if <touching (solid platforms v)?> then\n        wait (0.15) seconds\n        if <touching (solid platforms v)?> then\n            delete this clone\n        end\n    end\nend\n\n@Dangers//enemy bull\n\ndefine point towards x: (x) y: (y)\nset [direction v] to (([atan v] of (((x) - (x position)) / ((y) - (y position))) ) + ((180) * <(y) < (y position)>))\n\nwhen I start as a clone\nshow\nset size to (120) %\nset [health v] to [10]\n\ndefine move to (sprite name)\nif <not <touching ((sprite name) v)?>> then\n    point towards x: ([x position v] of (sprite name)) y: ([y position v] of (sprite name))\n    change x by (([sin v] of (direction) ) * (5))\n    change y by (([cos v] of (direction) ) * (5))\nend\n\ndefine setup\nset [id# v] to [1]\nset x to (-220)\nrepeat (12)\n    set y to (160)\n    repeat (9)\n        if <(letter (1) of (item (id#) of [this level v])) = [9]> then\n            if <(letter (3) of (item (id#) of [this level v])) = [1]> then\n                set [spawn x v] to ((x position) - (8))\n                set [spawn y v] to (y position)\n                create clone of (_myself_ v)\n            end\n        end\n        change y by (-40)\n        change [id# v] by (1)\n    end\n    change x by (40)\nend\n\ndefine Detect floor or ceiling <ceiling?>\nchange [distance from ground v] by (1)\nrepeat until <not <touching (solid platforms v)?>>\n    if <ceiling?> then\n        change y by (-1)\n    else\n        change y by (1)\n        set [distance from ground v] to [0]\n    end\n    set [y velocity v] to [0]\nend\nif <touching (liquid platforms v)?> then\n    change [y velocity v] by (2)\n    change y by (round ((y velocity) / (10)))\nend\n\nwhen I receive [delete all clones v]\nset [clone# v] to [0]\ndelete this clone\n\ndefine enemy tick\ngo to [front v] layer\ngo [backward v] (2) layers\nswitch costume to (hitbox v)\nchange [y velocity v] by (-1)\nchange y by (y velocity)\nDetect floor or ceiling <(y velocity) > [0]>\nset [speed x v] to ((speed x) * (0.7))\nchange [speed x v] by ((move left or right?) * (1.4))\nset [move left or right? v] to (<([x position v] of [player v]) > ((x position) - (28))> + (<((x position) + (28)) > ([x position v] of [player v])> * (-1)))\nWalk ((move left or right?) * (90)) (speed x)\nif <<(slope?) = [10]> or <<([y position v] of [player v]) > (x position)> or <touching ((join [] [Dangers//enemy bull]) v)?>>> then\n    if <(distance from ground) < [4]> then\n        set [y velocity v] to [5]\n        set [distance from ground v] to [6]\n    end\nend\nif <touching (player v)?> then\n    if <not <(mood) = [attack]>> then\n        set [time_stop v] to (timer)\n    end\n    set [mood v] to [attack]\nend\nswitch costume\n\nwhen I receive [set enemy v]\nif <not <(clone#) = [0]>> then\n    if <(health) < [1]> then\n        hide\n    else\n        show\n        enemy tick\n    end\n    if <<touching color (#d30003)?> or <(y position) < [-178]>> then\n        change [health v] by (-9)\n        set [brightness v] effect to (50)\n        wait (0.2) seconds\n        set [brightness v] effect to (0)\n    end\n    if <<touching (player v)?> and <([costume # v] of [player v]) = [23]>> then\n        change [health v] by (-5)\n        set [mood v] to [ idle]\n        set [brightness v] effect to (50)\n        wait (0.2) seconds\n        set [brightness v] effect to (0)\n    end\nend\n\nwhen I receive [reset v]\nhide\nsetup\n\ndefine Walk (dir) (speed)\nset rotation style [left-right v]\nif <not <(dir) = [0]>> then\n    point in direction (dir)\nend\nchange x by (speed)\nset [slope? v] to [0]\nrepeat until <<(slope?) = [10]> or <not <touching (solid platforms v)?>>>\n    change y by (1)\n    change [slope? v] by (1)\nend\nif <(slope?) = [10]> then\n    change x by (() - (speed))\n    change y by (() - (slope?))\nend\n\ndefine switch costume\nif <<([abs v] of (round (speed x)) ) > [0]> and <not <(slope?) = [10]>>> then\n    switch costume to (join [enemy bull_run] ((round (((timer) / (0.1)) mod (7))) + (1)))\nelse\n    if <(mood) = [attack]> then\n        switch costume to (join [enemy bull_1atk] ((round ((((timer) - (time_stop)) / (0.12)) mod (5))) + (1)))\n    end\n    if <(costume [name v]) = [enemy bull_1atk2]> then\n        if <touching (player v)?> then\n            change [player health v] by (-0.5)\n        end\n        play sound [High Whoosh v] until done\n    end\n    if <(costume [name v]) = [enemy bull_1atk6]> then\n        set [mood v] to [ idle]\n    end\n    if <(mood) = [ idle]> then\n        switch costume to (join [enemy bull_ idle] ((round (((timer) / (0.15)) mod (4))) + (1)))\n    end\nend\n\nwhen I start as a clone\ngo to x: (spawn x) y: (spawn y)\nchange [clone# v] by (1)\n\nwhen I receive [restart player v]\nif <not <(id#) = [109]>> then\n    set [health v] to [10]\n    go to x: (spawn x) y: (spawn y)\n    clear graphic effects\n    show\nend\n\nset x to (-)\n\n\n\nif <<(move left or right?) = [0]> and <touching (solid platforms v)?>> then\n    set x to (spawn x)\n    set y to (spawn y)\nend\n\n@Boss\n\ndefine setup\nset [time_stop v] to [0]\nset [id# v] to [1]\nset [mood v] to [think]\nset x to (-220)\nrepeat (12)\n    set y to (160)\n    repeat (9)\n        if <(letter (1) of (item (id#) of [this level v])) = [9]> then\n            if <(letter (3) of (item (id#) of [this level v])) = [3]> then\n                set [spawn x v] to ((x position) - (10))\n                set [spawn y v] to (y position)\n                go to x: (spawn x) y: (spawn y)\n                show\n                set size to (160) %\n                set [max health v] to [1500]\n                set [boss health v] to (max health)\n                start sound [boss spawned v]\n                stop [this script v]\n            end\n        end\n        change y by (-40)\n        change [id# v] by (1)\n    end\n    change x by (40)\nend\n\ndefine enemy tick\ngo to [front v] layer\ngo [backward v] (2) layers\nif <(mood) = [think]> then\n    set [time_stop v] to ((timer) + (5))\n    set [mood v] to [idle]\nend\nif <(timer) > (time_stop)> then\n    if <(mood) = [idle]> then\n        set [mood v] to (join [A] (pick random (1) to (4)))\n        set [time_stop v] to ((timer) + (5))\n        if <(mood) = [A4]> then\n            broadcast (Rock-rain v)\n        end\n        if <(mood) = [A1]> then\n            broadcast (Spider rain v)\n        end\n    else\n        set [time_stop v] to ((timer) + (7))\n        set [mood v] to [idle]\n    end\nend\nif < (mood) contains [A]?> then\n    if <touching (player v)?> then\n        change [player health v] by (-0.1)\n    end\nend\nswitch costume\n\nwhen I receive [set enemy v]\nif <not <(boss health) = [null]>> then\n    if <(boss health) < [1]> then\n        set [boss health v] to [null]\n        broadcast (Boss died v)\n    else\n        if <(boss health) > (max health)> then\n            set [boss health v] to (max health)\n        end\n        show\n        enemy tick\n    end\n    if <(y position) < [-178]> then\n        change [boss health v] by (-10000)\n    end\n    if <<touching (player v)?> and <<([costume # v] of [player v]) = [23]> and <([x position v] of [player v]) > [120]>>> then\n        change [boss health v] by (-5)\n        switch costume to (boss_damage1 v)\n        play sound (pick random (1) to (3)) until done\n        wait (0.2) seconds\n        switch costume to (boss_damage2 v)\n    end\n    if <(player health) < [1]> then\n        change [boss health v] by (25)\n    end\nend\n\nwhen I receive [reset v]\nhide\nsetup\n\ndefine Walk (dir) (speed)\nset rotation style [left-right v]\nif <not <(dir) = [0]>> then\n    point in direction (() - (dir))\nend\nchange x by (speed)\nset [slope? v] to [0]\nrepeat until <<(slope?) = [10]> or <not <touching (solid platforms v)?>>>\n    change y by (1)\n    change [slope? v] by (1)\nend\nif <(slope?) = [10]> then\n    change x by (() - (speed))\n    change y by (() - (slope?))\nend\n\ndefine switch costume\nif < (mood) contains [A]?> then\n    if < (mood) contains [3]?> then\n        switch costume to (join [Boss-] (join (mood) (join [_] (round ((((timer) * (1.17)) mod (5)) + (1))))))\n    else\n        if < (mood) contains [4]?> then\n            switch costume to (join [Boss-] (join (mood) (join [_] ((round (((timer) / (0.2)) mod (5))) + (1)))))\n        else\n            switch costume to (join [Boss-] (join (mood) (join [_] ((round (((timer) / (0.2)) mod (3))) + (1)))))\n        end\n    end\nelse\n    switch costume to (join [Boss_idle] ((round (((timer) / (0.2)) mod (3))) + (1)))\nend\n\nwhen I receive [restart player v]\nif <not <(id#) = [109]>> then\n    go to x: (spawn x) y: (spawn y)\n    clear graphic effects\n    show\nend\n\nwhen flag clicked\nhide\n\nplay sound [boss spawned v] until done\n\nwhen I receive [boss died v]\nif <(current level) = [17]> then\n    show\n    switch costume to (boss_death1 v)\n    repeat (3)\n        wait (0.15) seconds\n        next costume\n    end\nend\n\nchange [boss health v] by (-1000)\n\n@next level\n\nwhen flag clicked\ngo to x: (0) y: (0)\nset [ghost v] effect to (100)\n\n@Extra Powers\n\nwhen I receive [reset v]\nsetup\n\nwhen I start as a clone\nshow\nset [color v] effect to (0)\nset [ghost v] effect to (0)\nif <(item (id#) of [this level v]) = [8_3]> then\n    switch costume to (speed v)\n    set size to (100) %\nelse\n    if <(item (id#) of [this level v]) = [8_2]> then\n        switch costume to (sword v)\n        set size to (100) %\n    else\n        switch costume to (magical power1 v)\n        forever\n            repeat (40)\n                wait (0.04) seconds\n                switch costume to (join [magical power] ((costume [number v]) + (1)))\n                set [color v] effect to (([cos v] of ((timer) / (50)) ) * (20))\n            end\n            repeat (40)\n                wait (0.04) seconds\n                switch costume to (join [magical power] ((costume [number v]) - (1)))\n                set [color v] effect to (([cos v] of ((timer) / (50)) ) * (20))\n            end\n        end\n    end\nend\n\ndefine setup\nset [id# v] to [0]\nset x to (-220)\nrepeat (12)\n    set y to (160)\n    repeat (9)\n        change [id# v] by (1)\n        if <(letter (1) of (item (id#) of [this level v])) = [8]> then\n            create clone of (_myself_ v)\n        end\n        change y by (-40)\n    end\n    change x by (40)\nend\n\nwhen I start as a clone\nforever\n    if <(item (id#) of [this level v]) = [0]> then\n        set size to (60) %\n        switch costume to (circle smoke1 v)\n        repeat (10)\n            change [ghost v] effect by (2.5)\n            next costume\n            wait (0.08) seconds\n        end\n        delete this clone\n    end\nend\n\n@skip\n\nwhen I receive [reset v]\nhide\nset [ghost v] effect to (100)\nset [pixelate v] effect to (200)\n\nwhen flag clicked\nhide\nset [current level v] to []\nswitch costume to (skip button v)\ngo to x: (202) y: (160)\nset [skip? v] to [false]\nforever\n    if <<<(die_count) > [4]> or <<(story) = []> and <(story seen?) = [1]>>> and <(current level) < [17]>> then\n        show\n        set size to (120) %\n        repeat (10)\n            change [ghost v] effect by (-10)\n            change [pixelate v] effect by (-20)\n        end\n        set [ghost v] effect to (0)\n        set [pixelate v] effect to (0)\n        repeat until <not <<(die_count) > [4]> or <(story) = []>>>\n            go to [front v] layer\n            if <touching (mouse-pointer v)?> then\n                change size by (((120) - (size)) / (2))\n                if <mouse down?> then\n                    set [skip? v] to [true]\n                    if <(story) = []> then\n                        broadcast (story done v)\n                    end\n                    wait until <not <mouse down?>>\n                end\n            else\n                change size by (((100) - (size)) / (2))\n            end\n        end\n    end\nend\n\n@Health-bar\n\nwhen flag clicked\nhide\n\nwhen I receive [start v]\nshow\ngo to x: (-205) y: (160)\nforever\n    if <not <(costume [name v]) = (player health)>> then\n        go to [front v] layer\n        switch costume to ([floor v] of (player health) )\n    end\nend\n\n@block hider\n\nwhen I receive [reset v]\ngo to x: (0) y: (0)\nset [ghost v] effect to (100)\nhide\nswitch costume to (1 v)\n\nwhen flag clicked\ngo to x: (0) y: (0)\nset size to (100) %\nhide\n\nwhen I receive [set player v]\nhide\nif <<(current level) = [11]> and <[player powers v] contains [armor]?>> then\n    show\n    if <not <(costume [number v]) > [3]>> then\n        next costume\n    end\nelse\n    if <<(current level) = [15]> and <[player powers v] contains [speed]?>> then\n        switch costume to (5 v)\n        show\n        wait until <not <<(current level) = [15]> and <[player powers v] contains [speed]?>>>\n    else\n        if <(current level) = [16]> then\n            if <<([x position v] of [player v]) > [30]> or <(costume [name v]) = [7]>> then\n                show\n                switch costume to (7 v)\n            else\n                if <<([x position v] of [player v]) > [-60]> or <(costume [name v]) = [6]>> then\n                    show\n                    switch costume to (6 v)\n                end\n            end\n        else\n            if <<(current level) = [17]> and <<(boss health) = [0]> or <(boss health) = [null]>>> then\n                show\n                switch costume to (8 v)\n            end\n        end\n    end\nend\n\nwhen I receive [restart player v]\ngo to x: (0) y: (0)\nset [ghost v] effect to (100)\nhide\nswitch costume to (1 v)\n\nwhen I receive [boss died v]\nstop [other scripts in sprite v]\nshow\n\n@Story\n\nwhen flag clicked\nset [story v] to []\nshow\nswitch costume to (1 v)\nrepeat (9)\n    set [ghost v] effect to (100)\n    go to x: (0) y: (0)\n    repeat (50)\n        change [ghost v] effect by (-2)\n    end\n    if <(costume [number v]) = [4]> then\n        switch costume to (3.1 v)\n        repeat (3)\n            wait (0.3) seconds\n            next costume\n        end\n        wait (0.3) seconds\n    end\n    create clone of (_myself_ v)\n    set [ghost v] effect to (100)\n    next costume\n    wait (0.3) seconds\nend\nwait until <key (any v) pressed?>\nbroadcast (story done v)\n\nset [story seen? v] to [0]\n\nwhen I start as a clone\nwait until <(story) = [done]>\ndelete this clone\n\nwhen flag clicked\nforever\n    broadcast (Clear Text v)\nend\n\nwhen I receive [story done v]\nset [skip? v] to [false]\nset [story v] to [done]\nset [story seen? v] to [1]\ngo to [front v] layer\nswitch costume to (blank v)\nset [ghost v] effect to (0)\nrepeat (15)\n    change [ghost v] effect by ((100) / (15))\nend\nhide\nstop [other scripts in sprite v]\ndelete this clone\n\ngo to x: (0) y: (0)\nswitch costume to (1 v)\nrepeat (2)\n    create clone of (_myself_ v)\n    next costume\nend\ncreate clone of (_myself_ v)\nswitch costume to (4 v)\nrepeat (5)\n    create clone of (_myself_ v)\n    next costume\nend\n\n@boss health bar\n\nwhen I start as a clone\nswitch costume to (base v)\nforever\n    show\n    switch costume to (big v)\n    position bar\n    switch costume to (base v)\n    if <<(boss health) < [1]> or <(boss health) = [null]>> then\n        set [boss health v] to [0]\n        play sound [boss died v] until done\n        stop all sounds\n        hide\n        stop [other scripts in sprite v]\n        delete this clone\n    end\nend\n\ndefine position bar\ngo to x: (135) y: (155)\nset [percent v] to ((boss health) / (max health))\nset [color v] effect to (((percent) * (30)) + (20))\n\nwhen I receive [boss health v]\nswitch costume to (full v)\nset size to (400) %\nshow\nclear graphic effects\ncreate clone of (_myself_ v)\nforever\n    show\n    go to [front v] layer\n    switch costume to (big v)\n    position bar\n    set [width v] to ((46) * ((size) / (100)))\n    change x by ((percent) * (width))\n    if <(percent) < [0.5]> then\n        switch costume to (empty v)\n    else\n        switch costume to (full v)\n    end\n    if <<(boss health) = [0]> or <(boss health) = [null]>> then\n        hide\n        stop [this script v]\n    end\nend\n\nwhen flag clicked\nhide\n\n@Time\n\nwhen flag clicked\nhide\n\ndefine Write time at (x) (y)\ngo to x: (x) y: (y)\nset size to (100) %\nset [letter# v] to [0]\nrepeat (6)\n    change [letter# v] by (1)\n    create clone of (_myself_ v)\n    change x by (16)\nend\n\nwhen I receive [start v]\nWrite time at [-222] [130]\nreset timer\n\nwhen I start as a clone\nshow\nforever\n    switch costume to (letter (letter#) of ((round ((timer) * (10))) / (10)))\n    if <(current level) = [18]> then\n        stop [this script v]\n    end\nend\n\n
The Whole Tile Engine is totally made by me!!! Without any other projects help...\nSorry, the controls are not made for mobile or tablet.\nControls: ---------------------------------------------------------\n» W,A,D / Arrow keys : Move and Jump\n» Space : Attack (When you get sword)\n» R : Restart\nSkip button will come if you died many times\n-----------------------------------------------------------------------\nJust like any normal generic platformer, you will die on touching spikes, or lava, but it has an amazing story.\n\nThere are 3 powers you will get from the forest-\ni] Jump Boost\nii] Helmet and Sword\niii] Speed boost\n\nComment your timing after finishing! \nMy best: 234.4 secs