@maccesar/titools 4.15.0 → 4.16.1
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/README.md +10 -1
- package/package.json +1 -1
- package/skills/ti-game/SKILL.md +90 -197
- package/skills/ti-game/references/api.md +52 -15
- package/skills/ti-game/references/debugging-performance.md +102 -0
- package/skills/ti-game/references/examples.md +53 -0
- package/skills/ti-game/references/patterns.md +699 -0
- package/skills/ti-game/references/project-setup.md +19 -6
- package/skills/ti-game/references/recipes-action.md +653 -0
- package/skills/ti-game/references/recipes-adventure-effects.md +340 -0
- package/skills/ti-game/references/roadmap.md +45 -65
- package/skills/ti-game/references/tilemaps.md +127 -0
- package/skills/ti-game/references/recipes.md +0 -1679
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Setting up a ti.game project
|
|
2
2
|
|
|
3
|
-
Installing the module, wiring it into Classic and Alloy projects, organizing art and sound, and the lifecycle work the engine does not do for you.
|
|
3
|
+
Installing the module, wiring it into Classic and Alloy projects, organizing art and sound, and the lifecycle work the engine does not do for you. Verified against `ti.game@c216e7f` (2026-08-28).
|
|
4
4
|
|
|
5
5
|
<!-- TOC-START -->
|
|
6
6
|
## Contents
|
|
@@ -56,8 +56,13 @@ Pinning `version` is worth the extra attribute: with two module versions install
|
|
|
56
56
|
| `0.4.0` built before 2026-08-26 | additionally `sprite.attachTo()` / `detach()` / `attachedTo`, and `gameView.follow()` still aborts the app on Android if it is handed anything that is not a sprite |
|
|
57
57
|
| `0.4.0` built on 2026-08-26 but before `83b7863` | additionally the opacity an attachment inherits from its target, the `anchor` property, and percentage strings on every ratio — a build in this window has `attachTo` but treats `'55%'` as a number it cannot read |
|
|
58
58
|
| `0.4.0` at its last commit (`b780051`) | additionally everything the `0.5.0` bump carries: `hitboxShape: 'rotatedRect'`, circular solids resolved as circles, `solidMode`, `gravityX`, `linearDamping`, and `restitution` read off both sides of a contact. It also still pulls a swept sprite back to where its frame started when it begins the frame already touching a solid, so a `swept: true` body parked on a slope creeps and then breaks loose as if launched |
|
|
59
|
+
| `0.5.0` built before `d042060` | the performance HUD object form (`debug: { hud, hitbox, hudFont }`) and the `performance` event |
|
|
60
|
+
| `0.5.0` built before `10a046e` | additionally `Game.createTileLayer()`, native visible-cell tile rendering, tile collision/live edits, and TileLayer participation in `findPath` |
|
|
61
|
+
| `0.5.0` built before `85a723d` | additionally read-only `onWallLeft` / `onWallRight` and the `wallhit` transition event for sprite and TileLayer walls |
|
|
62
|
+
| `0.5.0` built before `05cb60c` | additionally `wallSlideSpeed`, the native downward-speed cap while pressed against a wall |
|
|
63
|
+
| `0.5.0` built before `c216e7f` | on Android only, string-row TileLayers with a nested JS `legend` decode as empty because the proxy rejects the ordinary map object; numeric data is unaffected |
|
|
59
64
|
|
|
60
|
-
The
|
|
65
|
+
The newest local release tag is still `0.4.0` (2026-08-20), so tagged artifacts lag one manifest bump plus the HUD and TileLayer work that landed after `0.5.0` was introduced. If a documented call is `undefined`, check the manifest and build commit before hunting for a typo, and rebuild from upstream `main`. More reliable than either is feature detection: read a property **before** writing it (`typeof sprite.hitboxScaleX === 'undefined'`) or probe a method/factory (`typeof Game.createTileLayer === 'function'`). Write-then-read is not proof because Kroll can retain an unknown property on the proxy.
|
|
61
66
|
|
|
62
67
|
Building the module from source:
|
|
63
68
|
|
|
@@ -69,7 +74,7 @@ ti build -p ios --build-only # macOS only → ios/dist/ti.game-iphone-<ve
|
|
|
69
74
|
|
|
70
75
|
## Classic projects
|
|
71
76
|
|
|
72
|
-
`require('ti.game')` anywhere and add the GameView to a window. The
|
|
77
|
+
`require('ti.game')` anywhere and add the GameView to a window. The 33 demos in the module's `example/` folder are Classic, each one a CommonJS module exporting a start function (`app.js` is the launcher, not a demo):
|
|
73
78
|
|
|
74
79
|
```javascript
|
|
75
80
|
// Resources/flappy.js
|
|
@@ -270,6 +275,8 @@ The engine handles what it owns: the render loop pauses and resumes with the act
|
|
|
270
275
|
A leaked `setInterval` keeps running after the window closes, keeps reading sprite properties from a dead scene and keeps the whole closure alive. A looping `createSound` keeps playing over the next screen.
|
|
271
276
|
|
|
272
277
|
```javascript
|
|
278
|
+
const levelObjects = []; // keep emitters, ropes, and TileLayers here
|
|
279
|
+
|
|
273
280
|
function cleanup() {
|
|
274
281
|
clearInterval(aiTimer);
|
|
275
282
|
clearTimeout(spawnTimer);
|
|
@@ -280,7 +287,10 @@ function cleanup() {
|
|
|
280
287
|
target.removeEventListener(eventName, handler);
|
|
281
288
|
});
|
|
282
289
|
gameView.pause();
|
|
283
|
-
gameView.removeAllSprites();
|
|
290
|
+
gameView.removeAllSprites(); // Sprite/Text only
|
|
291
|
+
levelObjects.forEach((object) => { // emitters, ropes, tile layers
|
|
292
|
+
gameView.remove(object);
|
|
293
|
+
});
|
|
284
294
|
}
|
|
285
295
|
|
|
286
296
|
// Classic
|
|
@@ -301,7 +311,7 @@ function listen(target, eventName, handler) {
|
|
|
301
311
|
}
|
|
302
312
|
```
|
|
303
313
|
|
|
304
|
-
|
|
314
|
+
`removeAllSprites()` is named literally: it clears Sprite/Text objects and their attachment state, but leaves emitters, ropes, and tile layers in the scene. Track non-sprite scene objects in `levelObjects` and remove them explicitly. For restart-without-teardown, pooling and repositioning is cheaper than rebuilding: reset positions, zero velocities, `clearTweens()`, and re-`play()` animations.
|
|
305
315
|
|
|
306
316
|
### GPU textures: `unload()`
|
|
307
317
|
|
|
@@ -328,7 +338,7 @@ Since 2026-08-23 the module retires the previous generation itself: stale render
|
|
|
328
338
|
|
|
329
339
|
## Debugging and tuning
|
|
330
340
|
|
|
331
|
-
- **`debug: true` on the GameView** draws collision shapes for the whole scene;
|
|
341
|
+
- **`debug: true` on the GameView** draws collision shapes for the whole scene; object form separates hitboxes from the performance HUD: `debug: { hitbox: true, hud: 'topRight' }`. On a sprite or TileLayer, `debug` remains a boolean. See [debugging-performance.md](debugging-performance.md) for colors, telemetry payloads, platform-only keys, and a tuning workflow.
|
|
332
342
|
- **Physics that feels wrong is usually a units problem.** Speeds are px/s and accelerations px/s², both in surface pixels — which is why the demos express them as fractions of `W` and `H`. A gravity of `20` is imperceptible; `H * 2.2` is a snappy platformer.
|
|
333
343
|
- **Sprite is invisible?** Check in order: was it added to the GameView, does it have a sheet, is `width`/`height` non-zero, is it inside the surface bounds, and is its `zIndex` below a background sprite.
|
|
334
344
|
- **Collision never fires?** `collisionGroup` goes on the *target*, `collidesWith` on the *mover*. Both need to be set, and `visible: false` disables collision entirely.
|
|
@@ -344,4 +354,7 @@ The JS API is identical on Android and iOS. What differs is around it:
|
|
|
344
354
|
- **`logicalDensityFactor` lies in the iOS Simulator** — it reports the device scale while the surface renders at 1x. Derive dp→scene units from the surface instead: `H / Ti.Platform.displayCaps.platformHeight`.
|
|
345
355
|
- **Android's `touchFeedback` ripple** cannot animate over the GL canvas and logs `RippleDrawable` errors; give on-screen buttons manual `backgroundColor` feedback on `touchstart`/`touchend`.
|
|
346
356
|
- **Sound formats**: WAV, MP3 and OGG on Android; WAV, MP3 and M4A on iOS. WAV for effects, MP3 for music covers both.
|
|
357
|
+
- **TileLayer grid configuration**: assign `legend`, `firstGid`, `cols`, and `rows` in `createTileLayer()`. iOS accepts later writes; Android treats them as creation-time inputs.
|
|
358
|
+
- **Android `legend` compatibility**: string-row maps require build `c216e7f` or newer. Older Android proxies ignore a normal nested JS legend object; use numeric data or update the module.
|
|
359
|
+
- **Performance telemetry**: `averagePresentMs` and `presentFailures` exist only on iOS and are omitted on Android.
|
|
347
360
|
- **`theme: 'Theme.Titanium.DayNight.NoTitleBar'`** on the window is the Android idiom for a fullscreen game surface; on iOS use `navBarHidden`/`statusBarHidden` (or the Alloy XML equivalents).
|