The Player's real state
The player is a richer object. Its real fields (from app1/js/entities/Player.js) are exactly the things you'd track for a character:
this.onGround = false; // am I touching ground?
this.jumpsLeft = 2; // double jump -> 2 jumps available
this.sliding = false; // am I currently sliding?
this.invulnTimer = 0; // i-frame countdown after a hit
this.facing = 1; // 1 = right, -1 = left
this.walkPhase = 0; // animation phase
Notice the mix of types: booleans (onGround), numbers (jumpsLeft, facing), and names that read like questions (onGround, sliding), the same pattern as if conditions in Group 4.
Every game entity is just an object shaped like this. The difference between a coin and a player is only which fields they hold and what methods they have.
Objects can hold other objects
An object's value can itself be an object or a list, which is how a whole level is described:
const level = {
width: 960,
height: 540,
entities: [], // an array of objects
highScore: 0,
};
level.entities.push({ type: "coin", x: 100, y: 300 });
This nesting is everywhere in games: a game state holds a player, the player holds an animation, an animation holds a list of frames. To read a deep value you chain dots:
level.entities[0].x // the first entity's x
player.walkPhase // the player's animation phase
The lesson from Group 7 still applies, build a list by pushing, then loop over it. Now the list just holds richer objects instead of strings.