SCROLL PLATFORMER

Instructions:   Click the flag, then use arrow keys to play!\nThe Space key at the beginning and end does not work the blue stuff is bouncy use blue to get to the door!\n\n-Credits to another scratcher for the character.\n

@Stage\n\nwhen flag clicked\nrepeat (100)\n    play sound [Rogue Soul 2 THEME - Fast & Deadly v] until done\nend\n\n@Player\n\ndefine Touch Ground <up?>\nchange [falling? v] by (1)\nrepeat until <not <touching (level  v)?>>\n    if <up?> then\n        change y by (-1)\n    else\n        change y by (1)\n        set [falling? v] to [0]\n    end\n    set [speed y v] to [0]\nend\n\ndefine Walk (direction) (speed)\npoint in direction (direction)\nchange x by (speed)\nset [slope v] to [0]\nrepeat until <<(slope) = [8]> or <not <touching (level  v)?>>>\n    change y by (1)\n    change [slope v] by (1)\nend\nif <(slope) = [8]> then\n    change x by ((0) - (speed))\n    change y by ((0) - (slope))\nend\nchange [frame v] by (0.5)\n\ndefine Set Costume\nif <(falling?) < [6]> then\n    if <(frame) = [0]> then\n        switch costume to (stand_1 v)\n    else\n        switch costume to ([floor v] of ((4) + ((frame) mod (8))) )\n    end\nelse\n    if <(speed y) > [0]> then\n        switch costume to (jump_1 v)\n    else\n        switch costume to (fall_1 v)\n    end\nend\n\ndefine Griffpatch Platforming Engine (speed)\nif <key (down arrow v) pressed?> then\n    switch costume to (hitbox2 v)\nelse\n    switch costume to (hitbox v)\nend\nif <<(speed y) < [4]> or > then\n    change [speed y v] by (-1)\nelse\n    change [speed y v] by (-2)\nend\nchange y by (speed y)\nTouch Ground <(speed y) > [0]>\nif  then\n    Walk (-90) ((speed) * (-1))\nelse\n    if  then\n        Walk (90) (speed)\n    else\n        set [frame v] to [0]\n    end\nend\nif  then\n    if <<(jump key) = [0]> and <(falling?) < [3]>> then\n        set [speed y v] to [14]\n        set [falling? v] to [6]\n        set [jump key v] to [1]\n    end\nelse\n    set [jump key v] to [0]\nend\nif <(y position) < [-210]> then\n    broadcast (lost v)\nend\nif <(direction) = [-90]> then\n    set [lol v] to [1]\nelse\n    set [lol v] to [0]\nend\nif <touching (trampoline v)?> then\n    set [speed y v] to [20]\n    if <key (s v) pressed?> then\n        set [speed y v] to [30]\n    end\nend\nif <touching (knifes v)?> then\n    broadcast (new knifes v)\nend\nif <<touching (danger4 v)?> or <<touching (danger v)?> or <<touching (danger2 v)?> or <touching (danger3 v)?>>>> then\n    if <not <(NO DAMAGE) = [1]>> then\n        broadcast ( MINUS LIVE v)\n    end\nend\nSet Costume\nScrolling Blocks\n\nswitch costume to (costume3 v)\nbroadcast (lost v)\n\nwait (1) seconds\n\ndefine Reset Player\nshow\nset size to (40) %\nset rotation style [left-right v]\npoint in direction (90)\ngo to x: (0) y: (100)\nset [speed y v] to [0]\nset [falling? v] to [10]\nset [scrollx v] to [0]\nhide\n\ndefine Scrolling Blocks\nchange [scrollx v] by (x position)\nset x to (0)\n\nwhen flag clicked\nset [ghost v] effect to (0)\ngo to [front v] layer\ngo [backward v] (1) layers\nhide\nbroadcast (Transition In v) and wait\nbroadcast (Delete All Clones v) and wait\nbroadcast (SetUp v) and wait\nbroadcast (Level Loop v)\nbroadcast (Play v)\nbroadcast (Transition Out v) and wait\nbroadcast (Play BG Music v)\n\nwhen I receive [setup v]\nReset Player\n\ndefine Quick Scroll\nif <key (right arrow v) pressed?> then\n    change [scrollx v] by (300)\nend\nif <key (left arrow v) pressed?> then\n    change [scrollx v] by (300)\nend\n\nwhen I receive [play v]\nset size to (30) %\nshow\nforever\n    Griffpatch Platforming Engine [8]\nend\n\nwhen I receive [double jump v]\nset [speed y v] to [15]\n\nwhen I receive [parachute v]\nswitch costume to (costume1 v)\nchange y by ((-1) * ((speed y) - (-1)))\n\nwhen I receive [katana v]\nrepeat (10)\n    switch costume to (lol v)\nend\nwait (3) seconds\nswitch costume to (stand_1 v)\n\nwhen I receive [slide v]\nswitch costume to (costume2 v)\nif <(direction) = [90]> then\n    change [scrollx v] by (7)\nelse\n    change [scrollx v] by (-7)\nend\n\nwhen I receive [ minus live v]\nrepeat (3)\n    set [ghost v] effect to (30)\nend\nset [ghost v] effect to (0)\n\nwhen I receive [lost v]\nswitch costume to (costume3 v)\n\nwhen I receive [end v]\ngo to [back v] layer\n\nhide\n\n@Level ART\n\ndefine Create\nFind Costume Number\nrepeat ((Level Costumes) - (1))\n    create clone of (_myself_ v)\n    change [level_x v] by (480)\n    next costume\nend\n\nwhen I receive [level loop v]\nforever\n    set x to ((Level_X) - (ScrollX))\n    if <([abs v] of ((Level_X) - (ScrollX)) ) > [480]> then\n        hide\n    else\n        show\n    end\nend\n\nwhen I receive [setup v]\ngo to [back v] layer\ngo [forward v] (4) layers\nshow\nclear graphic effects\ngo to x: (0) y: (0)\nset [level_x v] to [0]\nswitch costume to (costume1 v)\nCreate\nhide\n\ndefine Find Costume Number\nset [level costumes v] to [1]\nswitch costume to ((1) / (1))\nnext costume\nrepeat until <(costume [number v]) = [1]>\n    change [level costumes v] by (1)\n    next costume\nend\n\n@LEVEL \n\ndefine Create\nwait (1) seconds\nrepeat ((Level Costumes) - (1))\n    create clone of (_myself_ v)\n    change [level_x v] by (480)\n    next costume\nend\n\nwhen I receive [level loop v]\nforever\n    set x to ((Level_X) - (ScrollX))\n    if <([abs v] of ((Level_X) - (ScrollX)) ) > [480]> then\n        hide\n    else\n        show\n    end\nend\n\nwhen I receive [setup v]\nshow\nclear graphic effects\ngo to x: (0) y: (0)\nset [level_x v] to [0]\nswitch costume to (costume1 v)\nCreate\nhide\n\ndefine Find Costume Number\nset [level costumes v] to [1]\nswitch costume to ((1) / (1))\nnext costume\nrepeat until <(costume [number v]) = [1]>\n    change [level costumes v] by (1)\n    next costume\nend\n\n@katana\n\nwhen I receive [katana v]\ngo to (player v)\npoint in direction ([x position v] of [player v])\nclear graphic effects\nchange y by (40)\nchange x by (10)\nshow\nif <(direction) > [10]> then\n    point in direction (90)\n    switch costume to (swing v)\n    set [currently sword swinging v] to [1]\n    repeat (10)\n        turn right (30) degrees\n        go to (player v)\n        change y by (40)\n        change x by (10)\n    end\n    set [currently sword swinging v] to [0]\n    hide\n    wait until <not <key (space v) pressed?>>\nelse\n    point in direction (90)\n    switch costume to (swing2 v)\n    set [currently sword swinging v] to [1]\n    repeat (10)\n        turn right (-30) degrees\n        go to (player v)\n        change y by (40)\n        change x by (10)\n    end\n    set [currently sword swinging v] to [0]\n    hide\n    wait until <not <key (space v) pressed?>>\nend\n\nwhen flag clicked\ngo to [back v] layer\ngo [forward v] (17) layers\n\n@knife \n\nwhen I receive [knife v]\nif <not <(lol) = [1]>> then\n    change [knifes v] by (-1)\n    go to (player v)\n    change y by (10)\n    point in direction ([direction v] of [player v])\n    show\n    repeat until <<touching (people3 v)?> or <<touching (people2 v)?> or <<touching (level  v)?> or <touching (people v)?>>>>\n        move (10) steps\n    end\n    wait (0.3) seconds\n    hide\n    go to (player v)\nend\nwait (1) seconds\n\ncreate clone of (_myself_ v)\n\nwhen flag clicked\ngo to [front v] layer\nhide\nset [knifes v] to [5]\n\ngo [backward v] (4) layers\n\n@Sprite1\n\nwhen flag clicked\nforever\n    if <key (space v) pressed?> then\n        broadcast (katana v)\n    end\n    if <key (e v) pressed?> then\n        if <not <(knifes) < [1]>> then\n            if <(lol) = [0]> then\n                broadcast (knife v)\n                wait (1) seconds\n            end\n        end\n    end\n    if <key (w v) pressed?> then\n        wait (0.2) seconds\n        if <key (w v) pressed?> then\n            broadcast (double jump v)\n            wait (1) seconds\n        end\n    end\n    if <key (up arrow v) pressed?> then\n        broadcast (Parachute v)\n    end\n    if <key (down arrow v) pressed?> then\n        repeat (12)\n            broadcast (slide v)\n        end\n        wait (1) seconds\n    end\nend\n\nwhen I receive [new knifes v]\nset [knifes v] to [5]\nbroadcast (* v)\n\nwhen I receive [setup v]\nset [knifes lol v] to [0]\nset [knifes v] to [0]\nset [knifes v] to [5]\n\n\n\n@Sprite2\n\nwhen flag clicked\nswitch costume to (costume6 v)\nset [knifes lol v] to [0]\ngo to [front v] layer\nswitch costume to (costume6 v)\n\nwhen I receive [knife v]\nswitch costume to ((costume [number v]) - (1))\n\nwhen I receive [* v]\nswitch costume to (costume6 v)\n\nwhen I receive [setup v]\nswitch costume to (costume6 v)\n\n@Trampoline\n\ndefine Create\nwait (1) seconds\nrepeat ((Level Costumes) - (1))\n    create clone of (_myself_ v)\n    change [level_x v] by (480)\n    next costume\nend\n\nwhen I receive [level loop v]\nforever\n    set x to ((Level_X) - (ScrollX))\n    if <([abs v] of ((Level_X) - (ScrollX)) ) > [480]> then\n        hide\n    else\n        show\n    end\nend\n\nwhen I receive [setup v]\ngo to [front v] layer\ngo [backward v] (4) layers\nshow\nclear graphic effects\ngo to x: (0) y: (0)\nset [level_x v] to [0]\nswitch costume to (costume1 v)\nCreate\nhide\n\ndefine Find Costume Number\nset [level costumes v] to [1]\nswitch costume to ((1) / (1))\nnext costume\nrepeat until <(costume [number v]) = [1]>\n    change [level costumes v] by (1)\n    next costume\nend\n\n@Sprite3\n\nwhen flag clicked\nshow\nwait (6) seconds\nforever\n    go to [front v] layer\nend\n\nwhen I receive [end v]\nhide\n\n@Knifes\n\ndefine Create\nwait (1) seconds\nrepeat ((Level Costumes) - (1))\n    create clone of (_myself_ v)\n    change [level_x v] by (480)\n    next costume\nend\n\nwhen I receive [level loop v]\nforever\n    set x to ((Level_X) - (ScrollX))\n    if <([abs v] of ((Level_X) - (ScrollX)) ) > [480]> then\n        hide\n    else\n        show\n    end\nend\n\nwhen I receive [setup v]\ngo to [front v] layer\ngo [backward v] (4) layers\nshow\nclear graphic effects\ngo to x: (0) y: (0)\nset [level_x v] to [0]\nswitch costume to (costume1 v)\nCreate\nhide\n\ndefine Find Costume Number\nset [level costumes v] to [1]\nswitch costume to ((1) / (1))\nnext costume\nrepeat until <(costume [number v]) = [1]>\n    change [level costumes v] by (1)\n    next costume\nend\n\nwhen I receive [new knifes v]\nrepeat (400)\n    hide\nend\n\n@Sprite4\n\nwhen I receive [* v]\nif <(knifes lol) = [1]> then\n    go to (player v)\n    show\n    set [ghost v] effect to (0)\n    repeat (20)\n        change [ghost v] effect by (5)\n    end\n    hide\nend\nchange [knifes lol v] by (1)\nwait (3) seconds\nset [knifes lol v] to [0]\n\nwhen flag clicked\ngo to [front v] layer\ngo [backward v] (2) layers\nhide\n\n@People\n\ndefine Create\nwait (1) seconds\nrepeat ((Level Costumes) - (1))\n    create clone of (_myself_ v)\n    change [level_x v] by (480)\n    next costume\nend\n\nwhen I receive [level loop v]\nforever\n    set x to ((Level_X) - (ScrollX))\n    if <([abs v] of ((Level_X) - (ScrollX)) ) > [480]> then\n        hide\n    else\n        show\n    end\n    if <<touching (katana v)?> or <touching (knife  v)?>> then\n        broadcast (dead v)\n        wait (1) seconds\n    end\nend\n\nwhen I receive [setup v]\ngo to [front v] layer\ngo [backward v] (3) layers\nshow\nclear graphic effects\ngo to x: (0) y: (0)\nset [level_x v] to [0]\nswitch costume to (costume1 v)\nCreate\nhide\n\ndefine Find Costume Number\nset [level costumes v] to [1]\nswitch costume to ((1) / (1))\nnext costume\nrepeat until <(costume [number v]) = [1]>\n    change [level costumes v] by (1)\n    next costume\nend\n\nwhen I receive [dead v]\nset [invincible? v] to [1]\nrepeat (200)\n    hide\nend\nshow\nset [invincible? v] to [0]\n\nswitch costume to (tot v)\n\nswitch costume to ((Level Costumes) - (1))\n\n@Danger\n\ndefine Create\nwait (1) seconds\nrepeat ((Level Costumes) - (1))\n    create clone of (_myself_ v)\n    change [level_x v] by (480)\n    next costume\nend\n\nwhen I receive [level loop v]\nforever\n    set x to ((Level_X) - (ScrollX))\n    if <([abs v] of ((Level_X) - (ScrollX)) ) > [480]> then\n        hide\n    else\n        show\n    end\nend\n\nwhen I receive [setup v]\ngo to [front v] layer\ngo [backward v] (1) layers\nshow\nclear graphic effects\ngo to x: (0) y: (0)\nset [level_x v] to [0]\nswitch costume to (costume1 v)\nCreate\nhide\n\ndefine Find Costume Number\nset [level costumes v] to [1]\nswitch costume to ((1) / (1))\nnext costume\nrepeat until <(costume [number v]) = [1]>\n    change [level costumes v] by (1)\n    next costume\nend\n\nwhen I receive [dead v]\nchange y by (-100)\nrepeat (200)\n    hide\nend\nchange y by (95)\nshow\n\nwhen flag clicked\nshow\n\n@Sprite5\n\nwhen I receive [lost v]\nshow\ngo to [front v] layer\n\nwhen flag clicked\nhide\n\nwhen I receive [end v]\nhide\n\n@Sprite6\n\nwhen flag clicked\ngo to [back v] layer\n\n@Sprite7\n\nwhen flag clicked\ngo to [front v] layer\nswitch costume to (costume1 v)\n\nwhen I receive [dead v]\nnext costume\nwait (1) seconds\n\nwhen I receive [dead2 v]\nnext costume\nwait (1) seconds\n\nwhen I receive [dead3 v]\nnext costume\nwait (1) seconds\n\n@People2\n\ndefine Create\nwait (1) seconds\nrepeat ((Level Costumes) - (1))\n    create clone of (_myself_ v)\n    change [level_x v] by (480)\n    next costume\nend\n\nwhen I receive [level loop v]\nforever\n    set x to ((Level_X) - (ScrollX))\n    if <([abs v] of ((Level_X) - (ScrollX)) ) > [480]> then\n        hide\n    else\n        show\n    end\n    if <<touching (katana v)?> or <touching (knife  v)?>> then\n        broadcast (dead2 v)\n        wait (1) seconds\n    end\nend\n\nwhen I receive [setup v]\npoint in direction (90)\ngo to [front v] layer\ngo [backward v] (3) layers\nshow\nclear graphic effects\ngo to x: (0) y: (0)\nset [level_x v] to [0]\nswitch costume to (costume1 v)\nCreate\nhide\n\ndefine Find Costume Number\nset [level costumes v] to [1]\nswitch costume to ((1) / (1))\nnext costume\nrepeat until <(costume [number v]) = [1]>\n    change [level costumes v] by (1)\n    next costume\nend\n\nwhen I receive [dead2 v]\nset [invicible v] to [1]\nrepeat (200)\n    hide\nend\nshow\nset [invicible v] to [0]\n\n@Danger2\n\ndefine Create\nwait (1) seconds\nrepeat ((Level Costumes) - (1))\n    create clone of (_myself_ v)\n    change [level_x v] by (480)\n    next costume\nend\n\nwhen I receive [level loop v]\nforever\n    set x to ((Level_X) - (ScrollX))\n    if <([abs v] of ((Level_X) - (ScrollX)) ) > [480]> then\n        hide\n    else\n        show\n    end\nend\n\nwhen I receive [setup v]\ngo to [front v] layer\ngo [backward v] (1) layers\nshow\nclear graphic effects\ngo to x: (0) y: (0)\nset [level_x v] to [0]\nswitch costume to (costume1 v)\nCreate\nhide\n\ndefine Find Costume Number\nset [level costumes v] to [1]\nswitch costume to ((1) / (1))\nnext costume\nrepeat until <(costume [number v]) = [1]>\n    change [level costumes v] by (1)\n    next costume\nend\n\nwhen I receive [dead2 v]\nchange y by (-100)\nrepeat (200)\n    hide\nend\nchange y by (95)\nshow\n\nwhen flag clicked\nshow\n\n@Danger3\n\ndefine Create\nwait (1) seconds\nrepeat ((Level Costumes) - (1))\n    create clone of (_myself_ v)\n    change [level_x v] by (480)\n    next costume\nend\n\nwhen I receive [level loop v]\nforever\n    set x to ((Level_X) - (ScrollX))\n    if <([abs v] of ((Level_X) - (ScrollX)) ) > [480]> then\n        hide\n    else\n        show\n    end\nend\n\nwhen I receive [setup v]\ngo to [front v] layer\ngo [backward v] (3) layers\nshow\nclear graphic effects\ngo to x: (0) y: (0)\nset [level_x v] to [0]\nswitch costume to (costume1 v)\nCreate\nhide\n\ndefine Find Costume Number\nset [level costumes v] to [1]\nswitch costume to ((1) / (1))\nnext costume\nrepeat until <(costume [number v]) = [1]>\n    change [level costumes v] by (1)\n    next costume\nend\n\nwhen flag clicked\nshow\n\n@Level ART2\n\ndefine Create\nFind Costume Number\nrepeat ((Level Costumes) - (1))\n    create clone of (_myself_ v)\n    change [level_x v] by (480)\n    next costume\nend\n\nwhen I receive [level loop v]\nforever\n    set x to ((Level_X) - (ScrollX))\n    if <([abs v] of ((Level_X) - (ScrollX)) ) > [480]> then\n        hide\n    else\n        show\n    end\nend\n\nwhen I receive [setup v]\ngo to [front v] layer\ngo [backward v] (1) layers\nshow\nclear graphic effects\ngo to x: (0) y: (0)\nset [level_x v] to [0]\nswitch costume to (costume1 v)\nCreate\nhide\n\ndefine Find Costume Number\nset [level costumes v] to [1]\nswitch costume to ((1) / (1))\nnext costume\nrepeat until <(costume [number v]) = [1]>\n    change [level costumes v] by (1)\n    next costume\nend\n\n@People3\n\ndefine Create\nwait (1) seconds\nrepeat ((Level Costumes) - (1))\n    create clone of (_myself_ v)\n    change [level_x v] by (480)\n    next costume\nend\n\nwhen I receive [level loop v]\nforever\n    set x to ((Level_X) - (ScrollX))\n    if <([abs v] of ((Level_X) - (ScrollX)) ) > [480]> then\n        hide\n    else\n        show\n    end\n    if <<touching (katana v)?> or <touching (knife  v)?>> then\n        broadcast (dead3 v)\n        wait (1) seconds\n    end\nend\n\nwhen I receive [setup v]\npoint in direction (90)\ngo to [front v] layer\ngo [backward v] (3) layers\nshow\nclear graphic effects\ngo to x: (0) y: (0)\nset [level_x v] to [0]\nswitch costume to (costume1 v)\nCreate\nhide\n\ndefine Find Costume Number\nset [level costumes v] to [1]\nswitch costume to ((1) / (1))\nnext costume\nrepeat until <(costume [number v]) = [1]>\n    change [level costumes v] by (1)\n    next costume\nend\n\nwhen I receive [dead3 v]\nset [invicible v] to [1]\nrepeat (200)\n    hide\nend\nshow\nset [invicible v] to [0]\n\n@Danger4\n\ndefine Create\nwait (1) seconds\nrepeat ((Level Costumes) - (1))\n    create clone of (_myself_ v)\n    change [level_x v] by (480)\n    next costume\nend\n\nwhen I receive [level loop v]\nforever\n    set x to ((Level_X) - (ScrollX))\n    if <([abs v] of ((Level_X) - (ScrollX)) ) > [480]> then\n        hide\n    else\n        show\n    end\nend\n\nwhen I receive [setup v]\ngo to [front v] layer\ngo [backward v] (1) layers\nshow\nclear graphic effects\ngo to x: (0) y: (0)\nset [level_x v] to [0]\nswitch costume to (costume1 v)\nCreate\nhide\n\ndefine Find Costume Number\nset [level costumes v] to [1]\nswitch costume to ((1) / (1))\nnext costume\nrepeat until <(costume [number v]) = [1]>\n    change [level costumes v] by (1)\n    next costume\nend\n\nwhen I receive [dead3 v]\nchange y by (-100)\nrepeat (200)\n    hide\nend\nchange y by (95)\nshow\n\nwhen flag clicked\nshow\n\n@Sprite8\n\nwhen flag clicked\ngo to [front v] layer\nshow\nset [no damage v] to [0]\nswitch costume to (costume1 v)\nforever\n    if <(costume [number v]) = [3]> then\n        broadcast (lost v)\n    end\nend\n\nwhen I receive [ minus live v]\nset [no damage v] to [1]\nnext costume\nwait (3) seconds\nset [no damage v] to [0]\n\n@Level ART3\n\ndefine Create\nFind Costume Number\nrepeat ((Level Costumes) - (1))\n    create clone of (_myself_ v)\n    change [level_x v] by (480)\n    next costume\nend\n\nwhen I receive [level loop v]\nforever\n    set x to ((Level_X) - (ScrollX))\n    if <([abs v] of ((Level_X) - (ScrollX)) ) > [480]> then\n        hide\n    else\n        show\n    end\n    if <touching (player v)?> then\n        next costume\n        wait (1) seconds\n        broadcast (end v)\n        wait (5) seconds\n    end\nend\n\nwhen I receive [setup v]\ngo to [front v] layer\ngo [backward v] (1) layers\nshow\nclear graphic effects\ngo to x: (0) y: (0)\nset [level_x v] to [0]\nswitch costume to (costume1 v)\nCreate\nhide\n\ndefine Find Costume Number\nset [level costumes v] to [1]\nswitch costume to ((1) / (1))\nnext costume\nrepeat until <(costume [number v]) = [1]>\n    change [level costumes v] by (1)\n    next costume\nend\n\nwhen I receive [hide v]\nforever\n    hide\nend\n\n@Sprite9\n\nwhen I receive [end v]\nbroadcast (hide v)\nrepeat (100)\n    change [ghost v] effect by (-1)\nend\n\nwhen flag clicked\nset [ghost v] effect to (100)\nforever\n    go to [front v] layer\n    go [backward v] (1) layers\n    wait (100) seconds\nend\n\n@Sprite10\n\nwhen flag clicked\nshow\nrepeat (3)\n    go to [front v] layer\nend\nset [ghost v] effect to (0)\nwait (5) seconds\nrepeat (100)\n    change [ghost v] effect by (1)\nend\n\n