Pen Platformer  by Hinoki_D

Instructions: ---------------------------------------------------------------------\nUse arrows to move (↑ to jump, ← & →)\n---------------------------------------------------------------------\nTouch the right wall to get to the next level\n---------------------------------------------------------------------

@Stage\n\nwhen flag clicked\nforever\n    play sound [Elektronomia - Ibiza \[NomiaTunes Release\] v] until done\nend\n\n@Level\n\nwhen flag clicked\nswitch costume to (1 v)\ngo to [front v] layer\nforever\n    go to x: (0) y: (0)\n    if <([x position v] of [player v]) > [225]> then\n        next costume\n        wait (0.2) seconds\n    end\nend\n\nwhen flag clicked\nwait (1) seconds\nrepeat until <(costume [number v]) = [15]>\n    if <key (n v) pressed?> then\n        next costume\n        wait (0.5) seconds\n    end\nend\n\n@Player\n\nwhen flag clicked\nswitch costume to (ball-a v)\nset [y spawn v] to [-70]\nset [x spawn v] to [-200]\ngo to x: (X Spawn) y: (Y Spawn)\nshow\nset size to (50) %\nset [x v] to [0]\nset [y v] to [0]\nforever\n    Platformer engine\nend\n\ndefine Platformer engine\nif on edge, bounce\nchange [y v] by (-0.5)\nif <<key (left arrow v) pressed?> or <<key (a v) pressed?> or <<mouse down?> and <[0] > (mouse x)>>>> then\n    change [x v] by (-1)\n    point in direction (-90)\nend\nif <<key (right arrow v) pressed?> or <<key (d v) pressed?> or <<mouse down?> and <(mouse x) > [0]>>>> then\n    change [x v] by (1)\n    point in direction (90)\nend\nset [x v] to ((x) * (0.9))\nchange x by (x)\nif <touching (level v)?> then\n    change y by (1)\n    if <touching (level v)?> then\n        change y by (1)\n        if <touching (level v)?> then\n            change y by (1)\n            if <touching (level v)?> then\n                change y by (1)\n                if <touching (level v)?> then\n                    change y by (1)\n                    if <touching (level v)?> then\n                        change y by (1)\n                        if <touching (level v)?> then\n                            change y by (-6)\n                            change x by ((x) * (-1))\n                            if <<key (up arrow v) pressed?> or <key (w v) pressed?>> then\n                                set [y v] to [10]\n                                if <(x) > [0]> then\n                                    set [x v] to [-3]\n                                else\n                                    set [x v] to [3]\n                                end\n                            else\n                                set [x v] to [0]\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\nchange y by (y)\nif <touching (level v)?> then\n    change y by ((y) * (-1))\n    set [y v] to [0]\nend\nchange y by (-0.5)\nif <<touching (level v)?> and <<key (up arrow v) pressed?> or <<key (w v) pressed?> or <<mouse down?> and <[0] < (mouse y)>>>>> then\n    set [y v] to [8]\nend\nchange y by (0.5)\nif <<touching (spikes v)?> or <<touching (saws v)?> or <touching (lava v)?>>> then\n    go to x: (X Spawn) y: (Y Spawn)\nend\nif <touching (bounce v)?> then\n    set [y v] to [12]\nend\nif <(x position) > [225]> then\n    wait (0.01) seconds\n    go to x: (X Spawn) y: (Y Spawn)\nend\n\nwhen flag clicked\nforever\n\nplay sound [the good the bad and the ugly.mp3 v] until done\n\nwhen [r v] key pressed\ngo to x: (X Spawn) y: (Y Spawn)\n\nwhen flag clicked\nwait (1) seconds\nrepeat until <(costume [number v]) = [15]>\n    if <key (n v) pressed?> then\n        go to x: (X Spawn) y: (Y Spawn)\n        wait (0.5) seconds\n    end\nend\n\n@Trail\n\nwhen flag clicked\nforever\n    hide\n    go to (player v)\n    create clone of (_myself_ v)\n    go to [front v] layer\nend\n\nwhen I start as a clone\nshow\nclear graphic effects\ngo to [back v] layer\ngo [forward v] (1) layers\nrepeat (10)\n    change [x v] by (-0.01)\n    change x by (-4)\n    change [ghost v] effect by (10)\n    change x by (-3)\n    change size by (-5)\nend\ndelete this clone\n\n@Particles\n\nwhen flag clicked\nforever\n    hide\n    go to x: (240) y: (pick random (-100) to (180))\n    set [ghost v] effect to (pick random (30) to (60))\n    set size to (pick random (80) to (120)) %\n    create clone of (_myself_ v)\n    wait (0.05) seconds\n    go to [back v] layer\nend\n\nwhen I start as a clone\nshow\nrepeat until <(x position) < [-230]>\n    change x by (-10)\nend\ndelete this clone\n\n@Bounce\n\nwhen flag clicked\nhide\nwait until <([costume # v] of [level v]) = [3]>\nset [last bounce v] to [3]\ngo to x: (-84) y: (-85)\ncreate clone of (_myself_ v)\nwait until <([costume # v] of [level v]) = [10]>\nset [last bounce v] to [10]\ngo to x: (-105) y: (-85)\ncreate clone of (_myself_ v)\nwait until <([costume # v] of [level v]) = [11]>\nwait (0.01) seconds\nset [last bounce v] to [11]\ngo to x: (-105) y: (-85)\ncreate clone of (_myself_ v)\ngo to x: (3) y: (-85)\ncreate clone of (_myself_ v)\ngo to x: (127) y: (-85)\ncreate clone of (_myself_ v)\n\nwhen I start as a clone\nshow\ngo to [back v] layer\nforever\n    switch costume to (costume1 v)\n    if <touching (player v)?> then\n        repeat (4)\n            next costume\n        end\n        switch costume to (costume4 v)\n        switch costume to (costume3 v)\n        switch costume to (costume2 v)\n    end\nend\n\nwhen I start as a clone\nwait until <not <([costume # v] of [level v]) = (last bounce)>>\ndelete this clone\n\n@Lava\n\nwhen flag clicked\ngo to [back v] layer\nforever\n    go to x: (0) y: (0)\n    repeat (10)\n        change y by (1)\n    end\n    repeat (10)\n        change y by (-1)\n    end\nend\n\nwhen flag clicked\nforever\n    switch costume to ([costume # v] of [level v])\nend\n\n@Saws\n\nwhen flag clicked\nhide\nwait until <([costume # v] of [level v]) = [2]>\nset [last saw v] to [2]\ngo to x: (-68) y: (-102)\ncreate clone of (_myself_ v)\nwait until <([costume # v] of [level v]) = [4]>\nset [last saw v] to [4]\ngo to x: (-76) y: (-102)\ncreate clone of (_myself_ v)\ngo to x: (103) y: (-102)\ncreate clone of (_myself_ v)\nwait until <([costume # v] of [level v]) = [6]>\nset [last saw v] to [6]\ngo to x: (113) y: (11)\ncreate clone of (_myself_ v)\nwait until <([costume # v] of [level v]) = [7]>\nwait (0.01) seconds\nset [last saw v] to [7]\ngo to x: (-115) y: (-102)\ncreate clone of (_myself_ v)\ngo to x: (42) y: (-102)\ncreate clone of (_myself_ v)\ngo to x: (196) y: (-102)\ncreate clone of (_myself_ v)\ngo to x: (-35) y: (37)\ncreate clone of (_myself_ v)\ngo to x: (123) y: (37)\ncreate clone of (_myself_ v)\nwait until <([costume # v] of [level v]) = [11]>\nset [last saw v] to [11]\ngo to x: (-155) y: (51)\ncreate clone of (_myself_ v)\ngo to x: (-50) y: (51)\ncreate clone of (_myself_ v)\ngo to x: (57) y: (51)\ncreate clone of (_myself_ v)\ngo to x: (168) y: (51)\ncreate clone of (_myself_ v)\nwait until <([costume # v] of [level v]) = [13]>\nset [last saw v] to [13]\ngo to x: (184) y: (124)\ncreate clone of (_myself_ v)\ngo to x: (246) y: (46)\ncreate clone of (_myself_ v)\n\nwhen I start as a clone\nwait until <not <([costume # v] of [level v]) = (last saw)>>\ndelete this clone\n\nwhen I start as a clone\nshow\ngo to [back v] layer\nforever\n    turn right (3) degrees\nend\n\n@Spikes\n\nwhen flag clicked\ngo to [back v] layer\nforever\n    switch costume to ([costume # v] of [level v])\nend\n\n@Decorations\n\nwhen flag clicked\ngo to [front v] layer\nforever\n    switch costume to ([costume # v] of [level v])\nend\n\n@Thumbnail\n\nwhen flag clicked\nforever\n    set [ghost v] effect to (100)\n    go to [front v] layer\nend\n\n@Overall\n\nwhen flag clicked\nforever\n    hide\nend\n\n