Grass 3 | Platformer
@Stage\n\nwhen flag clicked\nswitch backdrop to (backdrop1 v)\n\nwhen stage clicked\nif <(backdrop [number v]) = [1]> then\n    switch backdrop to (backdrop2 v)\n    broadcast (start v)\n    forever\n        play sound [main theme v] until done\n    end\nend\n\n@assets\n\nwhen flag clicked\nhide\n\n@player\n\nwhen flag clicked\nhide\nset size to (150) %\nset [animation frame v] to [0]\nset [air time v] to [0]\nset [slope v] to [0]\nset rotation style [left-right v]\ngo to x: (0) y: (-130)\npoint in direction (0)\nset [max speed v] to [8]\nset [friction v] to [0.6]\nset [jump power v] to [10]\nset [xvel v] to [0]\nset [yvel v] to [0]\nset [level v] to [1]\nset [scroll x v] to [0]\nset [end scrolling? v] to [false]\nset [wall jumping? v] to [0]\n\ndefine None\npoint in direction ((-90) * (dir))\nif <(text?) < [1]> then\n    change [xvel v] by (dir)\n    if <(MAX SPEED) < ([abs v] of (xvel) )> then\n        change [xvel v] by ((0) - (dir))\n    end\nend\ndetect slope (xvel) <[0] = [1]>\nanimate costume <[0] = [0]>\n\ndefine animate costume <>\nif <walking?> then\n    set [animation frame v] to (((animation frame) + (0.4)) mod (16))\n    switch costume to ([floor v] of (((animation frame) mod (8)) + (2)) )\nelse\n    if <[15] < (air time)> then\n        switch costume to (jump2 v)\n    else\n        if <[0] < (air time)> then\n            switch costume to (jump1 v)\n        else\n            set [animation frame v] to [0]\n            switch costume to (idle v)\n        end\n    end\nend\n\nwhen I receive [hurtanimation v]\nstart sound [rattle v]\nreset\nrepeat (3)\n    set [ghost v] effect to (50)\n    wait (0.05) seconds\n    set [ghost v] effect to (0)\n    wait (0.05) seconds\nend\n\nif <(x position) > [240]> then\n    change [level v] by ((x position) / ([abs v] of (x position) ))\n    broadcast (start level v)\nend\n\ndefine reset\nhide\nset [xvel v] to [0]\nset [yvel v] to [0]\nset [text? v] to [1]\nrepeat until <(round (scroll x)) = [0]>\n    set [scroll x v] to ((scroll x) * (0.5))\nend\nset y to (-130)\nshow\nset [text? v] to [0]\n\nwhen I receive [start v]\nmain\n\ndefine main\nset [ghost v] effect to (0)\nshow\ngo to [front v] layer\nforever\n    switch costume to (hitbox v)\n    if <(yvel) > [-30]> then\n        change [yvel v] by (-1)\n    end\n    change y by (yvel)\n    gravity <(yvel) > [0]>\n    if <<key (right arrow v) pressed?> or <key (d v) pressed?>> then\n        player walk (-1)\n    else\n        if <<key (left arrow v) pressed?> or <key (a v) pressed?>> then\n            player walk (1)\n        else\n            detect slope (xvel) <[0] = [0]>\n            animate costume <[0] = [1]>\n        end\n    end\n    if <<key (up arrow v) pressed?> or <key (w v) pressed?>> then\n        if <(air time) < [3]> then\n            set [yvel v] to (JUMP POWER)\n            start sound [water drop v]\n        end\n    end\nend\n\nwhen I receive [edit mode v]\nif <(edit mode?) = [1]> then\n    stop [other scripts in sprite v]\n    hide\n    set [xvel v] to [0]\n    set [yvel v] to [0]\nelse\n    main\nend\n\nwhen [r v] key pressed\nreset\n\ndefine None\nset [slope v] to [0]\nif <sliding?> then\n    set [xvel v] to ((xspeed) * (FRICTION))\nend\nchange x by ((0) - (xvel))\nrepeat until <<not <touching (level hitbox v)?>> or <(slope) > [6]>>\n    change y by (1)\n    change [slope v] by (1)\nend\nif <(slope) > [6]> then\n    change y by ((0) - (slope))\n    change x by (xvel)\n    set [xvel v] to [0]\n    if <<<key (up arrow v) pressed?> or <key (w v) pressed?>> and <(wall jumping?) = [0]>> then\n        set [yvel v] to (JUMP POWER)\n        set [xvel v] to ((0) - (xspeed))\n        set [air time v] to [0]\n    end\nend\nset [end scrolling? v] to <<(scroll x) < [0]> or <(scroll x) > ((480) * ((item (level) of [level lengths v]) - (1)))>>\nif <(end scrolling?) = [true]> then\n    if <<<(x position) > [0]> and <(scroll x) < [0]>> or <<(x position) < [0]> and <(scroll x) > ((480) * ((item (level) of [level lengths v]) - (1)))>>> then\n        change [scroll x v] by ((0) - (xvel))\n        set x to (0)\n    end\nelse\n    change [scroll x v] by ((0) - (xvel))\n    set x to (0)\nend\n\ndefine gravity <>\nchange [air time v] by (1)\nrepeat until <not <touching (level hitbox v)?>>\n    if <midair> then\n        change y by (-1)\n    else\n        change y by (1)\n        set [air time v] to [0]\n    end\n    set [yvel v] to [0]\nend\n\n@level visual\n\nwhen flag clicked\nhide\ngo to x: (0) y: (0)\nset rotation style [don't rotate v]\ndelete (all) of [level lengths v]\nadd [10] to [level lengths v]\n\ndefine record level lengths\n\nswitch costume to (level1.1 v)\nset [level v] to [1]\nnext costume\nrepeat until <(costume [number v]) = [1]>\n    repeat until <not <(letter (6) of ([costume name v] of [level visual v])) = (level)>>\n        next costume\n    end\nend\n\nwhen I receive [start v]\nset [panel # v] to [0]\nrepeat (2)\n    change [panel # v] by (1)\n    switch costume to (join [level] (join (level) (join [.] (panel #))))\n    create clone of (_myself_ v)\nend\nset [panel # v] to [0]\n\nwhen I start as a clone\nshow\ngo to [front v] layer\ngo [backward v] (10) layers\nforever\n    set x to ((480) - (((scroll x) + (((panel #) mod (2)) * (480))) mod (960)))\n    if <<((scroll x) mod (480)) > [470]> or <[10] > ((scroll x) mod (480))>> then\n        switch costume to ((([ceiling v] of (((scroll x) + (((panel #) mod (2)) * (480))) / (960)) ) * (2)) - ((panel #) mod (2)))\n    end\nend\n\nwhen I receive [edit mode v]\nif <(panel #) > [0]> then\n    wait (0.01) seconds\n    switch costume to ((([ceiling v] of (((scroll x) + (((panel #) mod (2)) * (480))) / (960)) ) * (2)) - ((panel #) mod (2)))\nend\n\n@level hitbox\n\nwhen flag clicked\nhide\ngo to x: (0) y: (0)\nset rotation style [don't rotate v]\nset [ghost v] effect to (100)\n\nwhen I receive [start v]\nset [panel # v] to [0]\nrepeat (2)\n    change [panel # v] by (1)\n    switch costume to (join [level] (join (level) (join [.] (panel #))))\n    create clone of (_myself_ v)\nend\nset [panel # v] to [0]\n\nwhen I receive [tick v]\n\nif <(panel #) > [0]> then\n    set [lastx v] to (x position)\n    set x to ((480) - (((scroll x) + (((panel #) mod (2)) * (480))) mod (960)))\n    if <<(lastx) < ((-480) + (MAX SPEED))> and <((480) - (MAX SPEED)) < (x position)>> then\n        switch costume to ((costume [number v]) + (2))\n    else\n        if <<(x position) < ((-480) + (MAX SPEED))> and <((480) - (MAX SPEED)) < (lastx)>> then\n            switch costume to ((costume [number v]) - (2))\n        end\n    end\nend\n\nwhen I start as a clone\nshow\ngo to [front v] layer\ngo [backward v] (30) layers\nforever\n    set x to ((480) - (((scroll x) + (((panel #) mod (2)) * (480))) mod (960)))\n    if <<((scroll x) mod (480)) > [470]> or <[10] > ((scroll x) mod (480))>> then\n        switch costume to ((([ceiling v] of (((scroll x) + (((panel #) mod (2)) * (480))) / (960)) ) * (2)) - ((panel #) mod (2)))\n    end\nend\n\nwhen I receive [edit mode v]\nif <(panel #) > [0]> then\n    wait (0.01) seconds\n    switch costume to ((([ceiling v] of (((scroll x) + (((panel #) mod (2)) * (480))) / (960)) ) * (2)) - ((panel #) mod (2)))\nend\n\n@parallax\n\nwhen flag clicked\ngo [backward v] (50) layers\ngo to x: (0) y: (0)\nhide\nset rotation style [don't rotate v]\n\nwhen I receive [start v]\nset [layer # v] to [0]\nrepeat (2)\n    set [parallaxpos v] to [-480]\n    change [layer # v] by (1)\n    repeat (2)\n        change [parallaxpos v] by (480)\n        create clone of (_myself_ v)\n    end\nend\n\nwhen I start as a clone\nset x to (parallaxPos)\nshow\nswitch costume to (layer #)\nforever\n    scroll\nend\n\ndefine scroll\nif <(end scrolling?) = [false]> then\n    change x by ((xvel) * ((layer #) / (4)))\n    if <(x position) > [480]> then\n        set x to (-480)\n    else\n        if <[-480] > (x position)> then\n            set x to (480)\n        end\n    end\nend\n\n@font: Helvetica\n\nwhen flag clicked\nhide\nset rotation style [don't rotate v]\n\ndefine None\ngo to x: ((x pos) + (184)) y: (y pos)\nset size to (100) %\nswitch costume to (background v)\ncreate clone of (_myself_ v)\nset size to (size) %\nswitch costume to (cursor v)\nset [counter v] to [0]\ngo to x: (x pos) y: (y pos)\nrepeat (length of (text))\n    switch costume to (null v)\n    change [counter v] by (1)\n    if <(letter (counter) of (text)) = [\]> then\n        if <(letter ((counter) + (1)) of (text)) = [t]> then\n            wait until <key (space v) pressed?>\n            broadcast (clear text 2 v) and wait\n            go to x: (x pos) y: (y pos)\n        else\n            if <(letter ((counter) + (1)) of (text)) = [n]> then\n                set x to (x pos)\n                change y by ((size) / (-5))\n            end\n        end\n        change [counter v] by (1)\n    else\n        switch costume to (letter (counter) of (text))\n        if <(costume [number v]) = [65]> then\n            switch costume to (join (letter (counter) of (text)) [s])\n        end\n        create clone of (_myself_ v)\n        start sound [computer beeps2 v]\n        change x by ((item (costume [number v]) of [font sizes v]) * ((size) / (150)))\n        if <(x position) > (bound x)> then\n            set x to (x pos)\n            change y by ((size) / (-5))\n        end\n    end\nend\nhide\nwait until <key (space v) pressed?>\nset [text? v] to [0]\nbroadcast (clear text v)\n\nprint [testing $$$$ @.@ "OMG!"LALALA woah how awesome\tUse the WASD keys to move.\ttestetettet\taasdasdsdasd\tasdasd] (-184) (0) (100) (184)\n\nwhen flag clicked\nfont size parser\n\ndefine font size parser\nset [text? v] to [19.19.19.19.19.19.19.19.19.22.22.22.22.21.20.24.22.10.19.22.20.25.22.24.21.24.22.21.20.22.21.27.21.21.20.19.20.19.20.19.11.20.20.10.11.19.10.26.20.20.20.15.15.19.12.20.19.24.19.19.17.14.19.19.14.13.14.13.20.08.17.14.14.14.14.13.19.19.25.19.19.26.19.22.15.19.19.19.14.15.15.14.14.13.]\nset [counter v] to [0]\ndelete (all) of [font sizes v]\nrepeat ((length of (text?)) / (3))\n    change [counter v] by (3)\n    add (join (letter ((counter) - (2)) of (text?)) (letter ((counter) - (1)) of (text?))) to [font sizes v]\nend\nset [text? v] to [0]\n\ndefine delete clones\ndelete this clone\n\nwhen I start as a clone\nshow\ngo to [front v] layer\n\nwhen I receive [clear text v]\ndelete this clone\n\nwhen I receive [clear text 2 v]\nif <not <(costume [number v]) = [96]>> then\n    delete this clone\nend\n\nwhen I receive [print text v]\nprint (text?) (-184) (-125) (100) (184)\n\n@objects\n\nwhen I start as a clone\nswitch costume to ((costume ID) + (1))\ngo to x: (xpos) y: (ypos)\nforever\n    set x to (round ((xpos) - (scroll x)))\n    if <(x position) = (round ((xpos) - (scroll x)))> then\n        show\n    else\n        hide\n    end\nend\n\nwhen I receive [spawn objects v]\nspawn\n\ndefine behavior\nif <<(costume [number v]) > [1]> and <(costume [number v]) < [6]>> then\n    if <touching (player v)?> then\n        broadcast (hover effect v)\n        if <key (space v) pressed?> then\n            set [text? v] to (text)\n            broadcast (print text v) and wait\n            wait until <not <key (space v) pressed?>>\n        end\n    end\nelse\n    if <(costume [number v]) = [6]> then\n        set rotation style [don't rotate v]\n        if <touching (player v)?> then\n            set [yvel v] to ((JUMP POWER) + (5))\n            start sound [boing v]\n        end\n        turn right (5) degrees\n        set size to ((100) + ((4) * ([sin v] of (direction) ))) %\n    else\n        if <<(costume [number v]) > [6]> and <(costume [number v]) < [10]>> then\n            if <(costume [number v]) = [9]> then\n                turn right (2) degrees\n                change [xpos v] by ((3) * ([sin v] of (direction) ))\n                set size to ((100) + ((20) * ([sin v] of ((2) * (direction)) ))) %\n                if <touching (player v)?> then\n                    if <<((y position) + (10)) < ([y position v] of [player v])> and <(yvel) < [0]>> then\n                        start sound [boing v]\n                        set [yvel v] to ((JUMP POWER) - (2))\n                        broadcast (slime effect v)\n                        delete this clone\n                    else\n                        broadcast (hurtanimation v)\n                    end\n                end\n            else\n                if <touching (player v)?> then\n                    broadcast (hurtanimation v)\n                end\n            end\n        end\n    end\nend\n\nwhen I start as a clone\nforever\n    if <(x position) = (round ((xpos) - (scroll x)))> then\n        behavior\n    end\nend\n\ndefine spawn\nif <(costume [number v]) = [1]> then\n    set [list id v] to (item (object) of [objects v])\n    set [costume id v] to ((join (letter (1) of (list ID)) (letter (2) of (list ID))) - (10))\n    set [xpos v] to ((join (join (join (letter (3) of (list ID)) (letter (4) of (list ID))) (letter (5) of (list ID))) (letter (6) of (list ID))) - (1000))\n    set [ypos v] to ((join (join (letter (7) of (list ID)) (letter (8) of (list ID))) (letter (9) of (list ID))) - (300))\n    set [text v] to []\n    set [counter v] to [0]\n    repeat ((length of (list ID)) - (9))\n        change [counter v] by (1)\n        set [text v] to (join (text) (letter ((counter) + (9)) of (list ID)))\n    end\n    set [list id v] to (object)\n    create clone of (_myself_ v)\nend\n\nwhen flag clicked\nset rotation style [left-right v]\nset size to (100) %\nswitch costume to (blank v)\nhide\n\nwhen [x v] key pressed\nif <touching (editor v)?> then\n    delete (list ID) of [objects v]\n    delete this clone\nend\n\n@editor\n\nwhen flag clicked\nset [edit mode? v] to [0]\nset [placeholder v] to [0]\nset [object v] to [0]\ngo to x: (0) y: (0)\nhide\nswitch costume to (costume1 v)\n\nwhen [e v] key pressed\nif <(backdrop [number v]) > [1]> then\n    set [edit mode? v] to ((1) - (edit mode?))\n    broadcast (edit mode v)\nend\n\nwhen I receive [edit mode v]\nif <(edit mode?) = [1]> then\n    set [placeholder v] to (scroll x)\n    show\n    go to [front v] layer\n    forever\n        go to (mouse-pointer v)\n        if <touching (objects v)?> then\n            say [Press 'X' to delete this object]\n        else\n            say []\n        end\n        if <key (left arrow v) pressed?> then\n            scroll (-10)\n        else\n            if <key (right arrow v) pressed?> then\n                scroll (10)\n            end\n        end\n        if <<mouse down?> and <touching (mouse-pointer v)?>> then\n            wait until <not <mouse down?>>\n            ask [Enter an object ID \(see Instructions for details\) or leave blank to cancel:] and wait\n            if <<(answer) > [0]> and <(answer) < [9]>> then\n                add (join (join ((answer) + (10)) ((round ((scroll x) + (x position))) + (1000))) ((round (y position)) + (300))) to [objects v]\n                if <<(answer) > [0]> and <(answer) < [5]>> then\n                    ask [This object can trigger dialogue. What do you want the object to say? \(You can leave this blank\)] and wait\n                    replace item (last) of [objects v] with (join (item (last) of [objects v]) (answer))\n                end\n                set [object v] to (length of [objects v])\n                broadcast (spawn objects v) and wait\n            end\n        end\n    end\nelse\n    set [scroll x v] to (placeholder)\n    hide\nend\n\ndefine None\nchange [scroll x v] by (dir)\nset [end scrolling? v] to <<(scroll x) < [0]> or <(scroll x) > ((480) * ((item (level) of [level lengths v]) - (1)))>>\nif <(end scrolling?) = [true]> then\n    change [scroll x v] by ((0) - (dir))\nend\nbroadcast (tick v)\n\nwhen I receive [start v]\nset [object v] to [0]\nrepeat (length of [objects v])\n    change [object v] by (1)\n    broadcast (spawn objects v) and wait\nend\n\n@effects\n\nwhen flag clicked\ngo to x: (0) y: (0)\nhide\nset [ghost v] effect to (0)\nset size to (100) %\n\nwhen I receive [hover effect v]\nif <(edit mode?) = [0]> then\n    switch costume to (hover v)\n    show\n    go to [front v] layer\n    go to x: ([x position v] of [player v]) y: ([y position v] of [player v])\n    wait (0.01) seconds\n    hide\nend\n\nwhen I receive [slime effect v]\nif <(edit mode?) = [0]> then\n    switch costume to (slime v)\n    show\n    go to [front v] layer\n    go to x: ([x position v] of [player v]) y: (([y position v] of [player v]) - (25))\n    repeat (25)\n        change size by (2)\n        change [ghost v] effect by (4)\n        change x by (xvel)\n    end\n    hide\n    set size to (100) %\n    set [ghost v] effect to (0)\nend\n\nwhen I receive [edit mode v]\nif <(edit mode?) = [1]> then\n    go to x: (0) y: (0)\n    switch costume to (edit mode v)\n    show\n    go to [front v] layer\nelse\n    hide\nend\n\n@logo2\n\nwhen flag clicked\ngo to x: (0) y: (0)\nset rotation style [all around v]\npoint in direction (90)\nswitch costume to (costume1 v)\nset [ghost v] effect to (0)\nhide\nrender (90) (1) (0) (0)\nrender (90) (2) (0) (0)\nrender (30) (2) (0) (0)\nrender (-30) (3) (0) (0)\nrender (-90) (2) (0) (0)\nrender (-150) (4) (0) (0)\nrender (-210) (2) (0) (0)\nwait (4) seconds\nrender (-270) (5) (0) (0)\nwait (2) seconds\nbroadcast (end logo v)\n\ndefine None\nswitch costume to (costume #)\ngo to x: (xpos) y: (ypos)\npoint in direction (direction)\ncreate clone of (_myself_ v)\n\nwhen I receive [end logo v]\nrepeat (50)\n    change [ghost v] effect by (2)\nend\ndelete this clone\n\nwhen I start as a clone\nif <(costume [number v]) = [1]> then\n    show\n    go to [front v] layer\nelse\n    if <<(costume [number v]) > [1]> and <[5] > (costume [number v])>> then\n        set [ghost v] effect to (100)\n        show\n        go to [front v] layer\n        repeat until <(direction) = [120]>\n            turn right (3) degrees\n        end\n        repeat (50)\n            change [ghost v] effect by (-2)\n            turn right (3) degrees\n        end\n        forever\n            turn right (3) degrees\n        end\n    else\n        set [ghost v] effect to (100)\n        show\n        go to [front v] layer\n        repeat (25)\n            change [ghost v] effect by (-4)\n        end\n    end\nend\n\n
Use your Ninja Skills™ to help Scratch Cat find delicious fish to eat! Now mobile-friendly!\n\nCONTROLS (Keyboard):\nWASD / arrow keys - move, jump, and climb walls!\nSPACE - interact or attack.\nR - reset to last checkpoint\nM - return to main menu\n\nCONTROLS (Mobile):\nTap/press above/left/right of the cat to move, jump, or climb walls.\nTap directly on the cat to interact or attack.\nThere are no resetting or return options for mobile yet, but you don't need them to beat the game.