Player earns and spends currency at merchants; price and value decisions are meaningful.
Gold is spent and earned at a merchant: buying deducts an item's price into your goods, a too-dear item is refused, and selling returns gold.
A shop is a currency integer plus a price table plus a transaction that mutates both sides atomically. No special node required.
Currency is a single number in GameState. Every price decision reads and writes it; guard against going negative.
var gold := 0
func can_afford(price): return gold >= priceA ShopData resource holds the stock and prices. Different merchants are just different resources, not different code.
class_name ShopData extends Resource
@export var stock: Array[ItemData]
@export var prices: Dictionary # { item_id: cost }A buy is one transaction: check funds, subtract gold, add item, emit. Emitting gold_changed keeps every gold display in sync.
signal gold_changed(amount)
func buy(item, price):
if not can_afford(price): return
gold -= price; inventory.add(item); gold_changed.emit(gold)In short: currency int in GameState; ShopData Resource with item array and prices; transaction updates both currency and inventory
69 catalogued game(s) use this mechanic, spanning 1985–1999.
▶ Explore Economy Buy Sell interactively — see every game + the Godot system