# 100 Scratch Coding Recipes & Reusable Mechanics > Copy-and-learn single-mechanic recipes for platformer physics, UI bars, clones, audio, lists, save codes, and visual polish. 100 reusable Scratch 3.0 recipes covering movement, coyote time, hitboxes, Pen HUDs, lists, save codes, and optimization. ## Browse all 100 Scratch recipes Pick the exact mechanic your current project needs and test it in 5 minutes. - [Scratch Recipe: Smooth 4-Direction Walking](/en/recipes/smooth-walk/): Use change x/y inside a single forever loop with separate if checks for crisp diagonal movement. - [Scratch Recipe: Icy Momentum & Friction](/en/recipes/velocity-slide/): Add acceleration to x_vel on key press and multiply x_vel by 0.85 each frame. - [Scratch Recipe: Quick Dash with Cooldown](/en/recipes/dash-burst/): Trigger a 6-frame high-speed burst and lock re-triggering via timer + cooldown. - [Scratch Recipe: Platformer Coyote Time](/en/recipes/coyote-time/): Track frames_since_ground and allow jumping while frames_since_ground < 5. - [Scratch Recipe: Platformer Jump Buffering](/en/recipes/jump-buffer/): Remember a jump press for 5 frames so pressing slightly before landing still jumps. - [Scratch Recipe: Hold-to-Jump-Higher Control](/en/recipes/variable-jump/): Cut upward y_vel in half when the jump key is released early. - [Scratch Recipe: Jump-Through One-Way Platforms](/en/recipes/one-way-platform/): Collide with the platform top only when y_vel <= 0 and player feet were above it. - [Scratch Recipe: Bouncy Spring Pad Boost](/en/recipes/spring-pad/): Set y_vel to +18 and play a boing sound whenever touching a spring sprite. - [Scratch Recipe: Moving Conveyor Belt Floor](/en/recipes/conveyor-belt/): Add +3 or -3 to player x whenever standing on a conveyor sprite. - [Scratch Recipe: Underwater Gravity & Swim](/en/recipes/water-swim/): Reduce gravity to -0.3 and cap fall speed to -4 while touching water. - [Scratch Recipe: Climbable Ladder Mechanic](/en/recipes/ladder-climb/): Disable gravity while touching a ladder and move vertically with Up/Down arrows. - [Scratch Recipe: Directional Hit Knockback](/en/recipes/knockback-hit/): Push the player away from enemy x_position and add a small upward hop on damage. - [Scratch Recipe: Arcade Screen Edge Wrapping](/en/recipes/screen-wrap/): Teleport x from +240 to -240 (and vice versa) like classic space arcade games. - [Scratch Recipe: Keep Sprite Inside Stage Bounds](/en/recipes/clamp-bounds/): Clamp x between -220 and 220 and y between -160 and 160 every frame. - [Scratch Recipe: Smooth Angle Turning Toward Target](/en/recipes/smooth-rotate/): Compute shortest signed angle difference and turn by a fraction each frame. - [Scratch Recipe: Elastic Mouse Pointer Follow](/en/recipes/mouse-ease/): Change x by (mouse x - x)/6 and y by (mouse y - y)/6 for silky trailing. - [Scratch Recipe: Orbit One Sprite Around Another](/en/recipes/orbit-sprite/): Set x = center_x + r*sin(angle) and y = center_y + r*cos(angle). - [Scratch Recipe: Gentle Floating Pickup Bob](/en/recipes/sine-bob/): Offset y by sin(timer * 220) * 8 to make coins and power-ups look alive. - [Scratch Recipe: Button Hover Scale Pop](/en/recipes/hover-pop/): Ease size toward 112% when touching mouse-pointer and back toward 100% otherwise. - [Scratch Recipe: Tactile Click Squash & Stretch](/en/recipes/click-bounce/): Shrink briefly to 90% on mouse down and spring back to 105% → 100%. - [Scratch Recipe: Smooth Scene Fade-In](/en/recipes/fade-in/): Cover stage with a black sprite at ghost 0 and change ghost by +10 ten times. - [Scratch Recipe: Smooth Scene Fade-Out](/en/recipes/fade-out/): Bring a black overlay to front layer at ghost 100 and change ghost by -10 ten times. - [Scratch Recipe: Camera Screen Shake Effect](/en/recipes/screen-shake/): Set shake_power = 10 on impact and offset camera by random(-shake..shake) while multiplying by 0.8. - [Scratch Recipe: White Damage Hit Flash](/en/recipes/hit-flash/): Set brightness effect to 60 for 0.08s then reset to 0 on enemy hit. - [Scratch Recipe: Speed Dash Afterimage Trail](/en/recipes/afterimage-trail/): Clone the sprite every 2 frames, set ghost to 40, fade out over 8 frames, and delete. - [Scratch Recipe: Landing Dust Puff Particles](/en/recipes/dust-puff/): Spawn 4 tiny circle clones moving outward and fading when touching ground. - [Scratch Recipe: Floating "+10" Score Popup](/en/recipes/floating-score/): Clone a score label at coin position, float up 20px while fading ghost, then delete. - [Scratch Recipe: Smooth Pen Health Bar](/en/recipes/pen-hp-bar/): Draw a dark background bar then a colored foreground bar of width (hp/max_hp * 80). - [Scratch Recipe: Full-Width Boss Health Bar](/en/recipes/boss-hp-bar/): Anchor a 360px Pen bar across the bottom of the stage with live phase markers. - [Scratch Recipe: Cloned Heart Life Icons](/en/recipes/heart-icons/): Spawn max_lives heart clones spaced 28px apart and switch costumes for empty hearts. - [Scratch Recipe: MM:SS Countdown Formatter](/en/recipes/countdown-mmss/): Compute mins = floor(t/60), secs = t mod 60, and pad single digits with "0". - [Scratch Recipe: 0.1-Second Race Stopwatch](/en/recipes/stopwatch-dec/): Format elapsed time with round(timer * 10) / 10 for crisp tenths of a second. - [Scratch Recipe: Visual Ability Cooldown Bar](/en/recipes/cooldown-bar/): Draw remaining cooldown fraction using max(0, (ready_time - timer) / duration). - [Scratch Recipe: Letter-by-Letter Typewriter Text](/en/recipes/typewriter-line/): Append letter i of sentence into display_text inside a repeat loop. - [Scratch Recipe: Press Space to Skip Typewriter](/en/recipes/skip-dialogue/): Break out of the letter loop early if Space is pressed, showing the full sentence. - [Scratch Recipe: Retro Character Voice Blips](/en/recipes/speech-blip/): Play a tiny pitched Pop sound every 2 characters during typewriter dialogue. - [Scratch Recipe: Smooth Music Fade-Out](/en/recipes/bgm-fade/): Loop 10 times: change volume by -10, wait 0.1s, then stop all sounds. - [Scratch Recipe: Rising Pitch Combo Sound](/en/recipes/combo-pitch/): Increase pitch effect by +10 on each rapid pickup and clear effects after 1.5s idle. - [Scratch Recipe: One-Click Mute Audio Button](/en/recipes/mute-toggle/): Toggle a global "muted" flag (0/1) and set volume to 0% or 100% on broadcast. - [Scratch Recipe: Assign Unique Local Clone IDs](/en/recipes/clone-id-assign/): Increment a global counter, copy into local clone_id right before "create clone". - [Scratch Recipe: Prevent Clones From Cloning](/en/recipes/clone-broadcast-guard/): Check "if <(is_clone) = (0)> then" before creating clones on a broadcast. - [Scratch Recipe: Reliable Bullet-Hits-Enemy Cleanup](/en/recipes/clone-bullet-sync/): Wait 0 seconds before deleting a bullet clone so the enemy detects the hit first. - [Scratch Recipe: 3-Way Spread Shot Pattern](/en/recipes/spread-shot/): Spawn 3 bullet clones at direction -15°, 0°, and +15° from the player. - [Scratch Recipe: 3-Round Burst Weapon](/en/recipes/burst-fire/): Repeat 3 times (create clone, wait 0.08s), then wait 0.4s cooldown. - [Scratch Recipe: Smooth Homing Projectile](/en/recipes/homing-turn/): Compute angle toward target and rotate by at most 4 degrees per frame. - [Scratch Recipe: Returning Boomerang Throw](/en/recipes/boomerang-arc/): Launch forward with decelerating velocity until it reverses and returns to Player. - [Scratch Recipe: Orbiting Defensive Shield](/en/recipes/shield-orbit/): Keep 3 shield clones rotating evenly at 0°, 120°, and 240° around the player. - [Scratch Recipe: Coin Magnet Power-Up](/en/recipes/magnet-coins/): Pull coin clones within distance < 140 smoothly toward the player’s position. - [Scratch Recipe: Edge-Aware Platform Patrol](/en/recipes/enemy-patrol/): Turn around whenever touching a wall or when a floor-probe below finds empty air. - [Scratch Recipe: Distance-Triggered Enemy Chase](/en/recipes/enemy-chase-range/): Switch from calm patrol to chase only when distance to Player < 150. - [Scratch Recipe: Simple Line-of-Sight Check](/en/recipes/enemy-line-of-sight/): Step a tiny invisible sensor toward the player; if it hits a wall first, stay hidden. - [Scratch Recipe: Half-HP Boss Phase Transition](/en/recipes/boss-phase-2/): Trigger faster attacks and a red flash once boss_hp < (boss_max_hp / 2). - [Scratch Recipe: Spawn Enemies Outside Edges](/en/recipes/spawn-offscreen/): Pick a random edge (left/right/top/bottom) and place new enemy clones at ±235 / ±175. - [Scratch Recipe: Prevent Spawning on Player](/en/recipes/safe-spawn/): Repeat random coordinates until distance to Player > 100 before showing enemy. - [Scratch Recipe: Weighted Rarity Loot Table](/en/recipes/weighted-loot/): Roll 1–100: 1–65 Common, 66–90 Rare, 91–100 Epic. - [Scratch Recipe: Non-Repeating Deck Draw](/en/recipes/deck-draw/): Pick random 1..length of deck, read item, then delete that index. - [Scratch Recipe: In-Place List Shuffle](/en/recipes/list-shuffle/): Loop i from 1 to length and swap item i with item (random 1..length). - [Scratch Recipe: Sum All Numbers in a List](/en/recipes/list-sum/): Loop i from 1 to length adding item i into a total variable. - [Scratch Recipe: Average of a Score List](/en/recipes/list-average/): Compute total with a loop, then divide by length of list (if length > 0). - [Scratch Recipe: Find Maximum Value in a List](/en/recipes/list-max/): Initialize max = item 1 of list, then compare every remaining item. - [Scratch Recipe: Find Minimum Value in a List](/en/recipes/list-min/): Initialize min = item 1 of list, then update whenever item i < min. - [Scratch Recipe: Filter Matching Items Into New List](/en/recipes/list-filter/): Loop through source list and append items meeting a condition to result list. - [Scratch Recipe: Remove Duplicate List Entries](/en/recipes/list-remove-dups/): Append item i to clean_list only if not . - [Scratch Recipe: Convert 2D (Row, Col) to 1D List Index](/en/recipes/grid-index-2d/): Use index = ((row - 1) * width) + col to store 2D maps in a Scratch list. - [Scratch Recipe: Snap Sprite to Tile Grid](/en/recipes/grid-snap/): Set x to round(x / 32) * 32 and y to round(y / 32) * 32. - [Scratch Recipe: Split Delimited Save Code String](/en/recipes/string-split/): Loop through letters accumulating into a buffer until hitting "|" separator. - [Scratch Recipe: Reverse Any Text String](/en/recipes/string-reverse/): Loop backward from length down to 1 joining each letter onto reversed. - [Scratch Recipe: Zero-Pad Numbers (0042)](/en/recipes/pad-zeros/): Repeat until length of str = 4: set str to join("0", str). - [Scratch Recipe: Format Large Scores (12,500)](/en/recipes/format-commas/): Insert commas every 3 digits from right to left for clean clicker HUDs. - [Scratch Recipe: Abbreviate Clicker Numbers (1.5K / 2.3M)](/en/recipes/abbreviate-num/): Divide by 1000 or 1000000 and append K or M for readable huge scores. - [Scratch Recipe: Copyable Save Code List Box](/en/recipes/save-code-copy/): Put the generated save code in a 1-item list and show it so players can triple-click copy. - [Scratch Recipe: Validate Loaded Save Codes](/en/recipes/save-code-validate/): Check expected field count and numeric ranges before applying loaded values. - [Scratch Recipe: Mobile/Tablet On-Screen D-Pad](/en/recipes/touch-dpad/): Create 4 translucent arrow buttons checking mouse down and touching mouse-pointer. - [Scratch Recipe: Touch Virtual Joystick Control](/en/recipes/virtual-joystick/): Clamp knob within radius 35 of base and output normalized x/y steering. - [Scratch Recipe: Single-Trigger Key Press Guard](/en/recipes/key-release-wait/): Run action once then wait until > to stop hold-spam. - [Scratch Recipe: Detect Double-Tap Sprint Key](/en/recipes/double-tap-key/): Record timestamp of first tap; if second tap occurs within 0.25s, activate sprint. - [Scratch Recipe: Secret Cheat Code Sequence Detector](/en/recipes/konami-code/): Track progress index in a key sequence list; reset to 1 on wrong key. - [Scratch Recipe: Smooth Day/Night Lighting Cycle](/en/recipes/day-night-tint/): Adjust sky backdrop brightness smoothly with sin(timer * 10). - [Scratch Recipe: Layered Diagonal Rain Effect](/en/recipes/rain-parallax/): Clone thin angled lines scrolling down-left at two depths. - [Scratch Recipe: Gentle Swaying Snowflakes](/en/recipes/snow-drift/): Move y by -2 and x by sin(timer * 100 + clone_id * 30). - [Scratch Recipe: 3D Starfield Warp Effect](/en/recipes/starfield-warp/): Expand star clones radially from (0, 0) while increasing speed and size. - [Scratch Recipe: Fast Pen Filled Circle](/en/recipes/pen-circle/): Set pen size to diameter, pen down, pen up—draws a crisp circle in 1 step! - [Scratch Recipe: Pen Rounded UI Panel](/en/recipes/pen-rounded-box/): Draw a thick horizontal stroke with rounded pen caps for clean dialog panels. - [Scratch Recipe: Draw Coordinate Grid with Pen](/en/recipes/pen-line-grid/): Loop vertical lines every 40px and horizontal lines every 40px without refresh. - [Scratch Recipe: Live Pen Bar Chart from List](/en/recipes/pen-bar-chart/): Draw vertical strokes spaced evenly with height proportional to list values. - [Scratch Recipe: Stamped Multi-Digit Score Counter](/en/recipes/stamp-digits/): Loop through each digit of score, switch to matching costume, stamp, and shift x. - [Scratch Recipe: Top-Down Depth Sorting by Y](/en/recipes/layer-y-sort/): Send sprites with higher y further back so characters walk cleanly behind trees. - [Scratch Recipe: Corner Minimap Player & Enemy Dots](/en/recipes/minimap-dots/): Scale world coordinates by 0.15 and stamp tiny colored dots in the corner. - [Scratch Recipe: Level Checkpoint Respawn System](/en/recipes/checkpoint-flag/): Save checkpoint_x and checkpoint_y when touching a flag; respawn there on hazard hit. - [Scratch Recipe: Smooth Room-to-Room Transition](/en/recipes/door-transition/): Fade out, switch room_id, place player at matching entrance, and fade in. - [Scratch Recipe: Zelda-Style Room Camera Snap](/en/recipes/locked-camera-room/): When x > 235, increment room_x, snap player to x = -225, and redraw room. - [Scratch Recipe: Clean Turn-Based Battle Loop](/en/recipes/turn-based-loop/): Alternate Player Turn and Enemy Turn with broadcast-and-wait blocks. - [Scratch Recipe: Critical Hit Chance & Feedback](/en/recipes/critical-hit/): Roll 1–10; on 10, double damage, flash yellow, and show "CRIT!" popup. - [Scratch Recipe: One-Time Purchase Shop Item](/en/recipes/shop-sold-out/): Track bought items in a list and switch button costume to "Sold Out". - [Scratch Recipe: Slide-In Achievement Banner](/en/recipes/achievement-toast/): Queue unlocked badges in a list and glide a notification banner down for 2.5s. - [Scratch Recipe: Movie-Style Scrolling Credits](/en/recipes/credits-scroll/): Start credits sprite at y = -200 and glide smoothly upward past y = 240. - [Scratch Recipe: Zero-Bug Replay Button](/en/recipes/replay-clean-reset/): Broadcast "Reset All" and wait before broadcasting "Start Game" without refresh. - [Scratch Recipe: Live FPS Counter Snippet](/en/recipes/fps-counter/): Compute 1 / ((days since 2000 - last_day) * 86400) inside a forever loop. - [Scratch Recipe: Delta-Time Speed Scaling](/en/recipes/delta-move/): Multiply movement speed by (dt * 30) so physics matches across 30 and 60 FPS. - [Scratch Recipe: Safe Cloud High Score Updater](/en/recipes/cloud-high-score/): Check <(score) > (☁ High Score)> only once at Game Over before writing. Updated: 2026-11-24 Author: [Takamasa Suzuki](https://scratch.gmnavi.jp/about/author/) Japanese Edition: https://scratch.gmnavi.jp/recipes/ [Scratch Daizen (English)](https://scratch.gmnavi.jp/en/)