Mobile Platformer Engine!  #games #platformer #engine

Instructions: Welcome To My Mobile Platformer Engine!\n\nThis includes: Mobile Controsl,Wall,Slope and ceiling detection,Lava,Spikes and A smooth ducking sequence!!!\n\nRemix or give credit if you use it!\n\nCredits:\nInspired by @--AwesomeCode--\nTutorial By @Griffpatch\nRest by me!\n\n#games #platformer #engine

@Stage\n\nwhen flag clicked\nforever\n    switch backdrop to (Level)\nend\n\n@Player\n\nwhen flag clicked\nshow\ngo to x: (-200) y: (0)\nset [speed y v] to [0]\nforever\n    change [speed y v] by (-1)\n    set [speed x v] to ((Speed X) * (0.8))\n    change y by (Speed Y)\n    Touch ground <(Speed Y) > [0]>\n    if <(Walljump) > [0]> then\n        change [walljump v] by (-1.)\n    else\n        if <<key (d v) pressed?> or <<key (right arrow v) pressed?> or <<mouse down?> and <(x position) < (mouse x)>>>> then\n            change [speed x v] by (1.5)\n        end\n        if <<key (a v) pressed?> or <<key (left arrow v) pressed?> or <<mouse down?> and <(mouse x) < (x position)>>>> then\n            change [speed x v] by (-1.5)\n        end\n    end\n    if <<<key (w v) pressed?> or <<key (up arrow v) pressed?> or <<mouse down?> and <(y position) < (mouse y)>>>> and <(falling?) < [3]>> then\n        set [speed y v] to [15]\n    end\n    if <(Speed X) < [-0.5]> then\n        Walk [5] (Speed X)\n    else\n        if <[0.5] < (Speed X)> then\n            Walk [5] (Speed X)\n        end\n    end\nend\n\ndefine Touch ground <up?>\nchange [falling? v] by (1)\nrepeat until <not <touching (ground 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 (x) (speed)\nchange x by (speed)\nset [slope v] to [0]\nrepeat until <<(slope) = [8]> or <not <touching (ground 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))\n    if <<<key (w v) pressed?> or <<key (up arrow v) pressed?> or <<mouse down?> and <(y position) < (mouse y)>>>> and <([abs v] of (speed) ) > [3]>> then\n        if <(Walljump) = [0]> then\n            set [speed x v] to ((-2) * (speed))\n            set [speed y v] to [11]\n            set [falling? v] to [6]\n        else\n            set [speed x v] to [0]\n        end\n    end\nend\n\nwhen flag clicked\nforever\n    if <<[230] < (x position)> or <<touching (lava v)?> or <touching (spikes v)?>>> then\n        repeat (10)\n            change [ghost v] effect by (10)\n            change size by (-5)\n        end\n        if <[230] < (x position)> then\n            change [level v] by (1)\n        end\n        set [falling? v] to [0]\n        set [speed y v] to [0]\n        set [speed x v] to [0]\n        set [walljump v] to [0]\n        set [slope v] to [0]\n        go to x: (-200) y: (0)\n        repeat (10)\n            change [ghost v] effect by (-10)\n            change size by (5)\n        end\n    end\nend\n\nwhen flag clicked\nforever\n    if <<<(mouse y) < (y position)> and <mouse down?>> or <<key (down arrow v) pressed?> or <key (s v) pressed?>>> then\n        if <(costume [number v]) = [5]> then\n            switch costume to (c5 v)\n        else\n            next costume\n        end\n    else\n        if <(costume [number v]) = [1]> then\n            switch costume to (c v)\n        else\n            switch costume to ((costume [number v]) - (1))\n        end\n    end\nend\n\n@Ground\n\nwhen flag clicked\nforever\n    switch costume to (Level)\nend\n\n@Spikes\n\nwhen flag clicked\nset [level v] to [1]\nforever\n    switch costume to (Level)\nend\n\n@Lava\n\nwhen flag clicked\ngo to x: (0) y: (15)\nforever\n    switch costume to (Level)\nend\n\nwhen flag clicked\nforever\n    repeat (30)\n        change y by (-0.8)\n    end\n    repeat (30)\n        change y by (0.8)\n    end\nend\n\n@Sprite1\n\nwhen flag clicked\nforever\n    set [ghost v] effect to (100)\n    go to x: (0) y: (0)\n    go to [front v] layer\n    show\nend\n\n