Elements | A Platformer #Games
@Stage\n\nwhen flag clicked\nset [level v] to [1]\n\nwhen flag clicked\nforever\n    switch backdrop to (Level)\nend\n\nwhen flag clicked\nstart sound [Alan Walker - Force v]\nset volume to (50) %\n\n@Blank\n\n@Player\n\ndefine Platform (jump height) (gravity) (friction) (running speed)\nswitch costume to (still v)\nif <<key (right arrow v) pressed?> or <key (d v) pressed?>> then\n    switch costume to (moving right v)\n    change [x velocity v] by (running speed)\nend\nif <<key (left arrow v) pressed?> or <key (a v) pressed?>> then\n    switch costume to (moving left v)\n    change [x velocity v] by ((running speed) * (-1))\nend\nset [x velocity v] to ((X Velocity) * (friction))\nchange x by (X Velocity)\nif <touching (level v)?> then\n    set [slope v] to [0]\n    repeat until <<(Slope) = [8]> or <not <touching (level v)?>>>\n        change [slope v] by (1)\n        change y by (1)\n    end\n    if <touching (level v)?> then\n        change y by ((Slope) * (-1))\n        repeat ([ceiling v] of ([abs v] of (X Velocity) ) )\n            if <touching (level v)?> then\n                change x by ((([abs v] of (X Velocity) ) / (X Velocity)) * (-1))\n            end\n        end\n    end\n    if <<key (up arrow v) pressed?> or <key (w v) pressed?>> then\n        set [y velocity v] to [10]\n        if <(X Velocity) > [0]> then\n            set [x velocity v] to [-15]\n        else\n            set [x velocity v] to [15]\n        end\n    else\n        set [x velocity v] to [0]\n    end\nend\nchange y by (Y Velocity)\nif <touching (level v)?> then\n    repeat ([ceiling v] of ([abs v] of (Y Velocity) ) )\n        if <touching (level v)?> then\n            change y by ((([abs v] of (Y Velocity) ) / (Y Velocity)) * (-1))\n        end\n    end\n    if <<(([abs v] of (Y Velocity) ) / (Y Velocity)) = [-1]> and <<key (up arrow v) pressed?> or <key (w v) pressed?>>> then\n        set [y velocity v] to (jump height)\n    else\n        set [y velocity v] to [0]\n    end\nelse\n    change [y velocity v] by (-1)\nend\nif <touching (gem v)?> then\n    broadcast (Win v) and wait\nend\n\nwhen flag clicked\nforever\n    if <(X Velocity) > [0.5]> then\n        set [costume v] to [2]\n    else\n        if <[-0.5] > (X Velocity)> then\n            set [costume v] to [1]\n        else\n            set [costume v] to [0]\n        end\n    end\n    if <(Y Velocity) > [0.5]> then\n        set [costume v] to (join (Costume) [3])\n    else\n        if <[-0.5] > (Y Velocity)> then\n            set [costume v] to (join [apple] [2])\n        else\n            set [costume v] to (join [apple] [1])\n        end\n    end\n    switch costume to (Costume)\nend\n\nwhen flag clicked\nforever\n    create clone of (_myself_ v)\nend\n\nwhen I start as a clone\nforever\n    wait (0.15) seconds\n    delete this clone\nend\n\nwhen flag clicked\nif <(Level) = [9]> then\n    broadcast (Go front v)\nend\n\nwhen I receive [go front v]\ngo to x: (-218) y: (-85)\n\nwhen flag clicked\nforever\n    if <(x position) > [220]> then\n        broadcast (next Level v)\n        wait (0.2) seconds\n        change [level v] by (1)\n        go to x: (-215) y: (-100)\n        set [x velocity v] to [0]\n        set [y velocity v] to [0]\n    end\nend\n\nwhen I receive [next level v]\ngo to x: (-215) y: (-100)\n\nwhen I receive [play game v]\ngo to x: (-215) y: (-100)\nset [x velocity v] to [0]\nset [y velocity v] to [0]\nif <(Level) = [9]> then\n    go to x: (-215) y: (-70)\nend\nif <(Level) = [10]> then\n    go to x: (-215) y: (-10)\nend\n\n    \n        Platform (11.5) (-1) (0.7) (3)\n        if <touching (spikes v)?> then\n            go to x: (-215) y: (-100)\n            start sound [Roblox Death Sound - Sound Effect \(HD\) v]\n            set volume to (100) %\n        end\n        if <touching (lava!!!!!!!!!!!!!!!!!!!!!!! v)?> then\n            go to x: (-215) y: (-100)\n            start sound [Roblox Death Sound - Sound Effect \(HD\) v]\n            set volume to (100) %\n        end\n    end\nend\n\n@Level\n\nwhen flag clicked\nforever\n    go to x: (57) y: (48)\n    switch costume to (Level)\nend\n\n@Thumnail\n\nwhen flag clicked\nwait (1) seconds\nbroadcast (Play game v)\n\nwhen flag clicked\nshow\ngo to x: (0) y: (0)\ngo to [front v] layer\nset [ghost v] effect to (100)\nshow\ngo to [front v] layer\nrepeat (10)\n    go to [front v] layer\n    change [ghost v] effect by (-10)\nend\nwait (1) seconds\nbroadcast (start v)\nhide\n\nwhen I receive [win v]\nshow\ngo to x: (0) y: (0)\ngo to [front v] layer\nset [ghost v] effect to (150)\nshow\ngo to [front v] layer\nrepeat (10)\n    go to [front v] layer\n    change [ghost v] effect by (-10)\nend\n\nwhen I receive [win v]\nstart sound [Win v]\n\n@Spikes\n\nwhen flag clicked\nforever\n    go [backward v] (1) layers\n    switch costume to (Level)\nend\n\n@Cloud\n\nwhen flag clicked\nforever\n    if <(Level) = [8]> then\n        hide\n    end\nend\n\nwhen I receive [play game v]\nshow\nforever\n    go to [back v] layer\n    go to (random position v)\n    set x to (250)\n    set y to (pick random (112.5) to (135))\n    switch costume to (pick random (1) to (5))\n    repeat (50)\n        change x by (-10)\n    end\nend\n\n@Level Costume\n\nwhen I receive [go front v]\ngo [forward v] (1) layers\n\n@Next Level\n\nwhen flag clicked\ngo to [front v] layer\nhide\ngo to x: (600) y: (-27)\n\nwhen I receive [next level v]\nshow\nglide (1) secs to x: (0) y: (0)\nwait (1) seconds\nglide (1) secs to x: (-600) y: (-27)\nhide\nclear graphic effects\ngo to x: (600) y: (-27)\n\n@Lava!!!!!!!!!!!!!!!!!!!!!!!\n\nwhen flag clicked\nforever\n    go [backward v] (1) layers\n    switch costume to (Level)\nend\n\nwhen flag clicked\ngo to x: (45) y: (45)\ngo [backward v] (1) layers\nswitch costume to (Level)\nforever\n    set [ghost v] effect to (5)\n    set [brightness v] effect to (3)\n    repeat (20)\n        change y by (1)\n    end\n    repeat (20)\n        change y by (-1)\n    end\nend\n\n@Tens\n\nwhen flag clicked\nset [number v] to [1]\ngo to x: (-145) y: (153)\nforever\n    if <(number) < [10]> then\n        hide\n    else\n        if <<(number) > [10]> or <(number) = [10]>> then\n            show\n            switch costume to (letter (1) of (number))\n        else\n            if <(letter (2) of (number)) = [10]> then\n                switch costume to (0-pixel v)\n            end\n        end\n    end\nend\n\nwhen I receive [next level v]\nwait (0.2) seconds\nchange [number v] by (1)\n\n@Ones\n\nwhen flag clicked\ngo to x: (-126) y: (153)\nforever\n    if <(number) < [10]> then\n        switch costume to (number)\n    else\n        if <(number) > [10]> then\n            switch costume to (letter (2) of (number))\n        else\n            if <(letter (2) of (number)) = [10]> then\n                switch costume to (0-pixel v)\n            end\n            if <(number) > [9]> then\n                switch costume to (number)\n            end\n        end\n    end\nend\n\n@WorkshopX Logo\n\n@Skip Button\n\nwhen flag clicked\nshow\nforever\n    if <(Level) = [11]> then\n        hide\n    end\nend\n\nwhen this sprite clicked\nchange [level v] by (1)\nbroadcast (next Level v)\n\nwhen flag clicked\nshow\n\n@Text\n\nwhen flag clicked\ngo to [back v] layer\nforever\n    go to x: (26) y: (104)\n    switch costume to (Level)\nend\n\n@Gem\n\nwhen flag clicked\nhide\nforever\n    if <(Level) = [11]> then\n        switch costume to (costume1 v)\n        show\n        go to x: (186) y: (-61)\n    end\nend\n\nwhen flag clicked\nhide\n\n@Love fav and follow\n\nwhen I receive [win v]\ngo to [front v] layer\nshow\nforever\n    if <not <touching (mouse-pointer v)?>> then\n        glide (1) secs to x: (0) y: (184)\n    end\n    if <touching (mouse-pointer v)?> then\n        glide (1) secs to x: (0) y: (139.5)\n    end\nend\n\nwhen flag clicked\nhide\n\nwhen I receive [win v]\nforever\n    go to [front v] layer\n    go [forward v] (5) layers\nend\n\n@Menu\n\nwhen flag clicked\npoint in direction (90)\nswitch costume to (costume1 v)\nhide\n\nwhen I receive [start v]\nshow\ncreate clone of (_myself_ v)\n\nwhen I receive [play game v]\nhide\n\nwhen I start as a clone\nswitch costume to (costume2 v)\ngo to [front v] layer\ngo to x: (0) y: (140)\nshow\npoint in direction (82)\nset [turn v] to [0]\nrepeat (4)\n    change [turn v] by (1)\n    turn right (Turn) degrees\nend\nforever\n    repeat (8)\n        change [turn v] by (-1)\n        turn right (Turn) degrees\n    end\n    repeat (8)\n        change [turn v] by (1)\n        turn right (Turn) degrees\n    end\nend\n\n@Play\n\nwhen flag clicked\nhide\n\nwhen I receive [start v]\nshow\nforever\n    if <touching (mouse-pointer v)?> then\n        change size by (((120) - (size)) / (3))\n        set [brightness v] effect to (20)\n        point in direction (([sin v] of ((timer) * (1000)) ) + (90))\n        if <mouse down?> then\n            wait until <not <mouse down?>>\n            broadcast (Play game v)\n            hide\n        end\n    else\n        point in direction (90)\n        change size by (((100) - (size)) / (3))\n        set [brightness v] effect to (0)\n    end\nend\n\n
                             Elements A Platformer\nWelcome to Elements A Platformer. Finish your mission by finding the Fire gem.\n\nMore than 400 views, Thanks all scratchers who viewed it \n\nInstructions:\n-Arrow keys\n-Avoid spikes and lava. (and a surprise in it ; )  )\n-Find the fire gem to win the game.It will be helpful for the next part