(WIP) EP 7 Griffpatch platformer
@Stage\n\n@Player2\n\nwhen flag clicked\nset [gravity v] to [-1.2]\nset [jump force v] to [12]\nset [jump duration v] to [4]\nset [acceleration v] to [1.5]\nset [resistance v] to [0.8]\nReset and Begin Level\n\ndefine Move - in steps (steps)\nchange [player: falling v] by (1)\nrepeat (steps)\n    set [player: last value v] to (x position)\n    change x by ((Player: speed x2) / (steps))\n    Check Touching Solid\n    if <(Player: touching) > [0]> then\n        Collide X - Slope or Wall?\n    end\n    set [player: last value v] to (y position)\n    change y by ((Player: speed y2) / (steps))\n    Check Touching Solid\n    if <(Player: touching) > [0]> then\n        Collide Y - Celling or Floor\n    end\nend\n\ndefine Check Touching Solid\nif <<touching (level v)?> or <touching (platforms v)?>> then\n    set [player: touching v] to [1]\nelse\n    set [player: touching v] to [0]\nend\n\nwhen I receive [tick - player v]\nswitch backdrop to <touching (level v)?>\nControls - Up and Down\nControls - Left and Right\nMove - in steps (([abs v] of (speed x) ) + ([abs v] of (speed y) ))\nSet Costume\n\ndefine Controls - Up and Down\nif <key (up arrow v) pressed?> then\n    if <<(Player: wall slide) > [0]> and <(Player: jumping) = [0]>> then\n        set [player: jumping v] to [1]\n        set [player: falling v] to [3]\n        set [player: wall slide v] to [0]\n        turn right (180) degrees\n        set [player: speed x2 v] to (((direction) / (90)) * (7))\n        set [long jump v] to [12]\n    end\n    if <<(Player: falling) < [3]> and <(Player: jumping) = [0]>> then\n        set [player: jumping v] to [1]\n        set [player: falling v] to [3]\n    end\n    if <<(Player: jumping) > [0]> and <(Player: jumping) < (JUMP DURATION)>> then\n        change [player: jumping v] by (1)\n        set [player: speed y2 v] to (JUMP FORCE)\n    end\nelse\n    set [player: jumping v] to [0]\nend\nchange [player: speed y2 v] by (GRAVITY)\nif <(Player: wall slide) > [0]> then\n    Check Can Wall Slide\n    if <(Player: speed y2) < [0]> then\n        set [player: speed y2 v] to ((Player: speed y2) * (0.6))\n    end\nend\n\ndefine Controls - Left and Right\nif <(long jump) > [0]> then\n    change [long jump v] by (-1)\n    stop [this script v]\nend\nset [key x v] to (<key (right arrow v) pressed?> - <key (left arrow v) pressed?>)\nif <(KEY X) = [0]> then\n    if <<(Player: falling) > [2]> and <(Player: wall slide) < [1]>> then\n        set [player: speed x2 v] to ((Player: speed x2) * (0.98))\n        stop [this script v]\n    end\n    if <([abs v] of (Player: speed x2) ) < [1]> then\n        set [player: frame v] to [0]\n        set [player: speed x2 v] to [0]\n    else\n        change [player: frame v] by (0.5)\n    end\nelse\n    change [player: speed x2 v] by ((KEY X) * (ACCELERATION))\n    point in direction ((KEY X) * (90))\n    change [player: frame v] by (1)\nend\nset [player: speed x2 v] to ((Player: speed x2) * (RESISTANCE))\n\ndefine Reset and Begin Level\nset [player: speed y2 v] to [0]\nset [player: speed x2 v] to [0]\nset [player: falling v] to [99]\nset [player: wall slide v] to [0]\nset [player: jumping v] to [0]\nset [long jump v] to [0]\npoint in direction (90)\nBegin Scene # [1] go to x, y: [-150] [55]\n\nwhen I receive [game loop v]\nclear graphic effects\nforever\n    broadcast (Tick - First v)\n    broadcast (Tick - Player v)\n    broadcast (Tick - Last v)\nend\n\nwhen I receive [tick - last v]\nif <(x position) > [235]> then\n    Begin Scene # ((SCENE #) + (1)) go to x, y: [-235] []\nend\nif <(x position) < [-235]> then\n    Begin Scene # ((SCENE #) + (-1)) go to x, y: [235] []\nend\nif <(y position) > [180]> then\n    Begin Scene # ((SCENE #) + (100)) go to x, y: [] [-160]\nend\nif <(y position) < [-180]> then\n    Begin Scene # ((SCENE #) + (-100)) go to x, y: [] [180]\nend\nif <<touching (danger v)?> or <touching (lava v)?>> then\n    broadcast (lose life lol v)\nend\n\ndefine Begin Scene # (scene #) go to x, y: (x) (y)\nset [scene # v] to (scene #)\nif <(x) > []> then\n    set x to (x)\nend\nif <(y) > []> then\n    set y to (y)\nend\nbroadcast (Change Scene v)\nstop [other scripts in sprite v]\nwait (0) seconds\nswitch costume to (hitbox v2 v)\nset rotation style [don't rotate v]\nif <(x) > []> then\n    Fix Collision in Direction [0]\nelse\n    Fix Collision in Direction [90]\nend\nSet Costume\nbroadcast (Game Loop v)\n\ndefine Fix Collision in Direction (direction)\nset [player: temp v] to (direction)\nset [player: distance v] to [1]\npoint in direction (direction)\nrepeat (128)\n    Check Touching Solid\n    if <(Player: touching) < [1]> then\n        point in direction (Player: temp)\n        stop [this script v]\n    end\n    move (Player: distance) steps\n    turn right (180) degrees\n    change [player: distance v] by (1)\nend\n\nwhen I receive [tick - first v]\nswitch costume to (hitbox v2 v)\nset rotation style [don't rotate v]\n\ndefine Set Costume\nset rotation style [left-right v]\nif <(Player: wall slide) > [0]> then\n    switch costume to (hangon01 v)\n    stop [this script v]\nend\nif <(Player: falling) > [1]> then\n    if <(Player: speed y2) > [0]> then\n        switch costume to (jump01 v)\n    else\n        switch costume to (run_j2 v)\n    end\n    stop [this script v]\nend\nif <(Player: frame) > [0]> then\n    switch costume to ((1) + ([floor v] of ((Player: frame) mod (16)) ))\nelse\n    switch costume to (hit angle 0 v)\n    repeat (5)\n        Check Touching Solid\n        if <(Player: touching) < [1]> then\n            switch costume to ((costume [number v]) + (5))\n            stop [this script v]\n        end\n        next costume\n    end\n    switch costume to (stand v)\nend\n\ndefine Collide X - Slope or Wall?\nCheck Can Wall Slide\nchange y by (1)\nCheck Touching Solid\nif <(Player: touching) > [0]> then\n    change y by (1)\n    Check Touching Solid\n    if <(Player: touching) > [0]> then\n        change y by (-2)\n        set x to (Player: last value)\n        set [player: speed x2 v] to [0]\n        stop [this script v]\n    end\n    set [player: speed x2 v] to ((Player: speed x2) * (0.1))\nend\nset [player: speed x2 v] to ((Player: speed x2) * (0.95))\nSlip\n\ndefine Collide Y - Celling or Floor\nset y to (Player: last value)\nif <(Player: speed y2) > [0]> then\n    set [player: speed y2 v] to [0]\n    stop [this script v]\nend\nif <(Player: falling) > [0]> then\n    set [player: falling v] to [0]\n    Slip\nend\nset [player: speed y2 v] to ((Player: speed y2) * (0.8))\n\ndefine Slip\nchange y by (-2)\nchange x by (1)\nCheck Touching Solid\nif <(Player: touching) < [1]> then\n    set [player: falling v] to [9]\n    change [player: speed x2 v] by (1)\n    stop [this script v]\nend\nchange x by (-2)\nCheck Touching Solid\nif <(Player: touching) < [1]> then\n    set [player: falling v] to [9]\n    change [player: speed x2 v] by (-1)\n    stop [this script v]\nend\nchange y by (2)\nchange x by (1)\n\ndefine Check Can Wall Slide\nif <(Player: falling) < [2]> then\n    set [player: wall slide v] to [0]\n    stop [this script v]\nend\nswitch costume to (hitbox wallslide v)\nset rotation style [left-right v]\nCheck Touching Solid\nset [player: wall slide v] to (Player: touching)\nswitch costume to (hitbox v2 v)\nset rotation style [don't rotate v]\n\nwhen I receive [lose life lol v]\nstop [other scripts in sprite v]\nrepeat (10)\n    change [ghost v] effect by (10)\n    change [brightness v] effect by (-10)\nend\nwait (0.5) seconds\nReset and Begin Level\n\n@Level\n\nwhen flag clicked\nclear graphic effects\nwait (0.5) seconds\ngo to x: (0) y: (0)\ngo [backward v] (1) layers\n\nwhen I receive [change scene v]\nswitch costume to (join [Scene] (SCENE #))\n\n@Danger\n\nwhen flag clicked\ngo to x: (0) y: (0)\nforever\n    go to [back v] layer\nend\n\nwhen I receive [change scene v]\nswitch costume to (blank v)\nswitch costume to (join [Scene] (SCENE #))\n\n@Lava\n\nwhen flag clicked\ngo to x: (0) y: (0)\nforever\n    go to [back v] layer\nend\n\nwhen I receive [change scene v]\nswitch costume to (blank v)\nswitch costume to (join [Scene] (SCENE #))\nforever\n    set y to ((3) * ([sin v] of ((timer) * (180)) ))\nend\n\n@Platforms\n\nwhen flag clicked\nclear graphic effects\nwait (0.5) seconds\ngo to x: (0) y: (0)\ngo [backward v] (1) layers\n\nwhen I receive [change scene v]\nswitch costume to (join [Scene] (SCENE #))\n\n
Too lazy.\nTo type.\nThe Name.