Skip to content

Latest commit

 

History

History
154 lines (110 loc) · 4.73 KB

File metadata and controls

154 lines (110 loc) · 4.73 KB

Examples

All examples are regular MiniPixels projects with a minipixels.json, MiniLang source files, and assets.

Moving Sprite

Moving Sprite

Run:

python tools\minipixels.py run examples\moving-sprite\minipixels.json --compiler ..\MiniLangCompilerPy\mlc_win64.py

MiniLang code excerpt:

function update(game, dt)
  global playerX, playerY
  speed = 90 * dt
  if game.input.left then playerX = playerX - speed end if
  if game.input.right then playerX = playerX + speed end if
  if game.input.up then playerY = playerY - speed end if
  if game.input.down then playerY = playerY + speed end if
end function

function render(game, canvas)
  canvas.clear(mp.rgb(20, 20, 30))
  canvas.drawSprite(playerSprite, playerX, playerY)
end function

Scrolling World

Scrolling World

Run:

python tools\minipixels.py run examples\scrolling-world\minipixels.json --compiler ..\MiniLangCompilerPy\mlc_win64.py

MiniLang code excerpt:

rect = mp.recti(player.x, player.y, 12, 15)
res = mp.tileMoveAndCollide(world, rect, player.vx * dt, player.vy * dt)
player.x = res.x
player.y = res.y

if res.hitBottom then
  player.vy = 0
  player.grounded = true
end if

camera.follow(player.x, player.y)

Pixel Effects

Pixel Effects

Run:

python tools\minipixels.py run examples\pixel-effects\minipixels.json --compiler ..\MiniLangCompilerPy\mlc_win64.py

Tiled Platformer

Run:

python tools\minipixels.py run examples\tiled-platformer\minipixels.json --compiler ..\MiniLangCompilerPy\mlc_win64.py

What it demonstrates:

  • Tiled JSON/TMJ level input through levels.path
  • Collision tile layer import
  • Object-layer spawn, exit, coin, and enemy records
  • Procedurally generated sprites and tiles

MiniLang code excerpt:

while y < canvas.height
  x = 0
  while x < canvas.width
    v = ((x * x) + (y * 3) + phase * 7) & 255
    canvas.setPixel(x, y, mp.rgb((v + x) & 255, (v + y) & 255, 120))
    x = x + 1
  end while
  y = y + 1
end while

Jump and Run

Jump and Run

Jump and Run Gameplay

Jump and Run Levels

Jump and Run Sprites

Run:

python tools\minipixels.py run examples\jump-and-run\minipixels.json --compiler ..\MiniLangCompilerPy\mlc_win64.py

What it demonstrates:

  • Main menu, win screen, and retry screen
  • Three hand-authored scrolling levels
  • Player movement, jumping, gravity, tile collision, and camera follow
  • Coins, enemies, stomp combat, locked exits, level intros, particle bursts, and level transitions
  • Sprite-sheet animation, stateful SFX playback, HUD text, and camera-space drawing helpers
  • Open/free asset workflow with MiniPixels assets.mpx packs, manifest sheet metadata, generated level data, and Python build-time asset reports

MiniLang code excerpt:

rect = mp.recti(player.x + 9, player.y + 13, 14, 19)
res = mp.tileMoveAndCollide(world, rect, player.vx * dt, player.vy * dt)
player.x = res.x - 9
player.y = res.y - 13

if res.hitBottom then
  player.vy = 0
  player.grounded = true
else
  player.grounded = false
end if

if rectHit(player.x + 9, player.y + 13, 14, 19, exitX, exitY, 32, 64) and coinsTaken >= coinCount then
  loadLevel(levelIndex + 1)
end if

mp.drawSpriteWorld(canvas, camera, playerSheet.getFrame(pframe), player.x, player.y)

Level data lives in examples/jump-and-run/assets/levels/levels.json and is compiled into generated.levels during the build. Image/audio/file assets are written to build/assets.mpx; generated MiniLang image factories load from that pack through the MiniPixels PNG decoder, and generated audio factories load WAV bytes as memory-backed clips. The native MiniLang CLI can generate the level module too; the Python CLI is still needed for asset-pack creation and the full build/run pipeline.

Assets: