Skip to reading
Getting started with PCA3D

29. Rebuild the Clockmaker screens

Edition 0.86.4.3

0.86.4.3 edition with revised lessons, updated cross-references and new cinematic/camera-safety supplements. Earlier examples, screenshots and registry figures retain their stated edition context.

Download PDFView PDF page
On this page

29. Rebuild the Clockmaker screens

turn_one#

Code example
func run(_context: Dictionary = {}) -> Variant:
    var sequence: Array = [3, 1, 2]
    var step: int = int(Runtime.variables.get("dial", 0))
    if 1 != sequence[clampi(step, 0, 2)]:
        await SetVariable({"name":"dial", "value":0})
        await ShowMessage({"text":"A soft click. The winding sequence resets.", "duration":1.3})
        return false
    step += 1
    await SetVariable({"name":"dial", "value":step})
    if step == 3:
        await HideGUI({"guiId":"dial"})
        await RunVisualScript({"scriptId":"ring_bell"})
    else:
        await ShowMessage({"text":"A clean click. The next turn is ready.","duration":0.8})
    return true

At dial 0, the expected number is 3. At dial 1 it is 1. At dial 2 it is 2. A correct turn increments the counter. At 3, the script hides the dial and runs ring_bell. The clamp prevents an invalid array index if a completed counter is read again.

Build ring_bell#

Make a Visual Script with an Interact/use entry. Connect Set Variable finished true, Set Variable objective to the completion text, Set Variable score 100, Complete Quest repair, Play Sound chime and Show GUI ending. This is the same pattern as send_signal in the Primitive game.

Check your work. Turn I first. The sequence should reset. Then turn III, I, II. The dial should close, the quest should complete and the ending should appear. Restart and try III, II: it must reset rather than accepting two out-of-order correct numbers.

Clockmaker's GUI system extends the Primitive version. It has HUD, Inventory, Journal, ending and dial, plus opening_title, cinematic_dialogue and opening_controls for the introduction.

The everyday screens#

Use the exact GUI rectangles and content in the reference tables. Keep the shared 1280 by 720 design canvas. The HUD pairs verb images with labels; the click action belongs on the intended interactive element. Avoid overlapping two active buttons that both run the same verb change.

Inventory uses the supplied satchel background, a grid and navigation controls. Its visible slot count is 8. Set the grid's slot size, spacing and title independently. Journal shows the current objective and quest list. The ending screen can be closed so the player can keep exploring.

Page 73 of 184Permalink
Go to page