Land || A Platformer
@Stage\n\nwhen flag clicked\nforever\n    play sound [Heaven and Hell - Jeremy Blake v] until done\nend\n\n@Player\n\nwhen flag clicked\nset [level v] to [1]\nRestart\nset [ghost v] effect to (0)\nshow\nforever\n    Physics\nend\n\ndefine Restart\nset [x v] to [0]\nset [y v] to [0]\ngo to x: (-200) y: (0)\n\nwhen [timer v] > (0.1)\nhide\n\ndefine Slope Detection\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 <touching (level v)?> then\n    change y by (-8)\nend\n\ndefine Physics\nif <<key (right arrow v) pressed?> or <<key (d v) pressed?> or <<mouse down?> and <(mouse x) > (x position)>>>> then\n    change [x v] by (2)\nend\nif <<key (left arrow v) pressed?> or <<key (a v) pressed?> or <<mouse down?> and <(mouse x) < (x position)>>>> then\n    change [x v] by (-2)\nend\nchange x by (x)\nSlope Detection\nif <touching (level v)?> then\n    change x by ((x) * (-1))\n    if <<key (up arrow v) pressed?> or <<key (w v) pressed?> or <<mouse down?> and <(mouse y) > (y position)>>>> then\n        if <(x) > [0]> then\n            set [x v] to [-15]\n            set [y v] to [10]\n        else\n            set [x v] to [15]\n            set [y v] to [10]\n        end\n    else\n        set [x v] to [0]\n    end\nelse\n    set [x v] to ((x) * (0.8))\nend\nchange y by (y)\nif <touching (level v)?> then\n    change y by ((y) * (-1))\n    set [y v] to [0]\n    if <<key (up arrow v) pressed?> or <<key (w v) pressed?> or <<mouse down?> and <(mouse y) > (y position)>>>> then\n        if <(Jumping?) = [y]> then\n            set [y v] to [12]\n            set [jumping? v] to [n]\n        end\n    end\nelse\n    change [y v] by (-1)\n    set [jumping? v] to [y]\nend\nif <(x position) > [225]> then\n    change [level v] by (1)\n    Restart\n    broadcast (Reset Enemy v)\nend\nif <touching (enemy v)?> then\n    Restart\n    broadcast (Reset Enemy v)\nend\n\nwhen I receive [4 v]\nrepeat (10)\n    change [ghost v] effect by (10)\nend\n\nwhen I receive [reset enemy v]\nRestart\n\n@Level\n\nwhen [timer v] > (0.1)\nhide\n\nwhen flag clicked\ngo to x: (0) y: (0)\nswitch costume to (costume1 v)\nshow\nforever\n    switch costume to (Level)\nend\n\nwhen flag clicked\nwait until <(Level) = [2]>\nbroadcast (2 v)\n\nwhen I receive [3 v]\nswitch costume to (costume3 v)\n\nwhen flag clicked\nwait until <(costume [number v]) = [22]>\nswitch costume to (costume21 v)\nbroadcast (4 v)\nforever\n    glide (1) secs to x: (0) y: (10)\n    glide (1) secs to x: (0) y: (-10)\nend\n\n@Thumbnail\n\nwhen flag clicked\nhide\nforever\n    reset timer\nend\n\nwhen [timer v] > (0.1)\nshow\n\n@Enemy\n\nwhen flag clicked\nset [ghost v] effect to (0)\nRestart\nshow\nforever\n    Physics\nend\n\ndefine Restart\nset [enemy x v] to [0]\nset [enemy y v] to [0]\ngo to x: (120) y: (120)\n\nwhen [timer v] > (0.1)\nhide\n\ndefine Slope Detection\nset [enemy slope v] to [0]\nrepeat until <<(Enemy Slope) = [8]> or <not <touching (level v)?>>>\n    change y by (1)\n    change [enemy slope v] by (1)\nend\nif <touching (level v)?> then\n    change y by (-8)\nend\n\ndefine Physics\nif <(x position) < ([x position v] of [player v])> then\n    change [enemy x v] by (1)\nend\nif <([x position v] of [player v]) < (x position)> then\n    change [enemy x v] by (-1)\nend\nchange x by (Enemy x)\nSlope Detection\nif <touching (level v)?> then\n    change x by ((Enemy x) * (-1))\n    if <(y position) < ([y position v] of [player v])> then\n        if <(Enemy x) > [0]> then\n            set [enemy x v] to [-10]\n            set [enemy y v] to [10]\n        else\n            set [enemy x v] to [-10]\n            set [enemy y v] to [10]\n        end\n    else\n        set [enemy x v] to [0]\n    end\nelse\n    set [enemy x v] to ((Enemy x) * (0.8))\nend\nchange y by (Enemy y)\nif <touching (level v)?> then\n    change y by ((Enemy y) * (-1))\n    set [enemy y v] to [0]\n    if <((y position) - (25)) < ([y position v] of [player v])> then\n        if <(Enemy Jumping?) = [y]> then\n            set [enemy y v] to [12]\n            set [enemy jumping? v] to [n]\n        end\n    end\nelse\n    change [enemy y v] by (-1)\n    set [enemy jumping? v] to [y]\nend\n\nwhen I receive [reset enemy v]\nRestart\n\nwhen I receive [4 v]\nrepeat (10)\n    change [ghost v] effect by (10)\nend\n\n@Sprite1\n\nwhen flag clicked\nset [pressed button v] to [0]\nset size to (100) %\nset [ghost v] effect to (0)\ngo to x: (190) y: (-146)\ngo to [front v] layer\nshow\n\nwhen [timer v] > (0.1)\nhide\n\nwhen this sprite clicked\nstart sound [Crank v]\nrepeat (2)\n    change size by (15)\nend\nrepeat (2)\n    change size by (-15)\nend\nchange [level v] by (1)\nchange [pressed button v] by (1)\nbroadcast (Reset Enemy v)\n\nwhen I receive [1 v]\nrepeat (10)\n    change [ghost v] effect by (10)\nend\nhide\n\nwhen I receive [4 v]\nstop [other scripts in sprite v]\n\n@Sprite2\n\nwhen flag clicked\nhide\n\nwhen [timer v] > (0.1)\nhide\n\nwhen this sprite clicked\nif <(Level) = [1]> then\n    broadcast (3 v)\nelse\n    start sound [Crank v]\n    repeat (2)\n        change size by (15)\n    end\n    repeat (2)\n        change size by (-15)\n    end\n    change [level v] by (-1)\n    broadcast (Reset Enemy v)\nend\n\nwhen I receive [1 v]\nrepeat (10)\n    change [ghost v] effect by (10)\nend\nhide\n\nwhen I receive [2 v]\nset [ghost effect v] to [100]\nshow\nset size to (100) %\ngo to x: (-190) y: (-146)\nshow\ngo to [front v] layer\nrepeat (10)\n    change [ghost v] effect by (-10)\nend\n\nwhen flag clicked\nset [ghost v] effect to (Ghost effect)\n\nwhen I receive [3 v]\nshow\ngo to [front v] layer\nset [ghost v] effect to (100)\nrepeat (10)\n    change [ghost v] effect by (-10)\nend\n\nwhen I receive [4 v]\nstop [other scripts in sprite v]\n\n
* curated by @theleapingleopard on 27th October *\nIt would mean a lot if someone suggested this to be featured . You can do that here : https://scratch.mit.edu/studios/4228481/comments/\n\nWhen i came back on Scratch i was shocked to see that land Platformer got in the trash :( it may not be a hack but why would i put my own Platformer in the trash?\nOrignal date : 24 September 2020 