Block-a scrolling platformer

Instructions: Play my new project here: https://scratch.mit.edu/projects/710939600/\n\n\nWelcome to this collab game:Block-a scrolling platformer\nCollabteam: I and @zuocr\nWe work  three weeks on it,so a heart,a star and a follow would be very nice!^.^\nControls:Arrow keys or WAD.Avoid holes and spikes!If you get the block,use it by draging it.Collect the coins to\nopen the door.Find your family.\n\nStory:Your family got lost.Find them!\n

@Stage\n\n@Boden\n\nwhen I receive [setup level v]\nset [counter v] to [0]\nsetup clone at x,y: (0) (0)\n\ndefine setup clone at x,y: (x) (y)\nswitch costume to (1 1 v)\nset [temp v] to [0]\nrepeat (70)\n    go to x: (0) y: (0)\n    hide\n    set [showing v] to [0]\n    set [x v] to (round ((temp) * (460)))\n    set [y v] to [0]\n    create clone of (_myself_ v)\n    next costume\n    change [temp v] by (1)\nend\n\ndefine position (x) (y)\ngo to x: (x) y: (y)\nif <<(x) = (x position)> and <(y) = (y position)>> then\n    if <(showing) = [0]> then\n        set [showing v] to [1]\n        show\n    end\nelse\n    if <(showing) = [1]> then\n        set [showing v] to [0]\n        hide\n    end\nend\n\nwhen I receive [game loop tick v]\ngo to [back v] layer\ngo [forward v] (1) layers\nif <(showing) > [-1]> then\n    position (round ((x) - (@Scroll X))) (round ((y) - (@Scroll Y)))\nend\n\nwhen I receive [dend v]\nhide\nstop [other scripts in sprite v]\n\n@Spieler\n\nwhen I receive [setup level v]\nshow\ngo to [front v] layer\n\nwhen I receive [game loop tick v]\nswitch costume to (spieler v)\ngo to x: (round ((@Player X) - (@Scroll X))) y: (round ((@Player Y) - (@Scroll Y)))\ngo to [front v] layer\nif <<key (right arrow v) pressed?> or <key (d v) pressed?>> then\n    switch costume to (links v)\nend\nif <<key (left arrow v) pressed?> or <key (a v) pressed?>> then\n    switch costume to (rechts v)\nend\nif <<key (up arrow v) pressed?> or <key (w v) pressed?>> then\n    switch costume to (oben v)\nend\nif <(@Player Die) = [0]> then\n    if <(Lastdie) > [0]> then\n        set size to (100) %\n        set [ghost v] effect to (0)\n    end\nelse\n    if <<<(@Player Die) > [10]> and <(Lastdie) = [0]>> or <<touching (spikes v)?> and <(@Falling) > [0]>>> then\n        set size to ((size) + (10)) %\n        change [ghost v] effect by (4)\n        change [@player y v] by (0)\n    else\n        change [ghost v] effect by (100)\n    end\nend\nset [lastdie v] to [1]\n\nwhen I receive [game loop tick v]\nif <(@Scroll X) > [11189]> then\n    broadcast (Dend v)\nend\n\nwhen I receive [dend v]\nhide\nstop [other scripts in sprite v]\n\n@Spiel\n\ndefine Move Out Of Collision dir x,y: (dx) (dy) limit: (limit)\nset [lim v] to [1]\nrepeat until <<(lim) > (limit)> or <(touch) < [100]>>\n    change [@player x v] by (dx)\n    change [@player y v] by (dy)\n    change [lim v] by (1)\n    Check Collide\nend\nif <(lim) > (limit)> then\n    change [@player x v] by ((0) - ((dx) * (limit)))\n    change [@player y v] by ((0) - ((dy) * (limit)))\n    if <(@Player SX) = [0]> then\n        set [@player die v] to [1]\n    else\n        Check Collide\n        if <(@Player SX) > [0]> then\n            Move Out Of Collision dir x,y: (-1) (0) limit: (999)\n        else\n            Move Out Of Collision dir x,y: (1) (0) limit: (999)\n        end\n        set [@player sx v] to [0]\n    end\nend\n\ndefine Check Collide\ngo to x: (round ((@Player X) - (@Scroll X))) y: (round ((@Player Y) - (@Scroll Y)))\nif <<<touching (block v)?> or <<<<touching color (#00ff1d)?> or <touching color (#d8d8d8)?>> or <touching color (#c8c8c8)?>> or <touching color (#e4cf3d)?>>> or <<touching color (#996060)?> or <touching color (#ffff37)?>>> then\n    set [touch v] to [101]\nelse\n    if <touching (moving platform v)?> then\n        set [touch v] to [102]\n    else\n        set [touch v] to [0]\n    end\nend\n\ndefine Scroll Level\nchange [@scroll x v] by (round (((@Player X) - (@Scroll X)) * (0.1)))\nif <(@Scroll X) < [0]> then\n    set [@scroll x v] to [0]\nend\nchange [@scroll y v] by (round (((@Player Y) - (@Scroll Y)) * (0.1)))\nif <(@Scroll Y) < [0]> then\n    set [@scroll y v] to [0]\nend\nbroadcast (aktu x v)\n\ndefine Player Tick\nset [pushed sx v] to [0]\nif <(on platform) = []> then\n    Check Collide\n    if <(touch) = [102]> then\n        set [pushed sx v] to ((@Platform SX) - (@Player SX))\n        change [@player x v] by (@Platform SX)\n        set [@player sx v] to [0]\n        Check Collide\n        if <<(touch) > [100]> and <not <(touch) = [102]>>> then\n            Move Out Of Collision dir x,y: (0) (1) limit: (([abs v] of (@Platform SX) ) + (2))\n            if <(@Player Die) > [0]> then\n                stop [this script v]\n            end\n            set [@player sy v] to [0]\n            set [@falling v] to [0]\n        end\n    end\nend\nif <<<key (up arrow v) pressed?> or <key (w v) pressed?>> and <(@Falling) < [3]>> then\n    set [@falling v] to [3]\n    set [@player sy v] to [14]\nend\nif <(@Player SY) > [-16]> then\n    change [@player sy v] by (-1.2)\nend\nchange [@player y v] by (@Player SY)\nif <not <(on platform) = []>> then\n    change [@player y v] by (-5)\n    Check Collide\n    if <not <(touch) = [102]>> then\n        change [@player y v] by (5)\n    end\nend\nset [on platform v] to [0]\nCheck Collide\nif <(touch) = [102]> then\n    set [on platform v] to (@Platform SX)\nelse\n    set [on platform v] to []\nend\nif <(touch) > [100]> then\n    if <(@Player SY) > [0]> then\n        Move Out Of Collision dir x,y: (0) (-1) limit: (999)\n        set [@falling v] to [3]\n        set [@player sy v] to [0]\n    else\n        Move Out Of Collision dir x,y: (0) (1) limit: (999)\n        set [@player sy v] to ((@Player SY) / (2))\n        set [@falling v] to [0]\n    end\nelse\n    change [@falling v] by (1)\nend\nif <<key (left arrow v) pressed?> or <key (a v) pressed?>> then\n    set [@player dir v] to [-90]\n    change [@player sx v] by ((((-7) + (on platform)) - (@Player SX)) * (0.2))\n    change [@walking v] by (1)\n    broadcast (aktu x v)\nelse\n    if <<key (right arrow v) pressed?> or <key (d v) pressed?>> then\n        set [@player dir v] to [90]\n        change [@player sx v] by ((((7) + (on platform)) - (@Player SX)) * (0.2))\n        change [@walking v] by (1)\n        broadcast (aktu x v)\n    else\n        set [@walking v] to [-1]\n        if <([abs v] of ((@Player SX) - (on platform)) ) > [1]> then\n            change [@player sx v] by (((on platform) - (@Player SX)) * (0.35))\n        else\n            set [@player sx v] to (on platform)\n        end\n    end\nend\nchange [@player x v] by (@Player SX)\nCheck Collide\nif <(touch) > [100]> then\n    Move Out Of Collision dir x,y: (0) (1) limit: (round ((([abs v] of (@Player SX) ) * (2)) + (2)))\n    if <(lim) > [2]> then\n        set [@player sx v] to ((@Player SX) * (0.6))\n    end\nend\nif <not <(pushed sx) = [0]>> then\n    change [@player sx v] by (pushed sx)\nend\n\ndefine Reset Player\nset [@player x v] to (@Spawn X)\nset [@player y v] to (@Spawn Y)\nset [@scroll x v] to (@Player X)\nset [@scroll y v] to (@Player Y)\nset [@player sx v] to [0]\nset [@player sy v] to [0]\nset [@falling v] to [0]\nset [@walking v] to [-1]\nset [@player die v] to [0]\nset [lastdie v] to [0]\nScroll Level\n\nwhen flag clicked\nshow\nset [ghost v] effect to (100)\nset [@level v] to [1]\nset [@totalflags v] to [0]\nset [@timer v] to [0]\nset [@player dir v] to [90]\nset [@spawn x v] to [0]\nset [@spawn y v] to [32]\nReset Player\nbroadcast (setup level v) and wait\nbroadcast (game loop tick v) and wait\nbroadcast (Clouds...I love Clouds!xD v)\nbroadcast (f v)\nforever\n    change [@timer v] by (1)\n    if <(@Player Die) = [0]> then\n        Player Tick\n        if <<(@Player Y) < [-200]> or <touching (spikes v)?>> then\n            set [@player die v] to [25]\n            start sound [Crunch v]\n        end\n    else\n        change [@player die v] by (1)\n        if <(@Player Die) > [60]> then\n            Reset Player\n        end\n    end\n    Scroll Level\n    broadcast (game loop tick v) and wait\nend\n\nwhen I receive [dend v]\nhide\nstop [other scripts in sprite v]\n\n@Block\n\nwhen flag clicked\nset drag mode [draggable v]\nset [which costum? v] to [0]\nset [old v] to [100]\nset [chceck v] to [0]\nif <(Chceck) = [0]> then\n    change [@timer v] by (1)\n    forever\n        go to [front v] layer\n        wait (1) seconds\n    end\nend\n\nwhen I receive [aktu x v]\ngo to [front v] layer\nif <(blocklocked?) = [0]> then\n    show\n    set x to ((old) - (@Scroll X))\n    set [old v] to ((x position) + (@Scroll X))\n    set y to ((oldy) - (@Scroll Y))\n    set [oldy v] to ((y position) + (@Scroll Y))\n    if <<touching (mouse-pointer v)?> and <mouse down?>> then\n        set [which costum? v] to [1]\n        set [counter v] to [20]\n        set [ghost v] effect to (30)\n    else\n        change [counter v] by (-1)\n        set [ghost v] effect to (0)\n    end\nelse\n    hide\n    if <(@Scroll X) > [3900]> then\n        set [blocklocked? v] to [0]\n        set [old v] to ((300) + (3870))\n        set [oldy v] to [-27]\n    end\nend\n\nwhen I receive [setup level v]\nset [blocklocked? v] to [1]\n\nwhen I receive [aktu x v]\nswitch costume to (block 2 v)\nif <(which costum?) = [1]> then\n    switch costume to (block 1 v)\nend\n\nwhen I receive [dend v]\nhide\nstop [other scripts in sprite v]\n\n@Music\n\nwhen flag clicked\nshow\ngo to x: (189) y: (150)\nset size to (60) %\nset [geht es? v] to [0]\nswitch costume to (musik an v)\nstart sound [langsam v]\n\nwhen I receive [game loop tick v]\nif <touching (mouse-pointer v)?> then\n    set size to (70) %\nelse\n    set size to (60) %\nend\nset [ghost v] effect to (30)\n\nwhen this sprite clicked\nif <(geht es?) = [0]> then\n    stop all sounds\n    next costume\n    set [geht es? v] to [1]\nelse\n    if <(geht es?) = [1]> then\n        set [geht es? v] to [0]\n        next costume\n        start sound [langsam v]\n    end\nend\n\nwhen I receive [dend v]\nstop all sounds\nhide\n\n@Checkpunkt\n\ndefine setup clone at x,y: (x) (y)\ngo to x: (0) y: (0)\nset [color v] effect to (4)\nhide\nset [showing v] to [0]\nset [x v] to (x)\nset [y v] to (y)\nchange [@totalflags v] by (1)\ncreate clone of (_myself_ v)\n\nwhen I receive [game loop tick v]\nif <(showing) > [-1]> then\n    position (round ((x) - (@Scroll X))) (round ((y) - (@Scroll Y)))\n    if <(showing) > [25]> then\n        delete this clone\n    end\nend\n\nwhen I receive [setup level v]\nswitch costume to (hitbox v)\nsetup clone at x,y: (1900) (-49)\nsetup clone at x,y: (4400) (-45)\nsetup clone at x,y: (5930) (-49)\nsetup clone at x,y: (7100) (-45)\nsetup clone at x,y: (10639) (0)\n\ndefine on screen\nif <((@timer) mod (5)) = [0]> then\n    next costume\nend\nif <touching (spiel v)?> then\n    set [showing v] to [2]\n    set [@spawn x v] to (x)\n    set [@spawn y v] to (y)\n    change [@totalflags v] by (-1)\n    start sound [Magic Spell v]\nend\n\ndefine position (x) (y)\ngo to x: (x) y: (y)\nif <(showing) < [2]> then\n    if <<(x) = (x position)> and <(y) = (y position)>> then\n        if <(showing) = [0]> then\n            set [showing v] to [1]\n            show\n        end\n        on screen\n    else\n        if <(showing) = [1]> then\n            set [showing v] to [0]\n            hide\n        end\n    end\nelse\n    set size to ((size) + (15)) %\n    change [ghost v] effect by (4)\n    change [y v] by (5)\n    change [showing v] by (1)\nend\n\nwhen flag clicked\nset size to (100) %\nswitch costume to (hitbox v)\n\n@Münzen\n\ndefine setup clone at x,y: (x) (y)\ngo to x: (0) y: (0)\nhide\nset [showing v] to [0]\nset [x v] to (x)\nset [y v] to (y)\nchange [@totalflags v] by (1)\ncreate clone of (_myself_ v)\n\nwhen I receive [game loop tick v]\nif <(showing) > [-1]> then\n    position (round ((x) - (@Scroll X))) (round ((y) - (@Scroll Y)))\n    if <(showing) > [25]> then\n        delete this clone\n    end\nend\nif <(Coins) > [15]> then\n    set [genug coins um zu öffnen? v] to [14]\nend\n\nwhen I receive [setup level v]\nswitch costume to (l1 x0 y0 v)\nsetup clone at x,y: (100) (-30)\nsetup clone at x,y: (200) (-30)\nsetup clone at x,y: (300) (-30)\nsetup clone at x,y: (1000) (-30)\nsetup clone at x,y: (1500) (-70)\nsetup clone at x,y: (2500) (50)\nsetup clone at x,y: (3468) (-10)\nsetup clone at x,y: (4750) (160)\nsetup clone at x,y: (5480) (120)\nsetup clone at x,y: (5480) (-30)\nsetup clone at x,y: (5580) (-30)\nsetup clone at x,y: (6600) (80)\nsetup clone at x,y: (6700) (80)\nsetup clone at x,y: (6800) (80)\nsetup clone at x,y: (8777) (140)\nsetup clone at x,y: (9637) (105)\nsetup clone at x,y: (9737) (105)\nsetup clone at x,y: (10038) (170)\nsetup clone at x,y: (10137) (170)\n\ndefine on screen\nif <((@timer) mod (3)) = [0]> then\n    next costume\nend\nif <touching (spiel v)?> then\n    start sound [Collect v]\n    set [showing v] to [2]\n    broadcast (Coin v)\n    change [coins v] by (1)\nend\n\ndefine position (x) (y)\ngo to x: (x) y: (y)\nif <(showing) < [2]> then\n    if <<(x) = (x position)> and <(y) = (y position)>> then\n        if <(showing) = [0]> then\n            set [showing v] to [1]\n            show\n        end\n        on screen\n    else\n        if <(showing) = [1]> then\n            set [showing v] to [0]\n            hide\n        end\n    end\nelse\n    switch costume to (kostüm1 v)\n    set size to ((size) + (15)) %\n    change [ghost v] effect by (4)\n    change [y v] by (5)\n    change [showing v] by (1)\nend\n\nwhen flag clicked\nset size to (100) %\nset [coins v] to [0]\nset [genug coins um zu öffnen? v] to [0]\n\n@Spikes\n\ndefine setup clone at x,y: (x) (y) (c)\ngo to x: (0) y: (0)\nswitch costume to (c)\nhide\nset [showing v] to [0]\nset [x v] to (x)\nset [y v] to (y)\nchange [@totalflags v] by (1)\ncreate clone of (_myself_ v)\n\nwhen I receive [game loop tick v]\nif <(showing) > [-1]> then\n    position (round ((x) - (@Scroll X))) (round ((y) - (@Scroll Y)))\n    if <(showing) > [25]> then\n        delete this clone\n    end\nend\n\nwhen I receive [setup level v]\nswitch costume to (l1 x0 y0 v)\nsetup clone at x,y: (1000) (-66) [1]\nsetup clone at x,y: (2550) (46) [1]\nsetup clone at x,y: (2600) (46) [1]\nsetup clone at x,y: (2780) (90) [2]\nsetup clone at x,y: (2850) (46) [1]\nsetup clone at x,y: (3170) (46) [1]\nsetup clone at x,y: (6600) (47) [1]\nsetup clone at x,y: (6700) (47) [1]\nsetup clone at x,y: (6850) (47) [1]\nsetup clone at x,y: [8727] [128] [1]\nsetup clone at x,y: [8827] [128] [1]\nsetup clone at x,y: [9993] [145] [1]\nsetup clone at x,y: [10093] [145] [1]\nsetup clone at x,y: [10193] [145] [1]\nsetup clone at x,y: [10230] [145] [1]\n\ndefine on screen\nif <((@timer) mod (5)) = [0]> then\nif <touching (spiel v)?> then\n    set [lastdie v] to [0]\nend\n\ndefine position (x) (y)\ngo to x: (x) y: (y)\nif <(showing) < [2]> then\n    if <<(x) = (x position)> and <(y) = (y position)>> then\n        if <(showing) = [0]> then\n            set [showing v] to [1]\n            show\n        end\n        on screen\n    else\n        if <(showing) = [1]> then\n            set [showing v] to [0]\n            hide\n        end\n    end\nelse\n    set size to ((size) + (15)) %\n    change [ghost v] effect by (4)\n    change [y v] by (5)\n    change [showing v] by (1)\nend\n\n@Zähler\n\nwhen flag clicked\nshow\nswitch costume to (0 v)\n\nwhen I receive [coin v]\nnext costume\n\nwhen I receive [dend v]\nhide\n\n@Anzeige\n\nwhen flag clicked\nshow\n\nwhen I receive [dend v]\nhide\n\n@Anzeige 2\n\nwhen flag clicked\nshow\n\nwhen I receive [dend v]\nhide\n\n@Confetti\n\nwhen flag clicked\nhide\n\nwhen I start as a clone\nshow\nset size to (pick random (18) to (40)) %\ngo to [back v] layer\nset y to (220)\nset x to (pick random (-220) to (220))\nrepeat (50)\n    change y by (-8)\n    next costume\n    change [color v] effect by (pick random (1) to (4))\n    turn right (pick random (-10) to (10)) degrees\nend\ndelete this clone\n\nwhen I receive [dend v]\nforever\n    create clone of (_myself_ v)\nend\n\n@Deko\n\nwhen I receive [setup level v]\nset [cost v] to [1]\nset [counter v] to [0]\nsetup clone at x,y: (0) (0)\n\ndefine setup clone at x,y: (x) (y)\nswitch costume to (1 1 v)\nset [temp v] to [0]\nrepeat (17)\n    go to x: (0) y: (0)\n    hide\n    set [showing v] to [0]\n    set [x v] to (round ((temp) * (460)))\n    set [y v] to [0]\n    create clone of (_myself_ v)\n    next costume\n    next costume\n    change [cost v] by (2)\n    change [temp v] by (1)\nend\nhide\n\ndefine position (x) (y)\ngo to x: (x) y: (y)\nif <<(x) = (x position)> and <(y) = (y position)>> then\n    if <(showing) = [0]> then\n        set [showing v] to [1]\n        show\n    end\nelse\n    if <(showing) = [1]> then\n        set [showing v] to [0]\n        hide\n    end\nend\n\nwhen I receive [game loop tick v]\ngo to [back v] layer\ngo [backward v] (1) layers\nif <(showing) > [-1]> then\n    position (round ((x) - (@Scroll X))) (round ((y) - (@Scroll Y)))\nend\nif <((@timer) mod (20)) = [1]> then\n    set [switch v] to ((switch) * (-1))\nend\nif <(switch) = [1]> then\n    switch costume to (cost)\nelse\n    switch costume to ((cost) + (1))\nend\n\n@Gitterstäbe\n\ndefine setup clone at x,y: (x) (y) (c)\ngo to x: (0) y: (0)\nswitch costume to (c)\nhide\nset [showing v] to [0]\nset [x v] to (x)\nset [y v] to (y)\nchange [@totalflags v] by (1)\ncreate clone of (_myself_ v)\n\nwhen I receive [game loop tick v]\ngo to [back v] layer\nif <(showing) > [-1]> then\n    position (round ((x) - (@Scroll X))) (round ((y) - (@Scroll Y)))\n    if <(showing) > [25]> then\n        delete this clone\n    end\nend\n\nwhen I receive [setup level v]\nswitch costume to (l1 x0 y0 v)\nsetup clone at x,y: (7300) (-50) [1]\n\ndefine on screen\nif <((@timer) mod (5)) = [0]> then\nif <(Genug coins um zu öffnen?) = [0]> then\n    set [showing v] to [2]\nend\nif <touching (spieler v)?> then\n    say [You have to collect all coins to open this.]\nend\n\ndefine position (x) (y)\ngo to x: (x) y: (y)\nif <(showing) < [2]> then\n    if <<(x) = (x position)> and <(y) = (y position)>> then\n        if <(showing) = [0]> then\n            set [showing v] to [1]\n            show\n        end\n        on screen\n    else\n        if <(showing) = [1]> then\n            set [showing v] to [0]\n            hide\n        end\n    end\nelse\n    hide\nend\n\nwhen flag clicked\nset size to (80) %\n\n@thumbnail2\n\nwhen flag clicked\nset [ghost v] effect to (100)\ngo to [front v] layer\n\n@Sprite2\n\nwhen flag clicked\nhide\n\nwhen I receive [dend v]\nshow\nset [brightness v] effect to (0)\nswitch costume to (costume10 v)\nwait (0.8) seconds\nrepeat (11)\n    wait (4) seconds\n    repeat (2)\n        change [brightness v] effect by (30)\n    end\n    next costume\n    set [brightness v] effect to (0)\nend\nbroadcast (message1 v)\n\nwhen I receive [dend v]\nplay sound [TheFatRat - Time Lapse v] until done\n\n