Super Mario World Scrolling Platformer   ★★★★    [MOBILE FRIENDLY]

Instructions: This is a simple starter project for a Platformer Game.\n\nCan you remix it, add new levels, a new character? new dangers, enemies, collectables? Try playing around with using different 'forces' and see how it changes the game!\n\nThis platforming engine (unlike my YouTube series on scrolling platformers) uses color sensing blocks to check for collisions - This makes it much easier to design your levels in the Scratch paint editor - However, if you want to know more then do check out my YouTube channel for more details on other types of platforming scripts.\n\nThis project was created as a learning resource for www.withprimer.com

@Stage\n\nwhen I receive [gamestart v]\nforever\n    set volume to ((200) - ([x position v] of [entry v])) %\n    set [pan left/right v] effect to ((x position) - ([x position v] of [3d engine v]))\nend\n\nwhen I receive [gamestart v]\nforever\n    play sound [Vexento_-_Where_We_Belong v] until done\nend\n\nset volume to (100) %\n\n@Stage\n\nwhen I receive [reset v]\nif <(ゴール) = [1]> then\n    switch costume to (ゴール v)\nelse\n    next costume\n    if <(costume [number v]) = [9]> then\n        set [ゴール v] to [1]\n    end\nend\n\nwhen flag clicked\nset [ゴール v] to [0]\nhide\n\nwhen I receive [gamestart v]\nshow\nswitch costume to (1 v)\n\n@attraction\n\nwhen flag clicked\ngo to x: (0) y: (0)\ngo to [back v] layer\nhide\n\nwhen I receive [reset v]\nif <(ゴール) = [1]> then\n    switch costume to (コスチューム5 v)\nelse\n    next costume\nend\n\nwhen I receive [gamestart v]\nshow\nswitch costume to (1 v)\n\n@スプライト1\n\nwhen flag clicked\ngo to x: (0) y: (0)\nhide\n\nwhen I receive [gamestart v]\nshow\nswitch costume to (コスチューム2 v)\n\nwhen I receive [reset v]\nif <(ゴール) = [1]> then\n    switch costume to (コスチューム9 v)\nelse\n    next costume\nend\n\n@ピコばーじょん\n\n@スプライト2\n\nwhen I start as a clone\nif <(costume [number v]) = [1]> then\n    set x to (-223)\n    repeat (50)\n        change x by (((0) - (x position)) / (5))\n    end\n    wait (1) seconds\n    delete this clone\nend\n\nwhen I start as a clone\nif <(costume [number v]) = [2]> then\n    set x to (223)\n    repeat (50)\n        change x by (((0) - (x position)) / (5))\n    end\n    wait (1) seconds\n    delete this clone\nend\n\nwhen I start as a clone\nshow\ngo to [front v] layer\n\nwhen I start as a clone\nif <(costume [number v]) = [3]> then\n    go to x: (253) y: (-180)\n    point in direction (0)\n    repeat (50)\n        turn right (((90) - (direction)) / (10)) degrees\n        go to [front v] layer\n    end\n    wait (1) seconds\n    set [next v] to [0]\n    delete this clone\nend\n\ndefine cc\nclear graphic effects\nset [ghost v] effect to (0)\nset [brightness v] effect to (30)\nswitch costume to (コスチューム3 v)\ncreate clone of (_myself_ v)\nwait (0.2) seconds\nset [ghost v] effect to (0)\nset [brightness v] effect to (100)\nswitch costume to (コスチューム3 v)\ncreate clone of (_myself_ v)\nwait (0.2) seconds\nset [ghost v] effect to (30)\nclear graphic effects\nset [color v] effect to (100)\nswitch costume to (コスチューム3 v)\ncreate clone of (_myself_ v)\nwait (0.2) seconds\n\ndefine cc1\nclear graphic effects\nset [ghost v] effect to (0)\nset [brightness v] effect to (30)\nswitch costume to (コスチューム1 v)\ncreate clone of (_myself_ v)\nswitch costume to (コスチューム2 v)\ncreate clone of (_myself_ v)\nwait (0.2) seconds\nset [ghost v] effect to (0)\nset [brightness v] effect to (100)\nswitch costume to (コスチューム1 v)\ncreate clone of (_myself_ v)\nswitch costume to (コスチューム2 v)\ncreate clone of (_myself_ v)\nwait (0.2) seconds\nset [ghost v] effect to (30)\nclear graphic effects\nset [color v] effect to (100)\nswitch costume to (コスチューム1 v)\ncreate clone of (_myself_ v)\nswitch costume to (コスチューム2 v)\ncreate clone of (_myself_ v)\nwait (0.2) seconds\n\nwhen I start as a clone\nif <(costume [number v]) = [6]> then\n    set size to (0) %\n    repeat (70)\n        switch costume to (コスチューム5 v)\n        change size by (((2500) - (size)) / (10))\n        switch costume to (コスチューム6 v)\n    end\n    delete this clone\nend\n\ndefine cc3\nclear graphic effects\nset [ghost v] effect to (0)\nset [brightness v] effect to (30)\nswitch costume to (コスチューム6 v)\ncreate clone of (_myself_ v)\nwait (0.2) seconds\nset [ghost v] effect to (0)\nset [brightness v] effect to (100)\nswitch costume to (コスチューム6 v)\ncreate clone of (_myself_ v)\nwait (0.2) seconds\nset [ghost v] effect to (30)\nclear graphic effects\nset [color v] effect to (100)\nswitch costume to (コスチューム6 v)\ncreate clone of (_myself_ v)\nwait (0.2) seconds\n\nwhen I receive [next v]\nset [next v] to [1]\ngo to x: (0) y: (0)\npoint in direction (90)\ncc1\ncc3\ncc\n\n@スプライト3\n\nwhen flag clicked\nset [next v] to [0]\nwait (1) seconds\nset [ghost v] effect to (100)\ngo to [front v] layer\ngo to x: (0) y: (0)\nforever\n    go to [front v] layer\nend\n\nwhen flag clicked\n\nwhen I start as a clone\nif <(costume [number v]) = [4]> then\n    go to [front v] layer\n    switch costume to (コスチューム5 v)\n    show\n    clear graphic effects\n    go to x: (0) y: (0)\nend\nif <(costume [number v]) = [5]> then\n    go to x: (0) y: (0)\n    go to [front v] layer\n    switch costume to (コスチューム4 v)\n    show\n    clear graphic effects\nend\n\nswitch costume to (コスチューム5 v)\ncreate clone of (_myself_ v)\nswitch costume to (コスチューム2 v)\n\nswitch costume to (ダウンロード v)\n\ncreate clone of (_myself_ v)\n\n@3D engine\n\ndefine Fill Tri (x1) (y1) (x2) (y2) (x3) (y3) Res (res)\nset pen size to (res)\npen up\ngo to x: (x1) y: (y1)\npen down\ngo to x: (x2) y: (y2)\ngo to x: (x3) y: (y3)\ngo to x: (x1) y: (y1)\npen up\n#tri distance (x2) (y2) ,  (x3) (y3)\nset [a v] to (output)\n#tri distance (x3) (y3) ,  (x1) (y1)\nset [b v] to (output)\n#tri distance (x2) (y2) ,  (x1) (y1)\nset [c v] to (output)\n#tri calculation2 (x1) (x2) (x3)\nset [ix v] to (output)\n#tri calculation2 (y1) (y2) (y3)\nset [iy v] to (output)\nset [perimiter v] to ((1) / ((a) + ((b) + (c))))\nset [in-center diameter v] to ([sqrt v] of ((perimiter) * ((((a) + (b)) - (c)) * ((((b) + (c)) - (a)) * (((c) + (a)) - (b))))) )\nset [ic v] to [32]\n#tri pen\npen up\n#tri calculation (x1) (y1)\npen down\n#tri calculation (x2) (y2)\n#tri calculation (x3) (y3)\n#tri calculation (x1) (y1)\npen up\nset [ic v] to [10]\n#tri pen\npen up\n#tri calculation (x1) (y1)\npen down\n#tri calculation (x2) (y2)\n#tri calculation (x3) (y3)\n#tri calculation (x1) (y1)\npen up\nset [ic v] to [5]\n#tri pen\npen up\n#tri calculation (x1) (y1)\npen down\n#tri calculation (x2) (y2)\n#tri calculation (x3) (y3)\n#tri calculation (x1) (y1)\npen up\nset [ic v] to [2]\n#tri pen\npen up\n#tri calculation (x1) (y1)\npen down\n#tri calculation (x2) (y2)\n#tri calculation (x3) (y3)\n#tri calculation (x1) (y1)\npen up\n\ndefine ■ (x0) (y0) (x1) (y1) (x2) (y2) (x3) (y3) (z0) (z1) (z2) (z3)\nadd ((length of [script no. v]) + (1)) to [script no. v]\nadd (x0) to [tri2 v]\nadd (y0) to [tri2 v]\nadd (z0) to [tri2 v]\nadd (x1) to [tri2 v]\nadd (y1) to [tri2 v]\nadd (z1) to [tri2 v]\nadd (x2) to [tri2 v]\nadd (y2) to [tri2 v]\nadd (z2) to [tri2 v]\nadd (x3) to [tri2 v]\nadd (y3) to [tri2 v]\nadd (z3) to [tri2 v]\n\ndefine render\nrepeat ((length of [tri2 v]) / (12))\n    set [highest v] to [-100000000]\n    set [highest spot v] to [0]\n    set [count v] to [1]\n    repeat ((length of [tri2 v]) / (12))\n        set [total z v] to [0]\n        go to (item ((count) + (0)) of [tri2 v]) (item ((count) + (1)) of [tri2 v]) (item ((count) + (2)) of [tri2 v])\n        change [total z v] by (Z)\n        go to (item ((count) + (3)) of [tri2 v]) (item ((count) + (4)) of [tri2 v]) (item ((count) + (5)) of [tri2 v])\n        change [total z v] by (Z)\n        go to (item ((count) + (6)) of [tri2 v]) (item ((count) + (7)) of [tri2 v]) (item ((count) + (8)) of [tri2 v])\n        change [total z v] by (Z)\n        go to (item ((count) + (9)) of [tri2 v]) (item ((count) + (10)) of [tri2 v]) (item ((count) + (11)) of [tri2 v])\n        change [total z v] by (Z)\n        set [total z v] to ((total z) / (4))\n        if <(total z) > (Highest)> then\n            set [highest v] to (total z)\n            set [highest spot v] to (count)\n        end\n        change [count v] by (12)\n    end\n    set pen color to (item (item ((1) + (((Highest spot) - (1)) / (12))) of [script no. v]) of [color v])\n    set pen (brightness v) to ((50) + ((Highest) * (-50)))\n    go to (item ((Highest spot) + (0)) of [tri2 v]) (item ((Highest spot) + (1)) of [tri2 v]) (item ((Highest spot) + (2)) of [tri2 v])\n    delete all of [tri3 v]\n    add (x position) to [tri3 v]\n    add (y position) to [tri3 v]\n    go to (item ((Highest spot) + (3)) of [tri2 v]) (item ((Highest spot) + (4)) of [tri2 v]) (item ((Highest spot) + (5)) of [tri2 v])\n    add (x position) to [tri3 v]\n    add (y position) to [tri3 v]\n    go to (item ((Highest spot) + (6)) of [tri2 v]) (item ((Highest spot) + (7)) of [tri2 v]) (item ((Highest spot) + (8)) of [tri2 v])\n    add (x position) to [tri3 v]\n    add (y position) to [tri3 v]\n    go to (item ((Highest spot) + (9)) of [tri2 v]) (item ((Highest spot) + (10)) of [tri2 v]) (item ((Highest spot) + (11)) of [tri2 v])\n    add (x position) to [tri3 v]\n    add (y position) to [tri3 v]\n    Fill Tri (item (1) of [tri3 v]) (item (2) of [tri3 v]) (item (3) of [tri3 v]) (item (4) of [tri3 v]) (item (5) of [tri3 v]) (item (6) of [tri3 v]) Res []\n    Fill Tri (item (1) of [tri3 v]) (item (2) of [tri3 v]) (item (7) of [tri3 v]) (item (8) of [tri3 v]) (item (5) of [tri3 v]) (item (6) of [tri3 v]) Res []\n    pen up\n    delete ((Highest spot) + (11)) of [tri2 v]\n    delete ((Highest spot) + (10)) of [tri2 v]\n    delete ((Highest spot) + (9)) of [tri2 v]\n    delete ((Highest spot) + (8)) of [tri2 v]\n    delete ((Highest spot) + (7)) of [tri2 v]\n    delete ((Highest spot) + (6)) of [tri2 v]\n    delete ((Highest spot) + (5)) of [tri2 v]\n    delete ((Highest spot) + (4)) of [tri2 v]\n    delete ((Highest spot) + (3)) of [tri2 v]\n    delete ((Highest spot) + (2)) of [tri2 v]\n    delete ((Highest spot) + (1)) of [tri2 v]\n    delete ((Highest spot) + (0)) of [tri2 v]\n    delete ((1) + (((Highest spot) - (1)) / (12))) of [script no. v]\nend\n\ndefine cube\n■ [-50] [50] [50] [50] [50] [-50] [-50] [-50] [-50] [-50] [-50] [-50]\n■ [-50] [50] [50] [50] [50] [50] [-50] [50] [50] [50] [-50] [-50]\n■ [-50] [50] [-50] [-50] [-50] [-50] [-50] [50] [50] [50] [-50] [-50]\n■ [50] [50] [50] [-50] [50] [-50] [50] [50] [50] [50] [-50] [-50]\n■ [-50] [-50] [50] [-50] [50] [-50] [-50] [-50] [50] [50] [-50] [-50]\n■ [-50] [50] [50] [50] [50] [-50] [-50] [-50] [50] [50] [50] [50]\n\ndefine Line from (x) (y) (z) to (x2) (y2) (z2)\npen up\ngo to (x) (y) (z)\npen down\ngo to (x2) (y2) (z2)\n\ndefine go to (x1) (y1) (z1)\nRotate2 ((x1) / (40)) ((y1) / (40)) ((z1) / (40))\nset [multiplier v] to ((240) / (((Z) + (5)) * ([tan v] of (50) )))\ngo to x: (((camera x) + ((Z) * ((camera x) / (-5)))) + (((X) * ((camera z) / (200))) * (Multiplier))) y: (((camera y) + ((Z) * ((camera y) / (-5)))) + ((camera y) + (((Y) * ((camera z) / (200))) * (Multiplier))))\n\ndefine Rotate2 (x) (y) (z)\nRotate (x) (y) ((0) - (z dir))\nset [x v] to (item (1) of [rotate v])\nset [y v] to (item (2) of [rotate v])\nRotate (X) (z) ((0) - (y dir))\nset [x v] to (item (1) of [rotate v])\nset [z v] to (item (2) of [rotate v])\nRotate (Z) (Y) (x dir)\nset [z v] to (item (1) of [rotate v])\nset [y v] to (item (2) of [rotate v])\n\ndefine Rotate (x) (y) (angle)\ndelete all of [rotate v]\nadd (((x) * ([cos v] of (angle) )) + ((y) * ([sin v] of (angle) ))) to [rotate v]\nadd (((y) * ([cos v] of (angle) )) - ((x) * ([sin v] of (angle) ))) to [rotate v]\n\ndefine #tri calculation2 (#1) (#2) (#3)\nset [output v] to ((((a) * (#1)) + (((b) * (#2)) + ((c) * (#3)))) / ((a) + ((b) + (c))))\n\ndefine #tri distance (x1) (y1) ,  (x2) (y2)\nset [output v] to ([sqrt v] of ((((x1) - (x2)) * ((x1) - (x2))) + (((y1) - (y2)) * ((y1) - (y2)))) )\n\ndefine #tri calculation (1) (2)\ngo to x: ((1) - (((1) - (ix)) / (ic))) y: ((2) - (((2) - (iy)) / (ic)))\n\ndefine #tri pen\nset pen size to ((in-center diameter) / (ic))\n\ndefine intro\npoint in direction (90)\nset size to (100) %\nswitch costume to (コスチューム1 v)\ncreate clone of (_myself_ v)\nswitch costume to (text v)\ncreate clone of (_myself_ v)\nwait (0.1) seconds\nsw [100] [100] [2]\nsw [-100] [100] [2]\nwait (0.5) seconds\nsw [100] [-100] [2]\nsw [-100] [-100] [2]\nwait (0.5) seconds\nsw [100] [100] [2]\nsw [-100] [100] [2]\nwait (0.5) seconds\nsw [100] [-100] [2]\nsw [-100] [-100] [2]\nwait (0.1) seconds\nsw [0] [0] [24]\nwait (0.2) seconds\nsw [0] [0] [25]\nsw [0] [0] [2]\nwait (0.5) seconds\nswitch costume to (chevron2 v)\ncreate clone of (_myself_ v)\nsw [100] [100] [2]\nsw [-100] [100] [2]\nwait (0.5) seconds\nsw [100] [-100] [2]\nsw [-100] [-100] [2]\nwait (0.1) seconds\nsw [0] [0] [24]\nwait (0.2) seconds\nsw [0] [0] [25]\nwait (0.1) seconds\nsw [0] [0] [24]\nwait (0.2) seconds\nsw [0] [0] [25]\nswitch costume to (chevron2 v)\ncreate clone of (_myself_ v)\nwait (0.5) seconds\nsw [0] [0] [26]\nsw [100] [100] [2]\nsw [-100] [100] [2]\nwait (0.5) seconds\nsw [100] [-100] [2]\nsw [-100] [-100] [2]\nwait (0.1) seconds\nsw [0] [0] [24]\nwait (0.2) seconds\nsw [0] [0] [25]\nsw [0] [0] [26]\nout\nset [brightness v] effect to (100)\ncreate clone of (_myself_ v)\nwait (0.1) seconds\nswitch costume to (コスチューム2 v)\nclear graphic effects\ncreate clone of (_myself_ v)\nwait (3) seconds\nbroadcast (end v)\n\nwhen I receive [start v]\nswitch costume to (pen v)\ndelete all of [tri2 v]\ndelete all of [script no. v]\ndelete all of [color v]\nadd [] to [color v]\nadd [] to [color v]\nadd [] to [color v]\nadd [] to [color v]\nadd [] to [color v]\nadd [] to [color v]\nset size to (Infinity) %\nset [camera z v] to [0]\nrepeat (30)\n    erase all\n    change [camera z v] by (10)\n    change [x dir v] by (5)\n    change [y dir v] by (5)\n    change [z dir v] by (5)\n    render\n    cube\nend\nrepeat (30)\n    erase all\n    change [camera z v] by (-10)\n    change [x dir v] by (5)\n    change [y dir v] by (5)\n    change [z dir v] by (5)\n    render\n    cube\nend\nerase all\nintro\n\nwhen flag clicked\n\nbroadcast (start v)\n\ndefine sw\ngo to [front v] layer\nset size to (200) %\nset [fisheye v] effect to (0)\nset [あ v] to [0]\nrepeat (30)\n    change size by ((あ) / (10000))\n    set [fisheye v] effect to (あ)\n    change [あ v] by ((10000000) / ((100000) - (あ)))\nend\nrepeat (5)\n    change [ghost v] effect by (20)\nend\ndelete this clone\n\ndefine sw (x) (y) (c)\nswitch costume to (c)\nset [brightness v] effect to (-100)\nset [ghost v] effect to (70)\ngo to x: ((x) - (20)) y: ((y) - (20))\ncreate clone of (_myself_ v)\nclear graphic effects\nclear graphic effects\ngo to x: (x) y: (y)\ncreate clone of (_myself_ v)\n\nwhen I start as a clone\nif <<[2] = (costume [number v])> or <<<[24] = (costume [number v])> or <[26] = (costume [number v])>> or <[25] = (costume [number v])>>> then\n    sw\nend\n\nwhen I start as a clone\nshow\n\nwhen I start as a clone\nwait until <(round (timer)) = [3]>\nturn right (1) degrees\nrepeat until <(round (direction)) = [90]>\n    turn right (([abs v] of ((90) - (direction)) ) / (7)) degrees\nend\nturn right (-1) degrees\nrepeat until <(round (direction)) = [90]>\n    turn right (join [-] (([abs v] of ((90) - (direction)) ) / (7))) degrees\nend\n\nwhen I start as a clone\nif <(costume [number v]) = [27]> then\n    set size to (0) %\n    repeat (10)\n        switch costume to (pen v)\n        change size by (20)\n        switch costume to (chevron2 v)\n    end\n    delete this clone\nend\n\ndefine out\nswitch costume to (new piskel \(5\) v)\ncreate clone of (_myself_ v)\n\nwhen I start as a clone\nif <(costume [number v]) = [4]> then\n    set [brightness v] effect to (-100)\n    switch costume to (new piskel \(5\) v)\n    set size to (200) %\n    repeat (18)\n        wait (0.0001) seconds\n        next costume\n        go to [front v] layer\n    end\nend\n\nwhen I receive [end v]\ndelete this clone\n\nwhen I start as a clone\nif <(costume [number v]) = [28]> then\n    show\n    change x by (99999)\n    forever\n        go to [front v] layer\n        change x by (((0) - (x position)) / (7))\n    end\nend\n\nwhen I receive [start v]\nstart sound [Foxsky - Kirby Smash v]\n\nwhen I receive [start v]\nreset timer\n\n@character2\n\nwhen flag clicked\nhide\nwait (1) seconds\nif <(回数) = [1]> then\n    change [回数 v] by (1)\n    broadcast (start v) and wait\nend\nbroadcast (Gamestart v)\nerase all\n\ndefine 内部プログラム\nchange y by (y)\nchange [y v] by (-1)\nswitch costume to (1 v)\nif <touching (stage v)?> then\n    point in direction (90)\n    set [y v] to [0]\n    repeat until <not <touching (stage v)?>>\n        change y by (1)\n    end\n    change y by (-1)\n    if <<key (up arrow v) pressed?> or <<(y position) < (mouse y)> and <mouse down?>>> then\n        set [y v] to [12]\n    end\nend\nswitch costume to (4 v)\nif <touching (stage v)?> then\n    point in direction (90)\n    set [y v] to [0]\n    repeat until <not <touching (stage v)?>>\n        change y by (-1)\n    end\n    change y by (-1)\nend\nswitch costume to (5 v)\nif <<key (right arrow v) pressed?> or <<mouse down?> and <(x position) < (mouse x)>>> then\n    change [x v] by (1)\nend\nif <<key (left arrow v) pressed?> or <<mouse down?> and <(mouse x) < (x position)>>> then\n    change [x v] by (-1)\nend\nchange x by (x)\nset [x v] to ((x) * (0.88))\nswitch costume to (2 v)\nif <touching (stage v)?> then\n    point in direction (90)\n    set [x v] to [0]\n    repeat until <not <touching (stage v)?>>\n        change x by (-1)\n    end\n    if <<<key (up arrow v) pressed?> or <<(y position) < (mouse y)> and <mouse down?>>> and <<key (right arrow v) pressed?> or <<mouse down?> and <(x position) < (mouse x)>>>> then\n        set [x v] to [-5]\n        set [y v] to [10]\n    end\nend\nswitch costume to (3 v)\nif <touching (stage v)?> then\n    point in direction (90)\n    set [x v] to [0]\n    repeat until <not <touching (stage v)?>>\n        change x by (1)\n    end\n    if <<<key (left arrow v) pressed?> or <<mouse down?> and <(mouse x) < (x position)>>> and <<key (up arrow v) pressed?> or <<(y position) < (mouse y)> and <mouse down?>>>> then\n        set [x v] to [5]\n        set [y v] to [10]\n    end\nend\nswitch costume to (5 v)\nif <[0] < (x)> then\n    point in direction ((90) + ((x) + (() - (y))))\nend\nif <(x) < [0]> then\n    point in direction ((90) + ((x) + (y)))\nend\nif <[238] < (x position)> then\n    broadcast (reset v)\nend\nif <<(y position) < [-175]> or <touching (attraction v)?>> then\n    broadcast (death v)\nend\nif <touching (スプライト1 v)?> then\n    set [y v] to [15]\nend\nif <touching (attraction2 v)?> then\n    set [x v] to [15]\nend\n\nwhen I receive [reset v]\ngo to x: (-200) y: (0)\nset [y v] to [0]\nset [x v] to [0]\n\nwhen I receive [death v]\ngo to x: (-200) y: (0)\nset [y v] to [0]\nset [x v] to [0]\n\nwhen I receive [gamestart v]\nswitch costume to (5 v)\nshow\ngo to x: (-200) y: (0)\nset [y v] to [0]\nset [x v] to [0]\nforever\n    内部プログラム\nend\n\nwhen flag clicked\n\nset [回数 v] to [1]\n\nwait (1) seconds\n\n@スプライト4\n\n