Frog Platformer
@Stage\n\n@hitbox\n\nwhen flag clicked\nshow\nset size to (50) %\nset [spawn x v] to [-212]\nset [spawn y v] to [-30]\ngo to x: (spawn x) y: (spawn y)\nset rotation style [left-right v]\nset [x vel v] to [0]\nset [y vel v] to [0]\nset [ghost v] effect to (100)\nforever\n    broadcast (follow hitbox v)\n    up/down movement [16] [-1]\n    left/right movement [10] [0.6]\n    next level\n    fall off screen\nend\n\ndefine up/down movement (jump height) (fall speed)\nchange y by (y vel)\nif <touching (level v)?> then\n    repeat ([ceiling v] of ([abs v] of (y vel) ) )\n        if <touching (level v)?> then\n            change y by (((y vel) / ([abs v] of (y vel) )) * (-1))\n        end\n    end\n    if <<not <(y vel) > [0]>> and <<key (up arrow v) pressed?> or <key (w v) pressed?>>> then\n        set [y vel v] to (jump height)\n        start sound [Croak v]\n    else\n        set [y vel v] to [0]\n    end\nelse\n    change [y vel v] by (fall speed)\nend\n\ndefine left/right movement (move speed) (drag)\nchange x by (x vel)\nif <touching (level v)?> then\n    repeat ([ceiling v] of ([abs v] of (x vel) ) )\n        if <touching (level v)?> then\n            change x by (((x vel) / ([abs v] of (x vel) )) * (-1))\n        end\n    end\n    set [x vel v] to [0]\nend\nif <<key (right arrow v) pressed?> or <key (d v) pressed?>> then\n    set [x vel v] to (move speed)\nelse\n    if <<key (left arrow v) pressed?> or <key (a v) pressed?>> then\n        set [x vel v] to ((move speed) * (-1))\n    end\nend\nset [x vel v] to ((x vel) * (drag))\n\ndefine next level\nif <(x position) > [242]> then\n    broadcast (next level v)\n    go to x: (spawn x) y: (spawn y)\nend\n\ndefine fall off screen\nif <(y position) < [-170]> then\n    go to x: (spawn x) y: (spawn y)\nend\n\n@player\n\nwhen I receive [follow hitbox v]\ngo to (hitbox v)\n\nwhen flag clicked\nswitch costume to (costume1 v)\nset rotation style [left-right v]\npoint in direction (90)\nforever\n    if <<key (right arrow v) pressed?> or <key (d v) pressed?>> then\n        switch costume to ((costume [number v]) + (1))\n        point in direction (90)\n    else\n        if <<key (left arrow v) pressed?> or <key (a v) pressed?>> then\n            switch costume to ((costume [number v]) - (1))\n            point in direction (-90)\n        else\n            switch costume to (costume1 v)\n        end\n    end\n    wait (0.04) seconds\nend\n\n@cloud\n\nwhen flag clicked\nhide\nforever\n    wait (pick random (2) to (5)) seconds\n    create clone of (_myself_ v)\nend\n\nwhen I start as a clone\nset [ghost v] effect to (40)\nswitch costume to (pick random (1) to (5))\nshow\ngo to x: (303) y: (pick random (75) to (175))\nglide (4) secs to x: (-303) y: (y position)\ndelete this clone\n\n@level\n\nwhen flag clicked\nset [level v] to [1]\ngo to x: (0) y: (0)\nswitch costume to (costume1 v)\n\nwhen I receive [next level v]\nchange [level v] by (1)\nnext costume\n\n@thumbnail\n\nwhen flag clicked\nforever\n    set [ghost v] effect to (100)\n    go to [front v] layer\nend\n\n
Use WASD or arrow keys to move.\n\n#platformer\n\n\nNew Game: https://scratch.mit.edu/projects/676308978/