This project is set up so multiple people can work without constantly editing the same file.
- Edit
common/config.jsfor shared tuning: planet orbits, sentry positions, asteroid counts, difficulty numbers, speeds. - Edit
common/difficulty.jsfor difficulty scaling rules. - Edit
common/math.jsonly for reusable math helpers. - Edit
common/rendering.jsonly for reusable render helpers. - Avoid editing
common/common.jsunless you are changing core game behavior. - Student feature work should usually happen in
studentA/studentA.js,studentB/studentB.js,studentC/studentC.js, orstudentD/studentD.js.
Use JuniperJam.onSetup for one-time setup after the core game is created:
JuniperJam.onSetup(function (game) {
var scene = game.scene;
var state = game.state;
// Create meshes, labels, feature state, or setup values here.
});Use JuniperJam.onUpdate for code that should run every frame:
JuniperJam.onUpdate(function (game, dt) {
var state = game.state;
// dt is elapsed time in seconds since the last frame.
});The hook receives a game object with shared access:
game.scene
game.canvas
game.camera
game.config
game.materials
game.state
game.planets
game.sun
game.satelliteRoot
game.aimSightThere are also helper methods:
game.spawnAsteroid(options)
game.createParticleBurst(position, radius)
game.startCameraShake(strength)
game.getOrbitPlaneY()JuniperJam.onSetup(function (game) {
game.state.studentA = {
timer: 0
};
});
JuniperJam.onUpdate(function (game, dt) {
game.state.studentA.timer += dt;
if (game.state.studentA.timer > 5) {
game.startCameraShake(0.1);
game.state.studentA.timer = 0;
}
});- Own one file or feature area when possible.
- Prefer hooks over editing
common/common.js. - Put shared numbers in
common/config.js, not inside feature code. - Keep student-specific state under a unique name, such as
game.state.studentA. - If two people need the same core behavior changed, talk before both editing
common/common.js.
More file ownership notes live in common/OWNERSHIP.md.