create-remix-game 1.2.11 → 1.2.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-remix-game",
3
- "version": "1.2.11",
3
+ "version": "1.2.12",
4
4
  "description": "CLI for scaffolding Remix games",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "type": "module",
@@ -172,21 +172,38 @@ window.FarcadeSDK.on('purchase_complete', (data: { success: boolean }) => {
172
172
 
173
173
  ### Purchased Items / Boost Tiers
174
174
 
175
- Check if player owns specific items (boost rewards):
175
+ **IMPORTANT**: The `purchasedItems` array and `hasItem()` contain **reward IDs only**, NOT tier names.
176
176
 
177
177
  ```typescript
178
- // Check if player has a specific reward
178
+ // WRONG - Tier names are NOT in purchasedItems
179
+ if (window.FarcadeSDK.hasItem('tier-1')) { } // NEVER works in production
180
+ if (window.FarcadeSDK.hasItem('tier-2')) { } // NEVER works in production
181
+ if (window.FarcadeSDK.hasItem('tier-3')) { } // NEVER works in production
182
+
183
+ // ✅ CORRECT - Check for specific reward IDs
179
184
  if (window.FarcadeSDK.hasItem('double-jump')) {
180
185
  this.player.enableDoubleJump()
181
186
  }
182
187
 
183
- // Get all purchased items
184
- const items = window.FarcadeSDK.purchasedItems // string[]
188
+ if (window.FarcadeSDK.hasItem('speed-boost')) {
189
+ this.player.speed *= 1.5
190
+ }
191
+ ```
192
+
193
+ **How Boost Tiers Work:**
194
+ 1. Users purchase a **tier** (Bronze/Silver/Gold aka tier-1/tier-2/tier-3)
195
+ 2. Each tier contains **rewards** configured by the game developer
196
+ 3. When purchased, the **reward IDs** (not tier names) are added to `purchasedItems`
197
+ 4. Use `hasItem('reward-id')` to check if a player owns that reward
198
+
199
+ ```typescript
200
+ // Get all purchased reward IDs
201
+ const items = window.FarcadeSDK.purchasedItems // ['double-jump', 'speed-boost', ...]
185
202
 
186
203
  // Initiate a purchase (opens platform modal)
187
204
  const result = await window.FarcadeSDK.purchase({ item: 'tier-1' })
188
205
  if (result.success) {
189
- // Purchase completed
206
+ // Rewards from tier-1 are now in purchasedItems
190
207
  }
191
208
  ```
192
209
 
@@ -207,23 +224,28 @@ The `.remix` directory stores local development state. This is NOT deployed to p
207
224
 
208
225
  ### boost-config.json
209
226
 
210
- Defines boost tier rewards. When a tier is "purchased" in dev mode, its rewards become available via `hasItem()`.
227
+ Defines boost tier rewards. When a tier is "purchased" in dev mode, its **rewards** (not tier names) become available via `hasItem()`.
211
228
 
212
229
  ```json
213
230
  {
214
- "purchasedItems": ["tier-1"], // Owned tier slugs
231
+ "purchasedItems": ["tier-1"], // Tracks which tiers are owned (internal only)
215
232
  "tierRewards": {
216
- "tier-1": ["Reward 1"], // Rewards for tier 1
217
- "tier-2": ["Reward 2"], // Rewards for tier 2
218
- "tier-3": ["Reward 3"] // Rewards for tier 3
233
+ "tier-1": ["Double Jump", "Speed Boost"], // Rewards unlocked by tier 1
234
+ "tier-2": ["Extra Life"], // Rewards unlocked by tier 2
235
+ "tier-3": ["Invincibility"] // Rewards unlocked by tier 3
219
236
  }
220
237
  }
221
238
  ```
222
239
 
240
+ **How it works:**
241
+ - When `tier-1` is in `purchasedItems`, `hasItem('double-jump')` and `hasItem('speed-boost')` return true
242
+ - `hasItem('tier-1')` does **NOT** work - tier names are never in the SDK's purchasedItems
243
+
223
244
  **Reward Slugs**: Reward names are converted to slugs for `hasItem()`:
224
245
 
225
246
  - "Double Jump" → `double-jump`
226
- - "Reward 1" → `reward-1`
247
+ - "Speed Boost" → `speed-boost`
248
+ - "Extra Life" → `extra-life`
227
249
 
228
250
  ### saved-states/
229
251
 
@@ -676,6 +698,18 @@ Phaser is loaded via CDN, not npm. Use the global `Phaser` constant.
676
698
 
677
699
  ### hasItem() returning false
678
700
 
679
- 1. Check `.remix/boost-config.json` has the tier in `purchasedItems`
680
- 2. Verify the reward is listed under that tier in `tierRewards`
681
- 3. Reward names are slugified: "My Reward" `my-reward`
701
+ 1. **Never check for tier names** - `hasItem('tier-1')` will ALWAYS fail in production
702
+ 2. Check `.remix/boost-config.json` has the tier in `purchasedItems`
703
+ 3. Verify the reward is listed under that tier in `tierRewards`
704
+ 4. Reward names are slugified: "My Reward" → `my-reward`
705
+
706
+ ### Common Boost Tier Mistakes
707
+
708
+ ```typescript
709
+ // ❌ WRONG - Will fail in production
710
+ const boostTier = sdk.hasItem('tier-3') ? 3 : sdk.hasItem('tier-2') ? 2 : sdk.hasItem('tier-1') ? 1 : 0
711
+
712
+ // ✅ CORRECT - Check for actual reward IDs
713
+ const hasDoubleJump = sdk.hasItem('double-jump')
714
+ const hasSpeedBoost = sdk.hasItem('speed-boost')
715
+ ```