Stunt Red 4 | A Mobile Friendly Platformer
@Stage\n\nwhen flag clicked\nswitch backdrop to (backdrop1 v)\nwait (11) seconds\nswitch backdrop to (backdrop16 v)\nbroadcast (Show v)\n\n@Intro\n\ndefine Go to (x) (y) size (size) dir (dir) (cos)\npoint in direction (@cam.dir)\ngo to x: (0) y: (0)\nswitch costume to (hack small v)\nset size to ((@cam.z) * (size)) %\nswitch costume to (cos)\nmove (((x) - (@cam.x)) * (@cam.z)) steps\nturn left (90) degrees\nmove (((y) - (@cam.y)) * (@cam.z)) steps\nturn right (90) degrees\npoint in direction ((@cam.dir) + (dir))\n\nwhen I receive [intro v]\nhide\nset [@slow mo v] to [3]\nset [@cam.dir v] to [90]\nset [@cam.y v] to [0]\nset [@cam.x v] to [0]\nset [name.size v] to [0]\nstart sound [Marshmello - Silence ft. Khalid \(Codeko Remix\) v]\nwait (1) seconds\nset [clone.type v] to [Name]\ncreate clone of (_myself_ v)\nbroadcast (control v)\nbroadcast (dir v)\nbroadcast (▲ v)\nwait (0.87) seconds\n▲\nset [clone.type v] to [Background]\ncreate clone of (_myself_ v)\nforever\n    change [@cam.x v] by (((0) - (@cam.x)) / (9))\n    change [@cam.y v] by (((0) - (@cam.y)) / (9))\n    change [@cam.z v] by (((1) - (@cam.z)) / (9))\n    change [name.size v] by (((100) - (name.size)) / (9))\n    set [shk.y v] to ((shk.y) * (-0.7))\n    set [shk.x v] to ((shk.x) * (-0.7))\n    change [@cam.y v] by (shk.y)\n    change [@cam.x v] by (shk.x)\n    broadcast (tick v)\nend\n\nwhen I start as a clone\nif <(clone.type) = [▲]> then\n    show\n    if <(clone.id) = [1]> then\n        \n            Go to [0] ((▲.position.y) mod (390)) size [100] dir [0] [3]\n            switch costume to (▲ v)\n        end\n    end\n    if <(clone.id) = [2]> then\n        \n            Go to [0] (((▲.position.y) mod (390)) - (390)) size [100] dir [0] [3]\n            switch costume to (▲ v)\n        end\n    end\nend\n\nwhen I receive [▲ v]\nwait (0.87) seconds\nset [▲.position.y v] to [0]\nforever\n    change [▲.position.y v] by ((10) / (@slow mo))\nend\n\ndefine ▲\nset [clone.type v] to [▲]\nset [clone.id v] to [1]\ncreate clone of (_myself_ v)\nset [clone.id v] to [2]\ncreate clone of (_myself_ v)\n\nwhen flag clicked\nbroadcast (Intro v)\ngo to [front v] layer\n\nwhen I receive [control v]\nwait (0.87) seconds\nshk (pick random (15) to (17))\nrepeat (5)\n    change [@slow mo v] by (((1) - (@slow mo)) / (1.2))\nend\nrepeat (10)\n    change [@slow mo v] by (((3) - (@slow mo)) / (2))\nend\nwait (0.23) seconds\nrepeat (4)\n    shk (pick random (15) to (17))\n    repeat (5)\n        change [@slow mo v] by (((1) - (@slow mo)) / (1.2))\n        change [@cam.z v] by (((2) - (@cam.z)) / (9))\n        change [name.size v] by (((115) - (name.size)) / (9))\n    end\n    repeat (10)\n        change [@slow mo v] by (((3) - (@slow mo)) / (2))\n    end\n    wait (0.23) seconds\nend\nrepeat (2)\n    shk (pick random (15) to (17))\n    repeat (5)\n        change [@slow mo v] by (((1) - (@slow mo)) / (1.2))\n        change [@cam.z v] by (((2) - (@cam.z)) / (9))\n        change [name.size v] by (((115) - (name.size)) / (9))\n    end\n    repeat (2)\n        change [@slow mo v] by (((3) - (@slow mo)) / (2))\n    end\nend\nwait (0.2) seconds\nrepeat (5)\n    change [@slow mo v] by (((1) - (@slow mo)) / (1.2))\n    change [@cam.z v] by (((2) - (@cam.z)) / (9))\n    change [name.size v] by (((115) - (name.size)) / (9))\nend\nrepeat (10)\n    change [@slow mo v] by (((3) - (@slow mo)) / (2))\nend\nwait (0.1) seconds\nrepeat (2)\n    shk (pick random (15) to (17))\n    repeat (5)\n        change [@slow mo v] by (((1) - (@slow mo)) / (1.2))\n        change [@cam.z v] by (((2) - (@cam.z)) / (9))\n        change [name.size v] by (((115) - (name.size)) / (9))\n    end\n    repeat (2)\n        change [@slow mo v] by (((3) - (@slow mo)) / (2))\n    end\nend\nwait (0) seconds\nrepeat (2)\n    shk (pick random (15) to (17))\n    repeat (5)\n        change [@slow mo v] by (((1) - (@slow mo)) / (1.2))\n        change [@cam.z v] by (((2) - (@cam.z)) / (9))\n        change [name.size v] by (((115) - (name.size)) / (9))\n    end\n    repeat (2)\n        change [@slow mo v] by (((3) - (@slow mo)) / (2))\n    end\nend\nrepeat (3)\n    shk (pick random (15) to (17))\n    repeat (5)\n        change [@slow mo v] by (((1) - (@slow mo)) / (1.2))\n        change [@cam.z v] by (((2) - (@cam.z)) / (9))\n        change [name.size v] by (((115) - (name.size)) / (9))\n    end\n    repeat (10)\n        change [@slow mo v] by (((3) - (@slow mo)) / (2))\n    end\n    wait (0.23) seconds\nend\n\nwhen I receive [dir v]\nwait (0.87) seconds\nset [dir v] to [90]\nrepeat (185)\nrepeat (5)\nset [dir v] to [90]\nset [timer v] to [2]\nrepeat (30)\n    change [dir v] by (((450) - (dir)) / (6))\nend\n\nwhen I receive [dir v]\nset [timer v] to [0]\n\n    set [@cam.dir v] to ((dir) + (([sin v] of ((timer) * (250)) ) * (2)))\n    change [timer v] by ((0.2) / (@slow mo))\nend\n\ndefine shk (amount)\nif <(pick random (0) to (1)) = [1]> then\n    if <(pick random (0) to (1)) = [1]> then\n        change [shk.x v] by (() - (amount))\n    else\n        change [shk.x v] by (16)\n    end\nelse\n    if <(pick random (0) to (1)) = [1]> then\n        change [shk.y v] by (() - (amount))\n    else\n        change [shk.y v] by (amount)\n    end\nend\n\nif <(pick random (0) to (1)) = [1]> then\n    if <(pick random (0) to (1)) = [1]> then\n        set [shk.x v] to [-16]\n    else\n        set [shk.x v] to [16]\n    end\nelse\n    if <(pick random (0) to (1)) = [1]> then\n        set [shk.y v] to [-16]\n    else\n        set [shk.y v] to [16]\n    end\nend\n\nwhen I start as a clone\nif <(clone.type) = [Background]> then\n    show\n    forever\n        set [ghost v] effect to (25)\n        go to [back v] layer\n        Go to [0] [0] size [100] dir [0] [4]\n    end\nend\n\nwhen I receive [intro v]\nwait (10.2) seconds\nshow\nset [x v] to [720]\nrepeat until <(round (x)) = [0]>\n    Go to (x) [0] size [100] dir [0] [5]\n    go to [front v] layer\n    change [x v] by (((0) - (x)) / (6))\nend\nbroadcast (Clear all v)\nwait (1) seconds\nset [effects.ghost v] to [0]\nrepeat (20)\n    change [effects.ghost v] by (((100) - (effects.ghost)) / (6))\n    set [ghost v] effect to (effects.ghost)\nend\n\nwhen I start as a clone\nif <(clone.type) = [Name]> then\n    show\n    go to [front v] layer\n    set [yv v] to [20]\n    set [name.size v] to [0]\n    repeat (3)\n        point in direction (90)\n        change [name.size v] by (yv)\n        change [yv v] by (-1.35)\n        switch costume to (hack big v)\n        set size to (name.size) %\n        switch costume to (name v)\n    end\n    repeat until <(timer) > [1.85]>\n        go to x: (0) y: (0)\n        change [name.size v] by (yv)\n        change [yv v] by (-1.35)\n        switch costume to (hack small v)\n        set size to (name.size) %\n        switch costume to (name v)\n    end\n    repeat (20)\n        Go to [0] [0] size (name.size) dir (([sin v] of ((timer) * (150)) ) * (2)) [6]\n        switch costume to (name v)\n        change [@cam.z v] by (((0.9) - (@cam.z)) / (15))\n    end\n    \n        Go to [0] [0] size (name.size) dir (([sin v] of ((timer) * (150)) ) * (2)) [6]\n        switch costume to (name v)\n    end\nend\n\nwhen I receive [clear all v]\ndelete this clone\n\nwhen I receive [intro v]\nwait until <(timer) > [1.85]>\n\nwhen flag clicked\nwait (10) seconds\ngo to [back v] layer\nhide\n\n@Player\n\nwhen flag clicked\nset [player: x velocity v] to [0]\nset [player: y velocity v] to [0]\nset [animation v] to [0]\ngo to x: (-200) y: (0)\nforever\n    set [ghost v] effect to (0)\n    switch costume to (1 v)\n    if <<<key (left arrow v) pressed?> or <key (a v) pressed?>> or <<mouse down?> and <(mouse x) < (x position)>>> then\n        change [player: x velocity v] by (-0.8)\n        switch costume to (2 v)\n    end\n    if <<<key (right arrow v) pressed?> or <key (d v) pressed?>> or <<mouse down?> and <(mouse x) > (x position)>>> then\n        change [player: x velocity v] by (0.8)\n        switch costume to (3 v)\n    end\n    set [player: x velocity v] to ((Player: x velocity) * (0.9))\n    change x by (round (Player: x velocity))\n    if <touching (ground v)?> then\n        change y by (1)\n        if <touching (ground v)?> then\n            change y by (1)\n        end\n        if <touching (ground v)?> then\n            change y by (1)\n            if <touching (ground v)?> then\n                change y by (1)\n            end\n            if <touching (ground v)?> then\n                change y by (1)\n                if <touching (ground v)?> then\n                    change y by (1)\n                    if <touching (ground v)?> then\n                        change y by (-6)\n                        change x by (round ((Player: x velocity) * (-1)))\n                    end\n                end\n            end\n            set [player: x velocity v] to [0]\n        end\n    end\n    if <<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <<mouse down?> and <(mouse y) > (y position)>>> then\n        change y by (-1)\n        if <touching (ground v)?> then\n            set [player: y velocity v] to [12]\n        end\n        change y by (1)\n    end\n    change [player: y velocity v] by (-1)\n    change y by (Player: y velocity)\n    if <touching (ground v)?> then\n        change y by ((Player: y velocity) * (-1))\n        set [player: y velocity v] to [0]\n    end\n    if <<touching (danger v)?> or <touching (lava3 v)?>> then\n        start sound [recording3 v]\n        set [animation v] to [0]\n        repeat (4)\n            create clone of (_myself_ v)\n            change [ghost v] effect by (10)\n        end\n        repeat (6)\n            change [ghost v] effect by (10)\n        end\n        wait until <(Animation) = [4]>\n        set [player: x velocity v] to [0]\n        set [player: y velocity v] to [0]\n        set [animation v] to [0]\n        go to x: (-200) y: (0)\n    end\n    if <(x position) > [240]> then\n        broadcast (Next v) and wait\n    end\nend\n\nwhen I start as a clone\nswitch costume to (4 v)\npoint in direction (pick random (-45) to (45))\nchange y by (10)\nrepeat (14)\n    move (3) steps\nend\nchange [animation v] by (1)\ndelete this clone\n\nwhen I receive [next v]\nset [player: x velocity v] to [0]\nset [player: y velocity v] to [0]\nset [animation v] to [0]\ngo to x: (-200) y: (0)\n\nwhen flag clicked\nforever\n    if <key (r v) pressed?> then\n        go to x: (-200) y: (0)\n    end\nend\n\nwhen I receive [intro v]\nhide\n\nwhen I receive [show v]\nshow\nrepeat (1)\n    go to x: (-200) y: (0)\nend\n\n@Ground\n\nwhen flag clicked\nswitch costume to (1 v)\n\nwhen I receive [next v]\nnext costume\n\nwhen I receive [intro v]\nhide\n\nwhen I receive [show v]\nshow\n\n@Thumbnail\n\nwhen flag clicked\nrepeat (2)\n    go to [front v] layer\nend\nset [ghost v] effect to (0)\nwait (1) seconds\nrepeat (50)\n    change [ghost v] effect by (2)\nend\n\n
Welcome, my friends, to STUNT RED 4. \n\nR for restart \nSet a stopwatch and comment how many seconds it took you to speed run