Sonic Platformer | Mobile friendly  #games #sonic #platformer
@Stage\n\nwhen I receive [green flag clicked  v]\nset [level v] to [1]\nswitch backdrop to (sega v)\nbroadcast (SEGA v)\n\nwhen flag clicked\nset [goal v] to [0]\nset [lives v] to [5]\nset [rings v] to [0]\nhide variable [time v]\nhide variable [lives v]\nhide variable [total rings v]\nhide variable [total time v]\nhide variable [rings v]\nbroadcast (Green flag clicked  v)\n\nwhen I receive [sonic intro v]\nswitch backdrop to (background v)\nplay sound [sonic intro v] until done\nbroadcast (Black screen before game v)\n\nwhen I receive [game begins  v]\nforever\n    play sound [Green Hill Zone v] until done\nend\n\nwhen I receive [game begins  v]\nwait (1) seconds\nshow variable [lives v]\nshow variable [rings v]\nshow variable [time v]\nreset timer\nforever\n    set [time v] to (timer)\n    if <(Goal) = [1]> then\n        stop all sounds\n        stop [other scripts in sprite v]\n        stop [this script v]\n    end\nend\n\nwhen I receive [sonic intro v]\nforever\n    if <mouse down?> then\n        stop [other scripts in sprite v]\n        broadcast (Black screen before game v)\n        stop [this script v]\n    end\nend\n\nwhen I receive [game over v]\nstop [other scripts in sprite v]\nstop all sounds\n\n@Intro Sonic\n\nwhen I receive [sonic intro v]\nshow\ngo to x: (0) y: (64)\ngo to [front v] layer\nswitch costume to (sonic1 v)\nrepeat (5)\n    next costume\n    wait (0.12) seconds\nend\nforever\n    switch costume to (sonic7 v)\n    wait (0.2) seconds\n    switch costume to (sonic8 v)\n    wait (0.2) seconds\nend\n\nwhen I receive [green flag clicked  v]\nhide\n\nwhen I receive [game begins  v]\nstop [other scripts in sprite v]\nhide\n\n@Sonic intro back\n\nwhen I receive [sonic intro v]\nshow\n\nwhen I receive [green flag clicked  v]\nhide\n\nwhen I receive [game begins  v]\nstop [other scripts in sprite v]\nhide\n\n@SEGA\n\nwhen I receive [green flag clicked  v]\nset [ghost v] effect to (100)\nhide\n\nwhen I receive [sega v]\nshow\nwait (1) seconds\nrepeat (10)\n    change [ghost v] effect by (-10)\nend\nplay sound [sega v] until done\nrepeat (10)\n    change [ghost v] effect by (10)\nend\nhide\nbroadcast (sonic intro v)\n\n@Level\n\nwhen I receive [green flag clicked  v]\nhide\n\nwhen I receive [game begins  v]\ngo to [back v] layer\nset [level v] to [1]\nshow\ngo to x: (0) y: (0)\nswitch costume to (l1 v)\nforever\n    switch costume to (Level)\nend\n\nwhen I receive [goal v]\nstop [other scripts in sprite v]\n\n@Meto bug\n\nwhen I receive [green flag clicked  v]\nhide\n\nwhen I receive [game begins  v]\nset rotation style [left-right v]\nwait until <(Level) = [7]>\nshow\ngo to x: (0) y: (-97)\nrepeat until <(Level) = [8]>\n    point in direction (90)\n    repeat (20)\n        change x by (5)\n    end\n    point in direction (-90)\n    repeat (20)\n        change x by (-5)\n    end\nend\nhide\nwait until <(Level) = [9]>\nshow\ngo to x: (130) y: (-56)\nrepeat until <(Level) = [10]>\n    point in direction (90)\n    repeat (20)\n        change x by (5)\n    end\n    point in direction (-90)\n    repeat (20)\n        change x by (-5)\n    end\nend\nhide\n\nwhen I receive [kill rollerbug v]\nstart sound [enemy dead v]\nhide\n\nwhen I receive [game begins  v]\nforever\n    if <(Level) = [8]> then\n        hide\n    end\n    if <(Level) = [10]> then\n        hide\n    end\nend\n\n@Ending sign\n\nwhen flag clicked\nhide\n\nwhen I receive [game begins  v]\ngo to [back v] layer\nswitch costume to (costume2 v)\nwait until <(Level) = [10]>\nshow\nwait until <touching (sonic v)?>\nbroadcast (Goal v)\nset [goal v] to [1]\nwait (0) seconds\nstart sound [goal v]\nrepeat (3)\n    switch costume to (costume2 v)\n    repeat (14)\n        next costume\n    end\nend\nplay sound [Act Clear v] until done\n\n@Sonic\n\nwhen I receive [game begins  v]\nshow\n\nwhen I receive [green flag clicked  v]\npoint in direction (90)\nset size to (125) %\nhide\n\nwhen I receive [start animating  v]\nshow\nforever\n    Animate running\nend\n\ndefine Animate running\nset rotation style [left-right v]\nif <<key (right arrow v) pressed?> or <<key (left arrow v) pressed?> or <<mouse down?> and <<(mouse x) < (x position)> or <(mouse x) > (x position)>>>>> then\n    switch costume to (s1 v)\n    repeat (9)\n        next costume\n        if <<key (up arrow v) pressed?> or <<mouse down?> and <(mouse y) > (y position)>>> then\n            repeat until <(JUMP?) = [0]>\n                switch costume to (sjump3 v)\n                repeat (3)\n                    next costume\n                end\n            end\n            switch costume to (stand v)\n        end\n    end\nend\nif <<key (up arrow v) pressed?> or <<mouse down?> and <(mouse y) > (y position)>>> then\n    repeat until <(JUMP?) = [0]>\n        switch costume to (sjump3 v)\n        repeat (3)\n            next costume\n        end\n    end\nend\nif <not <<key (up arrow v) pressed?> or <<key (right arrow v) pressed?> or <key (left arrow v) pressed?>>>> then\n    switch costume to (stand v)\nend\n\nwhen I receive [start animating  v]\nforever\n    Sound effects\nend\n\ndefine Sound effects\nif <<key (up arrow v) pressed?> or <<mouse down?> and <(mouse y) > (y position)>>> then\n    play sound [jump v] until done\n    wait until <(JUMP?) = [0]>\nend\n\ndefine Directions\nif <<key (right arrow v) pressed?> or <<mouse down?> and <(mouse x) > (x position)>>> then\n    point in direction (90)\nend\nif <<key (left arrow v) pressed?> or <<mouse down?> and <(mouse x) < (x position)>>> then\n    point in direction (-90)\nend\n\nwhen I receive [start animating  v]\nforever\n    Directions\nend\n\nif <(x position) > [230]> then\n    go to x: (-132) y: (-83)\n    change [level v] by (1)\nend\n\nwhen I receive [die v]\nstart sound [death v]\nwait (0) seconds\nrepeat (15)\n    switch costume to (die v)\nend\nwait (0) seconds\n\nwhen I receive [game begins  v]\nbroadcast (Start animating  v)\n\nwhen I receive [start animating  v]\nshow\nforever\n    go to (sonic hitbox v)\nend\n\nwhen I receive [goal v]\nstop [other scripts in sprite v]\nbroadcast (Go to hitbox when goal v)\npoint in direction (90)\nswitch costume to (s1 v)\nrepeat (9)\n    next costume\nend\nswitch costume to (stand v)\npoint in direction (-90)\nwait (1) seconds\nstop [other scripts in sprite v]\ngo to x: (160) y: (-70)\nswitch costume to (sonic bounce v)\nset size to (35) %\nrepeat (18)\n    wait (.01) seconds\n    next costume\nend\n\nwhen I receive [go to hitbox when goal v]\nforever\n    go to (sonic hitbox v)\nend\n\nwhen I receive [game over v]\nstop [other scripts in sprite v]\nswitch costume to (die v)\n\n@Sonic hitbox\n\nwhen I receive [green flag clicked  v]\nhide\n\nwhen I receive [game begins  v]\nset [speed x v] to [0]\nset [speed y v] to [0]\nX start\nset [ghost v] effect to (100)\nshow\nforever\n    Jump engine | Jump height [13] Gravity [-1]\nend\n\ndefine Jump engine | Jump height (jump height) Gravity (gravity)\nchange [speed y v] by (gravity)\nif <touching (level v)?> then\n    change y by (1)\nend\nchange y by (speed y)\nif <touching (level v)?> then\n    change y by ((speed y) * (-1))\n    set [speed y v] to [0]\n    set [jump? v] to [0]\nend\nchange y by (-1)\nif <<touching (level v)?> and <<key (up arrow v) pressed?> or <<mouse down?> and <(mouse y) > (y position)>>>> then\n    set [speed y v] to (jump height)\n    set [jump? v] to [1]\nend\nchange y by (1)\nif <(x position) > [230]> then\n    X start\n    change [level v] by (1)\nend\n\ndefine X start\ngo to x: (-150) y: (-83)\n\nwhen I receive [game begins  v]\nset [die? v] to [0]\nforever\n    if <<touching (spikes v)?> or <(y position) < [-160]>> then\n        Die\n    end\n    if <touching (meto bug v)?> then\n        if <(JUMP?) = [1]> then\n            broadcast (Kill rollerbug v)\n            set [speed y v] to [15]\n        else\n            Die\n        end\n    end\n    if <touching (chopper v)?> then\n        if <(JUMP?) = [1]> then\n            broadcast (Kill chopper v)\n            set [speed y v] to [15]\n        else\n            Die\n        end\n    end\n    if <touching (chopper2 v)?> then\n        if <(JUMP?) = [1]> then\n            broadcast (Chopper2 die v)\n            set [speed y v] to [15]\n        else\n            Die\n        end\n    end\nend\n\ndefine Run engine | Speed (speed) Friction (friction)\nif <<key (right arrow v) pressed?> or <<mouse down?> and <(mouse x) > (x position)>>> then\n    change [speed x v] by (speed)\nend\nif <<key (left arrow v) pressed?> or <<mouse down?> and <(mouse x) < (x position)>>> then\n    change [speed x v] by (() - (speed))\nend\nset [speed x v] to ((speed x) * (friction))\nchange x by (speed x)\nif <touching (level v)?> then\n    change x by ((speed x) * (-1))\n    set [speed x v] to [0]\nend\n\nwhen I receive [move left and right v]\nforever\n    Run engine | Speed [2.5] Friction [0.8]\n    if <(Die?) = [1]> then\n        stop [this script v]\n    end\nend\n\nwhen I receive [game begins  v]\nbroadcast (Move left and right v)\n\ndefine Die\nchange [lives v] by (-1)\nset [die? v] to [1]\nbroadcast (Die v)\nchange [speed y v] by (20)\nwait (0.5) seconds\nif <(LIVES) < [1]> then\n    broadcast (Game Over v)\n    stop [other scripts in sprite v]\n    stop [this script v]\nend\nX start\nset [die? v] to [0]\nbroadcast (Move left and right v)\nset [speed x v] to [0]\nset [speed y v] to [0]\n\nwhen I receive [goal v]\nstop [other scripts in sprite v]\nGet down to ground when goal\nrepeat (10)\n    change x by (10)\nend\n\ndefine Get down to ground when goal\nrepeat until <touching (level v)?>\n    change y by (-1)\nend\n\n@Green hill text\n\nwhen I receive [green flag clicked  v]\nset [ghost v] effect to (100)\nhide\n\nwhen I receive [black screen before game v]\ngo to x: (0) y: (0)\nswitch costume to (black v)\ngo to [front v] layer\nshow\nrepeat (10)\n    change [ghost v] effect by (-10)\nend\nwait (0.5) seconds\nswitch costume to (green hill zone act 1 v)\nbroadcast (Game begins  v)\nwait (1) seconds\nrepeat (10)\n    change [ghost v] effect by (10)\nend\nhide\n\n@Spikes\n\nwhen I receive [green flag clicked  v]\nhide\n\nwhen I receive [game begins  v]\nset [level v] to [1]\nshow\ngo to x: (0) y: (0)\nswitch costume to (l1 v)\nforever\n    go to [back v] layer\n    switch costume to (Level)\nend\n\n@Thumbnail\n\nwhen flag clicked\ngo to x: (0) y: (0)\nshow\ngo to [front v] layer\nset [ghost v] effect to (100)\n\n@chopper\n\nwhen I receive [green flag clicked  v]\nhide\n\nwhen I receive [game begins  v]\nset rotation style [left-right v]\nwait until <(Level) = [6]>\nshow\ngo to x: (-50) y: (-180)\ngo to [back v] layer\nrepeat until <(Level) = [7]>\n    switch costume to (costume1 v)\n    repeat (20)\n        change y by (10)\n    end\n    switch costume to (costume2 v)\n    repeat (20)\n        change y by (-10)\n    end\nend\nhide\n\nwhen I receive [kill chopper v]\nstart sound [enemy dead v]\nhide\n\nwhen I receive [game begins  v]\nforever\n    if <(Level) = [7]> then\n        hide\n    end\nend\n\n@Time word\n\nwhen I receive [green flag clicked  v]\nhide\n\nwhen I receive [game begins  v]\ngo to x: (-196) y: (142)\nshow\n\n@Lives\n\nwhen flag clicked\ngo to x: (-211) y: (-164)\nhide\n\nhide variable [lives v]\n\nwhen I receive [game begins  v]\nshow\n\nwait (1) seconds\nshow variable [lives v]\n\n@Sprite1\n\nwhen I receive [green flag clicked  v]\nhide\ngo to x: (6) y: (0)\n\nwhen I receive [game over v]\nshow\nwait (0) seconds\nplay sound [sonic game over v] until done\n\n@chopper2\n\nwhen I receive [green flag clicked  v]\nhide\n\nwhen I receive [game begins  v]\nset rotation style [left-right v]\nwait until <(Level) = [6]>\nshow\ngo to x: (50) y: (-180)\ngo to [back v] layer\nrepeat until <(Level) = [7]>\n    switch costume to (costume1 v)\n    repeat (20)\n        change y by (10)\n    end\n    switch costume to (costume2 v)\n    repeat (20)\n        change y by (-10)\n    end\nend\nhide\n\nwhen I receive [chopper2 die v]\nstart sound [enemy dead v]\nhide\n\nwhen I receive [game begins  v]\nforever\n    if <(Level) = [7]> then\n        hide\n    end\nend\n\n@Rings word\n\nwhen I receive [green flag clicked  v]\nhide\n\nwhen I receive [game begins  v]\ngo to x: (-186) y: (100)\nshow\n\n@RINGS\n\nwhen I receive [green flag clicked  v]\nhide\n\nwhen I receive [game begins  v]\nset size to (150) %\ngo to [back v] layer\nwait until <(Level) = [1]>\nbroadcast (Delete previous level rings v)\nPlace rings at X [16] Y [32]\nPlace rings at X [85] Y [32]\nwait until <(Level) = [2]>\nbroadcast (Delete previous level rings v)\nPlace rings at X [0] Y [0]\nPlace rings at X [100] Y [20]\nwait until <(Level) = [3]>\nbroadcast (Delete previous level rings v)\nPlace rings at X [-20] Y [10]\nPlace rings at X [30] Y [10]\nPlace rings at X [80] Y [10]\nwait until <(Level) = [4]>\nbroadcast (Delete previous level rings v)\nPlace rings at X [35] Y [-40]\nwait until <(Level) = [5]>\nbroadcast (Delete previous level rings v)\nPlace rings at X [-10] Y [25]\nPlace rings at X [150] Y [-50]\nwait until <(Level) = [6]>\nbroadcast (Delete previous level rings v)\nPlace rings at X [-50] Y [50]\nPlace rings at X [50] Y [50]\nwait until <(Level) = [7]>\nbroadcast (Delete previous level rings v)\nPlace rings at X [-50] Y [0]\nPlace rings at X [50] Y [0]\nwait until <(Level) = [8]>\nbroadcast (Delete previous level rings v)\nPlace rings at X [0] Y [0]\nPlace rings at X [50] Y [20]\nwait until <(Level) = [9]>\nbroadcast (Delete previous level rings v)\nPlace rings at X [50] Y [20]\nPlace rings at X [80] Y [20]\nPlace rings at X [110] Y [20]\n\ndefine Place rings at X (x) Y (y)\ngo to x: (x) y: (y)\ncreate clone of (_myself_ v)\n\nwhen I start as a clone\nshow\nforever\n    next costume\n    wait (0.08) seconds\nend\n\nwhen I start as a clone\nforever\n    if <touching (sonic hitbox v)?> then\n        start sound [ring v]\n        change [rings v] by (1)\n        delete this clone\n    end\nend\n\nwhen I receive [delete previous level rings v]\ndelete this clone\n\n@total\n\nwhen I receive [green flag clicked  v]\nhide\n\nwhen I receive [goal v]\nwait (3) seconds\nshow\nset [total rings v] to (Rings)\nset [total time v] to (Time)\nshow variable [total rings v]\nshow variable [total time v]\n\n
Oh hi! Welcome to Sonic platformer | Mobile friendly!\n\nCONTROLS…\n\n-Wait a few seconds at the title screen or click the screen to begin the game.\n\n-Use the arrow key’s or touchscreen to move.\n\n-Avoid spikes\n\n-Jump on or avoid enemy’s\n\n\nThat’s it! Enjoy!