Platformer Tutorial + Script                                      #music #platformer #tutorial #all


@Stage\n\n@Player\n\nwhen flag clicked\nif <(t.tutorial_on?) = [true]> then\n    hide\nelse\n    show\n    Reset Player Data\n    forever\n        Player Tick [3] [.7] Console <<key (right arrow v) pressed?> or <key (d v) pressed?>> <<key (left arrow v) pressed?> or <key (a v) pressed?>> <<key (up arrow v) pressed?> or <key (w v) pressed?>>\n    end\nend\n\ndefine Player Tick (speed) (friction) Console <right> <left> <up>\nset [x_vel v] to (((X_Vel) + ((<right> - <left>) * (speed))) * (friction))\npoint in direction ((([abs v] of (X_Vel) ) / (X_Vel)) * (90))\nchange x by (X_Vel)\nif <touching (levels v)?> then\n    set [slope v] to [0]\n    repeat until <<(Slope) = [10]> or <not <touching (levels v)?>>>\n        change [slope v] by (1)\n        change y by (1)\n    end\n    if <touching (levels v)?> then\n        change y by ((Slope) * (-1))\n        repeat until <not <touching (levels v)?>>\n            change x by ((([abs v] of (X_Vel) ) / (X_Vel)) * (-1))\n        end\n        if <up> then\n            set [y_vel v] to [12]\n            if <(([abs v] of (X_Vel) ) / (X_Vel)) = [1]> then\n                set [x_vel v] to [-24]\n            else\n                set [x_vel v] to [24]\n            end\n        else\n            set [x_vel v] to [0]\n        end\n    end\nend\nif <<up> and <(Jumping) < [3]>> then\n    set [y_vel v] to [12]\nelse\n    change [y_vel v] by (-1)\nend\nchange [jumping v] by (1)\nchange y by (Y_Vel)\nif <touching (levels v)?> then\n    repeat until <not <touching (levels v)?>>\n        change y by ((([abs v] of (Y_Vel) ) / (Y_Vel)) * (-1))\n    end\n    if <(([abs v] of (Y_Vel) ) / (Y_Vel)) = [-1]> then\n        set [jumping v] to [0]\n    end\n    set [y_vel v] to [0]\nend\n\ndefine Reset Player Data\nset rotation style [left-right v]\ngo to x: (-120) y: (-20)\nset [jumping v] to [0]\nset [slope v] to [0]\nset [x_vel v] to [0.000001]\nset [y_vel v] to [-0.00001]\n\n@Levels\n\nwhen flag clicked\nset [t.tutorial_on? v] to [true]\nif <(t.tutorial_on?) = [true]> then\n    hide\nelse\n    set [level v] to [1]\n    forever\n        show\n        switch costume to (Level)\n    end\nend\n\n@Tutorial\n\nwhen flag clicked\nswitch costume to (0 v)\nset [costume v] to [0]\nshow list [see wild encounter! from tacqbros v]\ndelete all of [see wild encounter! from tacqbros v]\nadd [Wild Encounter! #Animation] to [see wild encounter! from tacqbros v]\nadd [https://scratch.mit.edu/projects/411352091] to [see wild encounter! from tacqbros v]\nadd [Copy + Paste] to [see wild encounter! from tacqbros v]\nforever\n    switch costume to (Costume)\n    if <<<key (enter v) pressed?> or <key (space v) pressed?>> or <<key (right arrow v) pressed?> or <mouse down?>>> then\n        change [costume v] by (1)\n        wait until <not <<<key (enter v) pressed?> or <key (space v) pressed?>> or <<key (right arrow v) pressed?> or <mouse down?>>>>\n    end\n    if <key (left arrow v) pressed?> then\n        change [costume v] by (-1)\n        wait until <not <key (left arrow v) pressed?>>\n    end\n    if <(costume [name v]) = [23]> then\n        hide list [see wild encounter! from tacqbros v]\n    else\n        show list [see wild encounter! from tacqbros v]\n    end\nend\n\nwhen flag clicked\nset [m.on? v] to [true]\nforever\n    play sound [BG music \(by me\) v] until done\nend\n\nwhen [timer v] > (0.01)\nshow list [see wild encounter! from tacqbros v]\nplay sound [BG music \(by me\) v] until done\n\nwhen flag clicked\nforever\n    if <(m.on?) = [true]> then\n    else\n        stop all sounds\n    end\n    if <key (m v) pressed?> then\n        if <(m.on?) = [true]> then\n            set [m.on? v] to [false]\n        else\n            set [m.on? v] to [true]\n        end\n        wait until <not <key (m v) pressed?>>\n    end\nend\n\n@thumb\n\nwhen flag clicked\nforever\n    go to [front v] layer\n    set [ghost v] effect to (100)\nend\n\n@icon\n\nwhen flag clicked\nforever\n    reset timer\nend\n\nwhen flag clicked\nforever\n    show\n    go to x: (200) y: (-140)\n    set size to (25) %\n    set [ghost v] effect to (70)\nend\n\nwhen [timer v] > (0.01)\nhide\n\n