Mars Platformer
@Stage\n\n@Player\n\nwhen flag clicked\nswitch backdrop to (backdrop1 v)\nswitch costume to (kostüm2 v)\nReset Player Position\nset [force walk v] to [3]\nset [force gravity v] to [-1.5]\nset [force jump v] to [17]\nset [player speed x v] to [0]\nforever\n    Check Player Gravity\n    Check Player Walk\n    Check Player Touching\nend\n\ndefine move out (dx) (dy)\nrepeat until <not <touching color (#ff0000)?>>\n    change x by (dx)\n    change y by (dy)\nend\n\ndefine Check Player Gravity\nchange [player speed y v] by (FORCE GRAVITY)\nchange y by (Player Speed Y)\nif <touching color (#ff0000)?> then\n    if <(Player Speed Y) > [0]> then\n        move out [0] [-1]\n        set [player speed y v] to [0]\n    else\n        move out [0] [1]\n        if <key (up arrow v) pressed?> then\n            set [player speed y v] to (FORCE JUMP)\n        else\n            set [player speed y v] to [0]\n        end\n    end\nend\n\ndefine Check Player Walk\nset size to (300) %\nset rotation style [left-right v]\nif <key (left arrow v) pressed?> then\n    point in direction (-90)\n    change [player speed x v] by ((-1) * (FORCE WALK))\nend\nif <key (right arrow v) pressed?> then\n    change [player speed x v] by ((1) * (FORCE WALK))\n    point in direction (90)\nend\nset [player speed x v] to ((Player Speed X) * (0.7))\nchange x by (Player Speed X)\nif <(Player Speed X) > [0]> then\n    move out [-1] [0]\nelse\n    move out [1] [0]\nend\n\ndefine Check Player Touching\nif <touching color (#f2ff00)?> then\n    broadcast (Complete level v) and wait\n    Reset Player Position\n    next backdrop\nend\nif <touching color (#7971ff)?> then\n    set [player speed y v] to [24]\nend\nif <touching color (#b9b9b9)?> then\n    repeat (10)\n        change [ghost v] effect by (10)\n    end\n    Reset Player Position\nend\n\ndefine Reset Player Position\nclear graphic effects\ngo to x: (-200) y: (-10)\n\n@Collectable\n\nwhen backdrop switches to [backdrop2 v]\nshow\ngo to x: (-22) y: (78)\n\nwhen flag clicked\nhide\nforever\n    change [color v] effect by (3)\n    if <touching (player v)?> then\n        hide\n    end\nend\n\nwhen I receive [complete level v]\nhide\n\nwhen backdrop switches to [backdrop3 v]\nshow\ngo to x: (-179) y: (77)\n\n
Follow @l_ecureuil !!\nhttps://scratch.mit.edu/projects/461094909/#comments-173518415