Advanced Scratch RPG Level Design

Aug 6, 2024

Scratch RPG Tutorial - Part Two

Introduction

  • Focus on creating seamless, persisted tiled scrolling levels.
  • Topics covered:
    • Infinite scrolling backgrounds
    • Level maps using scratch lists
    • Coding a working grid list for scrolling engine
    • Managing lag in large projects

Infinite Scrolling Backgrounds

  • Achieve scrolling by moving the entire scene rather than the player.
  • Use camera variables (cam x, cam y) for the scrolling effect.
  • Adjust the player's position using camera sliders.
  • Background grass sprite needs to move with the camera.
    • Set cam x and cam y when player moves.
    • Use modulo operation to create endless scrolling illusion.

Sprite Setup

  • For the background sprite:
    • Set size to 200%.
    • Adjust positioning with respect to camera variables to avoid showing edges.
  • Tile costumes are set up with a size of 16 pixels, making them 32x32 when scaled.
  • Use a transparent rectangle for spacing in costumes to facilitate off-screen movement.

Painting Tiles

  • Use the pen extension in Scratch to stamp tiles onto the stage.
  • Create a custom block for painting tiles on the screen.
  • Address issues with sprite positioning and visibility when painting tiles.
  • Ensure all actions run without screen refresh for efficiency.

Creating and Storing Level Maps

  • Level maps are stored in a Scratch list.
  • Use a grid structure for organizing tile costumes.
  • Create a new sprite for level storage.
  • Initialize a grid list and generate tile costume numbers.
  • Use custom blocks for repetitive tasks like adding rows of tiles to the grid.

Optimizing Performance

  • Test performance with a large grid (e.g., 100x100).
  • Discuss limitations of Scratch regarding large quantities of tiles.
  • Plan to optimize the tile painting script to only render visible tiles.

Conclusion

  • Encourage viewers to like and subscribe for future episodes.
  • Thank patrons for their support.
  • Mention upcoming content focusing on optimization of the tile engine.