Skip to content

A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.

examples(platformer): read pickups at render cadence

yhh1eea4b80e432
diff --git a/examples/platformer/src/main.ts b/examples/platformer/src/main.ts
index 2bcee1ebe..6ddca396f 100644
--- a/examples/platformer/src/main.ts
+++ b/examples/platformer/src/main.ts
@@ -6,6 +6,6 @@ import { coinBobSystem, coinPickupSystem } from './systems/coin';
import { scoreSystem } from './systems/score';
addSystemToSchedule(Schedule.FixedPreUpdate, playerSystem);
-addSystemToSchedule(Schedule.FixedPostUpdate, coinPickupSystem);
+addSystemToSchedule(Schedule.Update, coinPickupSystem);
addSystemToSchedule(Schedule.Update, coinBobSystem);
addSystemToSchedule(Schedule.Update, scoreSystem);
diff --git a/examples/platformer/src/systems/player.ts b/examples/platformer/src/systems/player.ts
index a4b8d9a14..4d4a9bc93 100644
--- a/examples/platformer/src/systems/player.ts
+++ b/examples/platformer/src/systems/player.ts
@@ -15,7 +15,6 @@ export const playerSystem = defineSystem(
if (input.isKeyDown('ArrowRight') || input.isKeyDown('KeyD')) moveX += 1;
cc.velocity.x = moveX * player.speed;
- // Gravity accumulates every fixed step; move-and-slide zeroes it on landing.
cc.velocity.y += GRAVITY * time.fixedDelta;
const jump = input.isKeyPressed('Space')