Chapter 10: The Onion, Parfait, or Ogre of Graphics

You know what onions have? Layers. You know what parfaits have? Layers! You know what ogres have? ...Okay, you've probably heard that joke before.

But you know what GAMES have? LAYERS!

Until now, all your graphics have been drawn on a single surface—like painting on one piece of paper. But real games are more like a stack of transparent sheets:

  • The background (clouds, mountains, sky)
  • The game world (platforms, obstacles)
  • The characters (player, enemies)
  • The effects (particles, explosions)
  • The UI (score, health bar, menus)

Each layer can move independently, scroll at different speeds, and have its own transparency. This is how professional games create that sense of depth and polish!

Let's peel back the layers (pun absolutely intended).


Why Layers Matter

Here's the problem with a single drawing surface:

SCREEN 13

' Draw background
LINE (0, 150)-(319, 199), 2, BF    ' Green grass

' Draw player
CIRCLE (playerX, playerY), 10, 14

' Draw score
LOCATE 1, 1
PRINT "Score: "; score

' Now clear the screen...
CLS    ' WHOOPS! Everything is gone!

When you CLS, EVERYTHING disappears—background, player, and score. You have to redraw ALL of it every single frame. That works, but what if your background is really complicated? What if it doesn't change at all?

With layers, you can:

  • Draw the background ONCE on its own layer
  • Update only the player layer each frame
  • Keep the UI layer separate and static

Less work, better organization, smoother games!

But Wait, There's More: Layers Are FAST!

Here's a secret: layers aren't just convenient—they're blazing fast.

Why? Because layers use your computer's GPU (Graphics Processing Unit). The GPU is a special chip designed specifically for graphics. It's REALLY good at taking flat images and compositing them together.

When you use layers:

  • Each layer is stored in GPU memory as a texture
  • The GPU combines them at lightning speed
  • Crash BASIC barely has to do any work!

When you DON'T use layers:

  • Crash BASIC redraws everything pixel by pixel
  • The CPU (your main processor) does all the work
  • It's slower, especially with complex graphics

So layers aren't just for organization—they're a performance optimization. A complex scrolling background that would be slow to redraw every frame becomes instant when it's on its own layer that just... scrolls.


Creating Your First Layer

SCREEN 13

' Create three layers (layer number, width, height)
CREATE LAYER 0, 320, 200    ' Background
CREATE LAYER 1, 320, 200    ' Game objects
CREATE LAYER 2, 320, 200    ' UI overlay

' Draw on the background layer (only need to do this once!)
SET LAYER 0
LINE (0, 150)-(319, 199), 2, BF    ' Ground
CIRCLE (50, 50), 20, 14            ' Sun

' Draw on the UI layer
SET LAYER 2
LOCATE 1, 1
PRINT "Score: 0"

' Game loop - only update the game layer!
playerX = 160
DO
    IF KEYDOWN("LEFT") THEN playerX = playerX - 3
    IF KEYDOWN("RIGHT") THEN playerX = playerX + 3

    BEGIN FRAME
    ' Only clear and redraw layer 1!
    SET LAYER 1
    CLS -1    ' Clear to TRANSPARENT (important!)
    CIRCLE (playerX, 100), 10, 15

    END FRAME
    DELAY 16
LOOP

See how the background and UI never get redrawn? They stay put while only the player layer updates!


The Golden Rule: BEGIN FRAME / END FRAME

CRITICAL: When using layers, you MUST use BEGIN FRAME and END FRAME to composite them together!

' BAD: Layers won't display properly!
SET LAYER 0
CLS 1
SET LAYER 1
CIRCLE (100, 100), 20, 14
' Nothing appears correctly...

' GOOD: Frame buffering makes layers work!
BEGIN FRAME
SET LAYER 0
CLS 1
SET LAYER 1
CLS -1
CIRCLE (100, 100), 20, 14
END FRAME    ' Now all layers composite together!

Without frame buffering, the system doesn't know when you're done drawing. BEGIN FRAME says "I'm starting to draw" and END FRAME says "I'm done—show everything now!"


SET LAYER: Choosing Where to Draw

SET LAYER tells Crash BASIC which layer your next drawing commands go to:

SET LAYER 0           ' Background layer
LINE (0, 0)-(319, 199), 1, BF    ' Blue sky

SET LAYER 1           ' Character layer
CIRCLE (160, 100), 20, 14       ' Yellow circle (player)

SET LAYER 2           ' UI layer
LOCATE 1, 1
PRINT "Press SPACE to jump!"

Everything you draw—PSET, LINE, CIRCLE, PUTIMAGE, and yes, PRINT—goes to the current layer.

Layer Order

Layers render in numerical order: 0 first, then 1, then 2, and so on. Higher numbers draw ON TOP of lower numbers.

Layer 2 (UI)        - on top, always visible
Layer 1 (Characters) - middle
Layer 0 (Background) - bottom

So if you want something to always appear in front, put it on a higher-numbered layer!


CLS -1: The Magic of Transparency

Here's something that trips up EVERYONE at first:

Layers are NOT transparent by default. They start out BLACK (color 0).

So if you create a layer and don't do anything to it, it's a solid black rectangle that covers everything below it!

CREATE LAYER 0, 320, 200    ' Background - blue sky
CREATE LAYER 1, 320, 200    ' Characters - starts BLACK, not transparent!

SET LAYER 0
CLS 1    ' Blue background

SET LAYER 1
' Uh oh... layer 1 is solid black! It covers the blue!
CIRCLE (160, 100), 20, 14    ' You see this, but no blue behind it

The fix? Clear the layer to TRANSPARENT with CLS -1:

CLS -1    ' Clear to TRANSPARENT (not black!)

This is essential for overlay layers! Without it, your character layer would have a solid black background that covers everything below.

' Background layer - solid blue
SET LAYER 0
CLS 1

' Character layer - transparent except for the player
SET LAYER 1
CLS -1                            ' Clear to transparent!
CIRCLE (playerX, playerY), 10, 14  ' Only the circle shows

' Now you can see the blue background THROUGH layer 1!

Here's something that catches people: PRINT goes to the current layer too!

CREATE LAYER 0, 320, 200
CREATE LAYER 1, 320, 200

SET LAYER 0
PRINT "This text is on layer 0"

SET LAYER 1
PRINT "This text is on layer 1"

This is usually what you want—put your score on the UI layer, debug messages on a debug layer, etc.

But here's the gotcha: if you CLS on a layer, you also clear any text on that layer!

SET LAYER 1
PRINT "Hello!"
CLS -1          ' Oops! The "Hello!" is gone too!

Solution: Put your static text on a layer you don't clear, or redraw it each frame.


Text Windows: The WINDOW Command

Want to create a dialog box? A text area that wraps nicely? That's what WINDOW is for!

WINDOW defines a rectangular region where text will appear and wrap:

SCREEN 13

' Draw a dialog box border
LINE (48, 138)-(272, 192), 15, B

' Define the text window INSIDE the border
WINDOW (50, 140) - (270, 190)

' Now PRINT will wrap within that window!
PRINT "Welcome, traveler! Your journey begins in the ancient forest of mysteries."

PAUSE

Without WINDOW, that text would just run off the right edge of the screen. With WINDOW, it wraps nicely inside your dialog box!

WINDOW Coordinates

WINDOW (x1, y1) - (x2, y2)
  • (x1, y1) = top-left corner (in pixels)
  • (x2, y2) = bottom-right corner (in pixels)

Text starts at the top-left of the window and wraps when it hits the right edge.


Word Wrapping: The WORDS Modifier

By default, text wraps anywhere—even in the middle of a word! The WORDS modifier makes text wrap at word boundaries instead:

SCREEN 13

WINDOW (20, 20) - (150, 100)

' Without WORDS - might break mid-word
PRINT "Supercalifragilisticexpialidocious is a long word"

LOCATE 15, 1
WINDOW (20, 120) - (150, 180)

' With WORDS - breaks at spaces
PRINT WORDS "Supercalifragilisticexpialidocious is a long word"

PAUSE

Always use WORDS for dialog text! It looks much more professional.


Pixel-Perfect Text: The ORIGIN Modifier

Sometimes you need text at an exact pixel position—not just row/column. That's what ORIGIN does with LOCATE:

SCREEN 13

' Normal LOCATE - snaps to character grid
LOCATE 10, 5
PRINT "Grid position"

' LOCATE with ORIGIN - pixel-perfect offset
LOCATE 12, 5 ORIGIN(3, 2)
PRINT "Offset by 3,2 pixels"

PAUSE

ORIGIN adds a pixel offset to the character position:

LOCATE row, column ORIGIN(pixelX, pixelY)

This is useful for:

  • Centering text precisely
  • Aligning text with graphics
  • Smooth text animations

Text Positioning Hierarchy

The coordinate system works in layers:

  1. WINDOW — defines the text region (base)
  2. ORIGIN — pixel offset within that region
  3. LOCATE — row/column position
SCREEN 13

' Set up a text window
WINDOW (50, 50) - (270, 150)

' Position within the window with pixel offset
LOCATE 2, 3 ORIGIN(5, 0)
PRINT "Precisely positioned!"

PAUSE

Real Example: Dialog Box with Text Window

Let's put it all together for a dialog box:

SCREEN 13

DECLARE SUB ShowDialog(speaker$, text$)

' Game setup
CREATE LAYER 0, 320, 200    ' Game world
CREATE LAYER 1, 320, 200    ' Dialog overlay

' Draw some game world stuff
SET LAYER 0
CLS 9    ' Blue sky
LINE (0, 150)-(319, 199), 2, BF    ' Green ground
CIRCLE (160, 120), 15, 14, 14      ' Player

' Show some dialog
CALL ShowDialog("Old Man", "Greetings, young hero! The kingdom is in peril.")
CALL ShowDialog("Old Man", "You must travel to the Dark Tower and defeat the evil wizard!")
CALL ShowDialog("Hero", "I will do my best!")

' Clear dialog and continue
SET LAYER 1
CLS -1
BEGIN FRAME
END FRAME

LOCATE 1, 1
PRINT "Adventure begins!"
PAUSE

END

SUB ShowDialog(speaker$, text$)
    SET LAYER 1
    CLS -1    ' Clear to transparent

    ' Draw dialog box with border
    LINE (8, 130)-(312, 195), 0, BF     ' Black background
    LINE (8, 130)-(312, 195), 15, B      ' White border
    LINE (10, 132)-(310, 193), 8, B      ' Gray inner border

    ' Speaker name
    LOCATE 17, 2
    COLOR 14    ' Yellow
    PRINT speaker$

    ' Dialog text window - text wraps within this region
    WINDOW (15, 150) - (305, 190)
    COLOR 15    ' White

    ' Display the text with word wrapping
    PRINT WORDS text$

    BEGIN FRAME
    END FRAME

    ' Wait for player to press a key
    WHILE INKEY$ = ""
        DELAY 16
    WEND
END SUB

This creates a dialog system with:

  • A bordered dialog box on its own layer
  • Speaker name in yellow
  • Word-wrapped text that fits the box
  • Press-any-key to continue

Scrolling Layers: The Parallax Effect

One of the coolest things about layers is that each one can scroll independently. This creates parallax scrolling—that beautiful effect where distant things move slower than nearby things.

SCREEN 13

' Create layers of different widths for scrolling
CREATE LAYER 0, 640, 200    ' Background (wider = can scroll further)
CREATE LAYER 1, 640, 200    ' Midground
CREATE LAYER 2, 320, 200    ' Foreground (player layer, doesn't scroll)

' Draw some content on each layer (just once!)
SET LAYER 0
FOR i = 0 TO 20
    CIRCLE (i * 30, 50), 15, 9    ' Blue "clouds"
NEXT i

SET LAYER 1
FOR i = 0 TO 15
    LINE (i * 40, 180)-(i * 40 + 20, 120), 2, BF    ' Green "trees"
NEXT i

' Scrolling game loop
scrollX = 0
DO
    IF KEYDOWN("RIGHT") THEN scrollX = scrollX + 2
    IF KEYDOWN("LEFT") AND scrollX > 0 THEN scrollX = scrollX - 2

    BEGIN FRAME

    ' Background scrolls SLOWLY (distant)
    SET LAYER 0
    SET SCROLL(scrollX * 0.3, 0)

    ' Midground scrolls at MEDIUM speed
    SET LAYER 1
    SET SCROLL(scrollX * 0.7, 0)

    ' Player layer doesn't scroll (player stays centered)
    SET LAYER 2
    CLS -1
    CIRCLE (160, 100), 10, 14    ' Player

    END FRAME
    DELAY 16
LOOP

The background moves at 30% speed, the midground at 70%, and the player stays put. This creates an amazing illusion of depth!


Layer Transparency: Fading Entire Layers

You can make an entire layer semi-transparent using ALPHA:

SET LAYER 2, ALPHA(0.5)    ' 50% transparent

This is great for:

  • Overlay effects (dimming the game when paused)
  • Fade transitions (fading a layer in or out)
  • Ghost/shadow effects (semi-transparent character shadows)
' Pause screen overlay
IF paused THEN
    SET LAYER 3, ALPHA(0.7)    ' Dark overlay
    CLS 0                       ' Black
    LOCATE 10, 12
    COLOR 15
    PRINT "PAUSED"
END IF

Fade Effect

' Fade in a layer
FOR alpha = 0 TO 10
    BEGIN FRAME
    SET LAYER 1, ALPHA(alpha / 10)
    ' ... draw stuff ...
    END FRAME
    DELAY 50
NEXT alpha

CLS Effects: Screen Transitions with Style!

Remember those awesome screen transitions in old games? The screen melting away like hot wax, dissolving into pixels, or wiping across dramatically? Crash BASIC has those built in!

CLS normally just clears the screen instantly. But add an EFFECT and suddenly you've got cinematic flair:

SCREEN 13

' Draw something on screen
FOR i = 0 TO 50
    CIRCLE (RND * 320, RND * 200), RND * 20 + 5, RND * 15 + 1
NEXT i

PAUSE

' Now clear with a MELT effect (like the original DOOM!)
CLS 0 EFFECT(MELT)

Available Effects

Effect What It Does
MELT Columns drip down at random speeds (DOOM style!)
FADE Smoothly fades to the target color
DISSOLVE Random pixels disappear (like old TV static)
WIPEX Horizontal wipe across the screen
WIPEY Vertical wipe down the screen
BLOCK Clears in rectangular chunks

Controlling Effect Speed

Add SPEED to control how fast the effect runs:

' Slow, dramatic melt
CLS 0 EFFECT(MELT) SPEED 1

' Fast wipe
CLS 0 EFFECT(WIPEX) SPEED 10

' Medium dissolve (default speed is usually around 5)
CLS 0 EFFECT(DISSOLVE) SPEED 5

Lower numbers = slower effects. Higher = faster.

Block Size for BLOCK and DISSOLVE

The BLOCK and DISSOLVE effects can use different block sizes:

' Big chunky blocks
CLS 0 EFFECT(BLOCK) SIZE 16

' Tiny pixel dissolve
CLS 0 EFFECT(DISSOLVE) SIZE 2

' Medium blocks, slow speed
CLS 0 EFFECT(BLOCK) SIZE 8 SPEED 2

Scene Transition Example

Here's how you might use effects for scene transitions:

SCREEN 13

' === TITLE SCREEN ===
CLS 1    ' Blue background
LOCATE 10, 10
PRINT "MY AWESOME GAME"
LOCATE 14, 8
PRINT "Press any key..."

' Wait for input
WHILE INKEY$ = ""
    DELAY 16
WEND

' Dramatic transition to gameplay!
CLS 0 EFFECT(MELT) SPEED 3

' === GAMEPLAY SCREEN ===
' ... game code here ...

' Player dies? Fade to black...
CLS 0 EFFECT(FADE) SPEED 2

' === GAME OVER SCREEN ===
LOCATE 10, 11
COLOR 4
PRINT "GAME OVER"

Checking if a Transition is Running

Use the TRANSITION() function to check if an effect is still playing:

CLS 0 EFFECT(DISSOLVE) SPEED 2

' Wait for the effect to complete
WHILE TRANSITION() <> ""
    DELAY 16
WEND

PRINT "Transition complete!"

TRANSITION() returns the effect name while it's running, or an empty string when done.

Effects with Layers

CLS effects work on the current layer:

CREATE LAYER 0, 320, 200
CREATE LAYER 1, 320, 200

' Melt just layer 0
SET LAYER 0
CLS 0 EFFECT(MELT)

' Layer 1 is unaffected!

This lets you create effects like:

  • Melting away a game screen while UI stays visible
  • Fading in a new background behind existing sprites
  • Dramatic layer-by-layer reveals

Pro tip: CLS effects are purely visual polish, but that polish makes your game feel PROFESSIONAL. Use them for scene changes, deaths, level completions, and dramatic moments!


NEWIMAGE: The Invisible Layer

Sometimes you want to build up a complex image off-screen before showing it. That's what NEWIMAGE does—it creates an invisible drawing surface!

' Create an offscreen buffer (NOT a layer—an invisible canvas)
NEWIMAGE 100, 100, 0, "myBuffer"

' Draw to it (switch drawing target)
SET IMAGE "myBuffer"
CIRCLE (50, 50), 40, 14
LINE (10, 10)-(90, 90), 12

' Switch back to a regular layer
SET LAYER 0

' Now stamp that image anywhere!
PUTIMAGE (100, 50), "myBuffer"
PUTIMAGE (200, 50), "myBuffer"    ' You can use it multiple times!

Why Use NEWIMAGE Instead of Layers?

Layers NEWIMAGE
Visible on screen Invisible until you PUTIMAGE
Always composited Can be stamped anywhere, any size
Has scroll position No scrolling, just a texture
Permanent until RESET LAYERS Can create many image buffers

Use NEWIMAGE for:

  • Procedural sprite generation
  • Complex graphics you want to reuse
  • Pre-rendering effects
  • Building composite sprites
' Create a procedural sprite sheet!
NEWIMAGE 128, 32, 0, "explosionFrames" AS SPRITESHEET(32, 32)

SET IMAGE "explosionFrames"
' Draw 4 explosion frames
FOR frame = 0 TO 3
    cx = frame * 32 + 16
    CIRCLE (cx, 16), 5 + frame * 3, 12, 12
    CIRCLE (cx, 16), 2 + frame * 2, 14, 14
NEXT frame

SET LAYER 0
' Now use it like any sprite sheet!
PUTIMAGE (100, 100), "explosionFrames", currentFrame

SET IMAGE vs SET LAYER

These two commands look similar but do different things:

SET LAYER 0          ' Draw to layer 0 (visible, composited)
SET IMAGE "buffer"   ' Draw to an image buffer (invisible until PUTIMAGE)

After using SET IMAGE, you MUST use SET LAYER to get back to drawing on the screen!

NEWIMAGE 64, 64, 0, "icon"

SET IMAGE "icon"
CIRCLE (32, 32), 28, 14
' If you try to draw to the screen now, nothing happens!

SET LAYER 0    ' Back to the screen
PUTIMAGE (100, 100), "icon"    ' NOW it appears!

Real Example: A Complete Layered Game

Let's put it all together:

SCREEN 13

' ============================================
' Create our layers
' ============================================
CREATE LAYER 0, 640, 200    ' Scrolling background (2x wide)
CREATE LAYER 1, 320, 200    ' Game objects
CREATE LAYER 2, 320, 200    ' UI overlay

' ============================================
' Draw the background (only once!)
' ============================================
SET LAYER 0

' Sky gradient
FOR y = 0 TO 100
    c = 1 + (y / 25)    ' Blue gradient
    LINE (0, y)-(639, y), c
NEXT y

' Ground
LINE (0, 150)-(639, 199), 2, BF

' Some clouds
FOR i = 0 TO 10
    CIRCLE (i * 60 + 30, 40), 20, 15, 15
    CIRCLE (i * 60 + 50, 45), 15, 15, 15
NEXT i

' ============================================
' Draw UI (only once!)
' ============================================
SET LAYER 2
CLS -1    ' Transparent background
LOCATE 1, 1
COLOR 15
PRINT "Arrow keys to move"

' ============================================
' Game variables
' ============================================
playerX = 160
playerY = 130
cameraX = 0
score = 0

' ============================================
' Game loop
' ============================================
DO
    ' Input
    IF KEYDOWN("LEFT") AND playerX > 20 THEN playerX = playerX - 3
    IF KEYDOWN("RIGHT") AND playerX < 600 THEN playerX = playerX + 3

    ' Camera follows player
    cameraX = playerX - 160
    IF cameraX < 0 THEN cameraX = 0
    IF cameraX > 320 THEN cameraX = 320

    BEGIN FRAME

    ' Scroll background (parallax - moves slower)
    SET LAYER 0
    SET SCROLL(cameraX * 0.5, 0)

    ' Draw game objects
    SET LAYER 1
    CLS -1

    ' Player (drawn relative to camera)
    screenX = playerX - cameraX
    CIRCLE (screenX, playerY), 10, 14, 14

    ' Some collectible coins
    FOR i = 0 TO 4
        coinX = 100 + i * 100 - cameraX
        IF coinX > -20 AND coinX < 340 THEN
            CIRCLE (coinX, 120), 8, 14
        END IF
    NEXT i

    ' Update score display on UI layer
    SET LAYER 2
    LOCATE 3, 1
    PRINT "Score: "; score; "   "
    LOCATE 4, 1
    PRINT "X: "; playerX; "   "

    END FRAME
    DELAY 16
LOOP

This game has:

  • A scrolling background with parallax
  • A game layer that only draws visible objects
  • A UI layer with score display
  • Smooth camera following

RESET LAYERS: Starting Fresh

When you're done with a multi-layer scene (like going from gameplay to a menu), clean up:

RESET LAYERS    ' Destroys all layers, returns to default

This is useful for:

  • Switching between game states
  • Cleaning up after complex scenes
  • Resetting the graphics system
' After gameplay ends
RESET LAYERS
SCREEN 13    ' Fresh start
CLS
PRINT "GAME OVER"

Common Layer Gotchas

1. Forgetting BEGIN FRAME / END FRAME

' BAD: Layers won't composite!
SET LAYER 0
CLS 1
SET LAYER 1
CIRCLE (100, 100), 20, 14

' GOOD: Always use frame buffering with layers
BEGIN FRAME
SET LAYER 0
CLS 1
SET LAYER 1
CLS -1
CIRCLE (100, 100), 20, 14
END FRAME

2. Not Clearing to Transparent

' BAD: Layer 1 covers layer 0 completely!
SET LAYER 1
CLS 0    ' Solid black covers everything below

' GOOD: Use transparent clear
SET LAYER 1
CLS -1   ' Now layer 0 shows through!

3. Forgetting SET LAYER After SET IMAGE

NEWIMAGE 64, 64, 0, "buffer"
SET IMAGE "buffer"
CIRCLE (32, 32), 20, 14

' Oops! Still drawing to buffer, not screen!
CIRCLE (160, 100), 30, 12    ' This goes to the buffer!

' FIX: Always SET LAYER when done with SET IMAGE
SET LAYER 0
CIRCLE (160, 100), 30, 12    ' Now it's on screen

4. PRINT Going to Wrong Layer

SET LAYER 0
PRINT "Game Layer"    ' This is on layer 0

SET LAYER 2
' Forgot to print here, so...
SET LAYER 0           ' Back to layer 0
PRINT "UI text"       ' Oops! This is on layer 0, not UI!

Quick Reference

Layer Commands

Command What It Does
CREATE LAYER n, w, h Create layer n with width w and height h
SET LAYER n Switch drawing to layer n
SET LAYER n, ALPHA(a) Set layer transparency (0-1)
SET SCROLL(x, y) Scroll current layer
CLS -1 Clear to transparent
RESET LAYERS Delete all layers, return to default
NEWIMAGE w, h, c, "name" Create invisible image buffer
SET IMAGE "name" Draw to image buffer
PUTIMAGE (x,y), "name" Stamp image buffer to screen

CLS Effects

Command What It Does
CLS c EFFECT(MELT) DOOM-style melt transition
CLS c EFFECT(FADE) Smooth fade to color
CLS c EFFECT(DISSOLVE) Random pixel dissolve
CLS c EFFECT(WIPEX) Horizontal wipe
CLS c EFFECT(WIPEY) Vertical wipe
CLS c EFFECT(BLOCK) Block-by-block clear
SPEED n Effect speed (lower = slower)
SIZE n Block/pixel size for BLOCK/DISSOLVE
TRANSITION() Returns effect name or "" if done

Text Window Commands

Command What It Does
WINDOW (x1,y1)-(x2,y2) Define text region in pixels
PRINT WORDS text$ Word-wrap at word boundaries
LOCATE r, c ORIGIN(x, y) Position with pixel offset

When to Use Layers

Situation Use Layers?
Simple games (single screen) Optional, but nice
Scrolling backgrounds Yes!
Parallax effects Definitely!
UI that stays on screen Yes!
Multiple game "zones" Yes!
Fade/overlay effects Yes!
Pre-rendering complex graphics Use NEWIMAGE

Try It Yourself!

  1. Create a three-layer scene: background, game, UI. Make only the game layer update each frame.

  2. Build a parallax scrolling demo with at least 3 layers moving at different speeds.

  3. Use NEWIMAGE to create a procedural texture (like a checkerboard) and stamp it multiple times.

  4. Make a "pause" overlay that dims the game and shows "PAUSED" text.

  5. Create a fade-to-black transition using layer alpha.

Your games are about to look SO much more polished!

See you in Chapter 11!


Next Chapter: We'll learn about arrays—because sometimes one variable just isn't enough!