Cat Blocks: The Platformer

Instructions: Press Space for next slide.\nHelp the "when flag clicked" cat block save the other cat blocks from being deleted from the Scratch block database! Use the arrow keys to guide him around and avoid obstacles in order to save the other cat blocks. The Cat Blocks are counting on you!

@Stage\n\nwhen I receive [cat block 2 saved! v]\nswitch backdrop to (backdrop29 v)\n\nwhen flag clicked\nswitch backdrop to (backdrop1 v)\nwait until <key (space v) pressed?>\nswitch backdrop to (backdrop2 v)\nwait until <not <key (space v) pressed?>>\nwait until <key (space v) pressed?>\nswitch backdrop to (backdrop3 v)\nwait until <not <key (space v) pressed?>>\nwait until <key (space v) pressed?>\nswitch backdrop to (backdrop4 v)\nbroadcast (message1 v)\n\nwhen flag clicked\nforever\n    if <not <(Cut scene going on?) = [1]>> then\n        play sound [2019-05-03_-_Snap_Along_-_David_Fesliyan v] until done\n    end\nend\n\nwhen I receive [message2 v]\nswitch backdrop to (backdrop5 v)\n\nwhen I receive [level 1 v]\nswitch backdrop to (backdrop6 v)\n\nwhen flag clicked\nset [level in play? v] to [0]\nset [cut scene going on? v] to [0]\n\nwhen I receive [cat block 1 saved! v]\nswitch backdrop to (backdrop16 v)\n\nwhen I receive [message 3 v]\nswitch backdrop to (backdrop27 v)\nwait until <key (space v) pressed?>\nbroadcast (message2 v)\n\nwhen I receive [level 2 v]\nswitch backdrop to (backdrop17 v)\n\n@Sprite2\n\nwhen flag clicked\nhide\ngo to x: (-163) y: (54)\n\nwhen I receive [message2 v]\nshow\n\nwhen this sprite clicked\nset [level in play? v] to [1]\nbroadcast (Level 1 v)\n\nwhen I receive [level 1 v]\nhide\n\nwhen I receive [level 2 v]\nhide\n\n@Sprite3\n\nwhen flag clicked\nhide\ngo to x: (-82) y: (54)\nset [level 2 locked? v] to [1]\n\nwhen I receive [message2 v]\nif <(Level 2 locked?) = [0]> then\n    switch costume to (costume1 v)\nelse\n    switch costume to (costume2 v)\nend\nshow\n\nwhen I receive [level 1 v]\nhide\n\nwhen this sprite clicked\nif <(costume [number v]) = [1]> then\n    broadcast (Level 2 v)\n    set [level in play? v] to [1]\nend\n\nwhen I receive [level 2 v]\nhide\n\n@Sprite4\n\nwhen flag clicked\nhide\ngo to x: (0) y: (54)\n\nwhen I receive [message2 v]\nswitch costume to (costume2 v)\nshow\n\nwhen I receive [level 1 v]\nhide\n\nwhen I receive [level 2 v]\nhide\n\n@Sprite5\n\nwhen flag clicked\nhide\ngo to x: (82) y: (54)\n\nwhen I receive [message2 v]\nswitch costume to (costume2 v)\nshow\n\nwhen I receive [level 1 v]\nhide\n\nwhen I receive [level 2 v]\nhide\n\n@Sprite11\n\nwhen flag clicked\nhide\ngo to x: (163) y: (54)\n\nwhen I receive [message2 v]\nswitch costume to (costume2 v)\nshow\n\nwhen I receive [level 1 v]\nhide\n\nwhen I receive [level 2 v]\nhide\n\n@Sprite6\n\nwhen flag clicked\nhide\ngo to x: (-163) y: (-58)\n\nwhen I receive [message2 v]\nswitch costume to (costume2 v)\nshow\n\nwhen I receive [level 1 v]\nhide\n\nwhen I receive [level 2 v]\nhide\n\n@Sprite7\n\nwhen flag clicked\nhide\ngo to x: (-82) y: (-58)\n\nwhen I receive [message2 v]\nswitch costume to (costume2 v)\nshow\n\nwhen I receive [level 1 v]\nhide\n\nwhen I receive [level 2 v]\nhide\n\n@Sprite8\n\nwhen flag clicked\nhide\ngo to x: (0) y: (-58)\n\nwhen I receive [message2 v]\nswitch costume to (costume2 v)\nshow\n\nwhen I receive [level 1 v]\nhide\n\nwhen I receive [level 2 v]\nhide\n\n@Sprite9\n\nwhen flag clicked\nhide\ngo to x: (82) y: (-58)\n\nwhen I receive [message2 v]\nswitch costume to (costume2 v)\nshow\n\nwhen I receive [level 1 v]\nhide\n\nwhen I receive [level 2 v]\nhide\n\n@Sprite10\n\nwhen flag clicked\nhide\ngo to x: (163) y: (-58)\n\nwhen I receive [message2 v]\nswitch costume to (costume2 v)\nshow\n\nwhen I receive [level 1 v]\nhide\n\nwhen I receive [level 2 v]\nhide\n\n@Sprite12\n\nwhen flag clicked\nhide\ngo to x: (0) y: (-127)\n\nwhen I receive [message1 v]\nshow\n\nwhen this sprite clicked\nbroadcast (message2 v)\nhide\n\n@Cat Block\n\ndefine Platformer engine\nif <not <<<<(backdrop [number v]) = [15]> or <(backdrop [number v]) = [16]>> or <(backdrop [number v]) = [26]>> or <(backdrop [number v]) = [29]>>> then\n    change [y v] by (-0.5)\n    if <key (left arrow v) pressed?> then\n        change [x v] by (-1)\n    end\n    if <key (right arrow v) pressed?> then\n        change [x v] by (1)\n    end\n    set [x v] to ((x) * (0.9))\n    change x by (x)\n    if <touching color (#000000)?> then\n        change y by (1)\n        if <touching color (#000000)?> then\n            change y by (1)\n            if <touching color (#000000)?> then\n                change y by (1)\n                if <touching color (#000000)?> then\n                    change y by (1)\n                    if <touching color (#000000)?> then\n                        change y by (1)\n                        if <touching color (#000000)?> then\n                            change y by (1)\n                            if <touching color (#000000)?> then\n                                change y by (-6)\n                                change x by ((x) * (-1))\n                                if <key (up arrow v) pressed?> then\n                                    set [y v] to [10]\n                                    if <(x) > [0]> then\n                                        set [x v] to [-10]\n                                    else\n                                        set [x v] to [10]\n                                    end\n                                else\n                                    set [x v] to [0]\n                                end\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\n    change y by (y)\n    if <touching color (#000000)?> then\n        change y by ((y) * (-1))\n        set [y v] to [0]\n    end\n    change y by (-0.5)\n    if <<touching color (#000000)?> and <key (up arrow v) pressed?>> then\n        set [y v] to [10]\n    end\n    change y by (0.5)\n    if <touching color (#ff0000)?> then\n        Restart\n    end\n    if <touching color (#0035ff)?> then\n        set [y v] to [16]\n    end\nend\n\nwhen flag clicked\nhide\n\nwhen I receive [level 1 v]\nshow\ngo to x: (X Spawn) y: (Y Spawn)\nrepeat until <(Level in play?) = [0]>\n    Platformer engine\nend\n\nwhen flag clicked\nforever\n    set [x spawn v] to [-182]\n    set [y spawn v] to [-83]\nend\n\nwhen flag clicked\nforever\n    point in direction (90)\nend\n\nwhen I receive [level 1 v]\nrepeat until <(Level in play?) = [0]>\n    Platformer Engine 2\nend\n\ndefine Platformer Engine 2\nif <(x position) > [225]> then\n    go to x: (X Spawn) y: (Y Spawn)\n    next backdrop\nend\nif <touching (sprite13 v)?> then\n    Restart\nend\nif <touching (cat v)?> then\n    Restart\nend\n\nwhen backdrop switches to [backdrop15 v]\ngo to x: (X Spawn) y: (Y Spawn)\nglide (1) secs to x: (-101) y: (-83)\nrepeat until <touching color (#000000)?>\n    change y by (-1)\nend\n\nwhen I receive [message 3 v]\nhide\n\nwhen I receive [message2 v]\nhide\n\nwhen I receive [level 2 v]\nrepeat until <(Level in play?) = [0]>\n    Platformer Engine 2\nend\n\nwhen I receive [level 2 v]\nshow\ngo to x: (X Spawn) y: (Y Spawn)\nrepeat until <(Level in play?) = [0]>\n    Platformer engine\nend\n\nwhen backdrop switches to [backdrop26 v]\ngo to x: (X Spawn) y: (Y Spawn)\nglide (1) secs to x: (-101) y: (-83)\nrepeat until <touching color (#000000)?>\n    change y by (-1)\nend\n\ndefine Restart\nset [current backdrop v] to (backdrop [number v])\nswitch backdrop to (backdrop28 v)\nswitch backdrop to (Current Backdrop)\ngo to x: (X Spawn) y: (Y Spawn)\n\nwhen [r v] key pressed\nRestart\n\n@Sprite13\n\nwhen flag clicked\nhide\n\nwhen backdrop switches to [backdrop8 v]\ngo to x: (2) y: (-99)\nswitch costume to (costume1 v)\nshow\n\nwhen backdrop switches to [backdrop9 v]\nswitch costume to (costume2 v)\n\nwhen backdrop switches to [backdrop10 v]\nhide\n\nwhen backdrop switches to [backdrop11 v]\nswitch costume to (costume4 v)\nshow\n\nwhen backdrop switches to [backdrop12 v]\nswitch costume to (costume3 v)\nshow\n\nwhen backdrop switches to [backdrop13 v]\nhide\n\nwhen backdrop switches to [backdrop14 v]\nswitch costume to (costume5 v)\nshow\n\nwhen backdrop switches to [backdrop15 v]\nhide\n\n@Sprite14\n\nwhen flag clicked\nhide\n\nwhen backdrop switches to [backdrop15 v]\nswitch costume to (costume2 v)\ngo to x: (115) y: (-70)\nshow\nwait until <key (space v) pressed?>\nbroadcast (Cat Block 1 Saved! v)\nset [cut scene going on? v] to [1]\n\n\n\nrepeat until <touching color (#000000)?>\n    change y by (-1)\nend\n\nwhen I receive [cat block 1 saved! v]\nswitch costume to (costume1 v)\ngo to x: (115) y: (-87)\nstop all sounds\nstart sound [Cheer v]\nglide (1) secs to x: (36) y: (-87)\nbroadcast (Cat Block 1 Saved 2 v)\n\nwhen I receive [message 3 v]\nhide\n\nwhen I receive [message2 v]\nhide\n\nwhen backdrop switches to [backdrop26 v]\nswitch costume to (cat block 3 v)\ngo to x: (129) y: (-49)\nshow\nwait until <<<touching (mouse-pointer v)?> and <mouse down?>> and <(backdrop [number v]) = [26]>>\nbroadcast (Cat Block 2 Saved! v)\nset [cut scene going on? v] to [1]\n\nwhen I receive [cat block 2 saved! v]\nswitch costume to (cat block 2 v)\ngo to x: (115) y: (-85)\nstop all sounds\nstart sound [Cheer v]\nglide (1) secs to x: (36) y: (-85)\nbroadcast (Cat Block 2 Saved 2 v)\n\n@Sprite15\n\nwhen flag clicked\nhide\n\nwhen I receive [cat block 1 saved 2 v]\nswitch costume to (costume1 v)\nshow\nstart sound [Triumph v]\npoint in direction (90)\ngo to x: (0) y: (0)\nset size to (0) %\nrepeat (100)\n    turn right (7.2) degrees\n    change size by (1)\nend\nwait (2) seconds\nset [cut scene going on? v] to [0]\nset [level in play? v] to [0]\nset [level 2 locked? v] to [0]\nbroadcast (message2 v)\nhide\n\nwhen I receive [cat block 2 saved 2 v]\nswitch costume to (costume2 v)\nshow\nstart sound [Triumph v]\npoint in direction (90)\ngo to x: (0) y: (0)\nset size to (0) %\nrepeat (100)\n    turn right (7.2) degrees\n    change size by (1)\nend\nwait (2) seconds\nset [cut scene going on? v] to [0]\nset [level in play? v] to [0]\nset [level 2 locked? v] to [0]\nbroadcast (message2 v)\nhide\n\n@Cat\n\nwhen flag clicked\nhide\nset rotation style [left-right v]\nset y to (-63)\n\nwhen backdrop switches to [backdrop18 v]\ngo to x: (185) y: (-63)\nshow\nrepeat until <(backdrop [number v]) = [19]>\n    Enemy Engine\nend\n\ndefine Enemy Engine\nmove (1) steps\nif on edge, bounce\nif <(Bumped into something) = [1]> then\n    point in direction ((direction) * (-1))\n    repeat until <(Bumped into something) = [0]>\n        move (1) steps\n    end\nend\n\nwhen backdrop switches to [backdrop19 v]\ngo to x: (185) y: (-63)\nshow\nrepeat until <(backdrop [number v]) = [20]>\n    Enemy Engine\nend\n\nwhen I receive [message v]\nhide\n\nwhen backdrop switches to [backdrop20 v]\npoint in direction (-90)\ngo to x: (185) y: (-63)\nshow\n\nwhen backdrop switches to [backdrop21 v]\npoint in direction (-90)\ngo to x: (83) y: (87)\nshow\n\n@Sprite16\n\nwhen flag clicked\nset [ghost v] effect to (100)\nshow\nforever\n    go to (cat v)\nend\n\nwhen flag clicked\nforever\n    if <touching color (#000000)?> then\n        set [bumped into something v] to [1]\n    else\n        set [bumped into something v] to [0]\n    end\nend\n\n@Sprite17\n\nwhen flag clicked\nset [i can shoot lasers now! v] to [0]\nhide\nset size to (50) %\n\nwhen backdrop switches to [backdrop19 v]\nset [i can shoot lasers now! v] to [0]\nshow\ngo to x: (0) y: (20)\nrepeat until <(backdrop [number v]) = [20]>\n    Laser Powerup Engine\nend\n\ndefine Laser Powerup Engine\nif <touching (cat block v)?> then\n    hide\n    start sound [Teleport2 v]\n    set [i can shoot lasers now! v] to [1]\nend\n\nwhen backdrop switches to [backdrop20 v]\nset [i can shoot lasers now! v] to [0]\nshow\ngo to x: (125) y: (152)\nrepeat until <(backdrop [number v]) = [21]>\n    Laser Powerup Engine\nend\n\nwhen backdrop switches to [backdrop21 v]\nset [i can shoot lasers now! v] to [0]\nshow\ngo to x: (83) y: (162)\nrepeat until <(backdrop [number v]) = [22]>\n    Laser Powerup Engine\nend\n\nwhen backdrop switches to [backdrop22 v]\nset [i can shoot lasers now! v] to [0]\n\n@Sprite18\n\nwhen flag clicked\nhide\nforever\n    if <(I can shoot lasers now!) = [1]> then\n        if <key (space v) pressed?> then\n            create clone of (_myself_ v)\n            wait until <not <key (space v) pressed?>>\n        end\n    end\nend\n\nwhen I start as a clone\nset size to (500) %\ngo to (cat block v)\npoint towards (cat v)\nshow\nset [ghost v] effect to (0)\nstart sound [Teleport2 v]\nrepeat until <<touching (_edge_ v)?> or <<touching color (#000000)?> or <<touching (sprite12 v)?> or <<touching (cat v)?> or <<touching color (#ff0000)?> or <touching color (#0035ff)?>>>>>>\n    move (5) steps\nend\nif <touching (cat v)?> then\n    broadcast (Message v)\nend\ndelete this clone\n\nwhen I start as a clone\nwait until <(backdrop [number v]) = [28]>\ndelete this clone\n\n