Infection -A Platformer-


@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.9))\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 (0.75)\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 (-0.75)\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        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    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\nif <(round (Speed X)) > [0]> then\nelse\n    if <[0] > (round (Speed X))> then\n        turn right (-15) degrees\n    end\nend\n\nwhen flag clicked\nforever\n    turn right ((Speed X) * (2)) degrees\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@Sprite1\n\nwhen flag clicked\nforever\n    switch costume to (Level)\nend\n\n@Sprite2\n\nwhen flag clicked\nswitch costume to (costume1 v)\n\nwhen flag clicked\nforever\n    go to [front v] layer\n    set [ghost v] effect to (100)\n    show\nend\n\n