Creating Multiple Levels in MakeCode Arcade

Sep 28, 2024

How to Make a Platformer Game in MakeCode Arcade - Part 3

Introduction

  • Focused on improving game aesthetics and adding complexity through multiple levels.

Adding Background

  • Added a background image with mountains and clouds to enhance visual appeal.

Creating Levels

  • Started with a single level; added functionality for multiple levels.
  • Setting Sprite Start Position:
    • Used the tile map to designate a starting point (pink block).
    • Placed the hero sprite (Hopson Paw) on a random pink block.
    • Deleted the pink block after placing the sprite.
  • Functions for Level Setup:
    • Encapsulated level setup code in a function called startLevel.
    • Used currentLevel variable to keep track of which level the player is on.
  • Changing Levels:
    • Increased level counter on game over, called startLevel to set up the next level.

Designing Second Level

  • Created a second level using existing tiles and increased width.
  • Added coins and enemy flowers that spawn bees for added challenge.
  • Implemented a portal for level completion and lava hazards.

Transitioning Between Levels

  • Ensured that previous level’s enemies, flowers, and coins are removed when switching levels.
  • Utilized loops to clean up sprites of specific kinds before starting a new level.

Creating Third Level with Wall Jumping

  • Designed a tall vertical level for wall jumping mechanics.
  • Wall Jumping Logic:
    • Set conditions for the hero to cling to walls when falling.
    • Adjusted Y-velocity to allow jumping and reapplying gravity.
    • Added visual for the hero when clinging to walls.

Fixing Visual Jitter

  • Implemented conditions to prevent jitter when flipping images of the hero sprite.
  • Adjusted image flipping criteria to include wall collisions.

Introducing Fireballs

  • Added fireballs as a new hazard in the game.
  • Created a visual for fireballs and programmed them to bob up and down.
  • Implemented collision logic:
    • Player loses lives when overlapping with fireballs.

Game Testing

  • Tested the game to ensure mechanics functioned correctly, including dodging bees and fireballs.

Hardware Integration

  • Showed how to download the game to a handheld device (e.g., Meowbit) for portable play.
  • Steps included connecting the device via USB and transferring the game file.

Conclusion

  • Summary of enhancements made in this part: multiple levels, wall jumping, and fireballs.
  • Encouragement to check links for more hardware options.