Red Riding Hood: Final Project
CS 111 Final Project — Full GameEngine architecture and OOP evidence.
🐺 Red Riding Hood: Final Project
| Author: Anika Seksaria | Role: Scrummer | Sprint: 6 |
Portfolio Navigation
🏠 Main Portfolio | 📝 Homework Lessons | 🏰 FA1 & FA2
🎯 Project Overview:
Red Riding Hood is the Sprint 6 capstone project. — a fully playable multi-level game built on the OCS GameEngine. It ties together every CS 111 learning objective into one cohesive system.
| Game Object | Class | Role |
|---|---|---|
| Red Riding Hood | Player extends Character |
Player-controlled character |
| Wolf | Wolf extends Character |
Hostile NPC with reaction logic |
| Forest | Background extends GameObject |
Layered scrolling environment |
| Trees | Barrier extends GameObject |
Collision boundaries |
🏗️ Full Engine Architecture
Object Lifecycle
initialize() → update() → draw() → destroy()
The Game Loop
function gameLoop() {
// Iteration — forEach over all active objects
gameObjects.forEach(obj => {
obj.update(); // state + physics
obj.draw(); // canvas render
});
requestAnimationFrame(gameLoop); // recursion for animation
}
State Management
// Game loop states and pause conditions
if (this.gameEnv.isPaused) return;
// Level transition state
if (this.hasReachedEnd) {
this.gameEnv.transitionToLevel(nextLevel);
}
⭐ My Biggest Contribution: Level Transition Engine
The Problem
When transitioning levels, old game objects stayed in memory and rendered on top of the new level — causing visual glitches and performance issues.
The Solution
// Single Responsibility: destroy() only handles cleanup
destroy() {
if (this.element) {
this.element.remove(); // removes DOM node
this.element = null; // clears reference for garbage collection
}
}
// Called on every object when a level ends
gameObjects.forEach(obj => obj.destroy()); // iteration ✅
gameObjects = []; // reset array ✅
✅ Complete CS111 Rubric Evidence
| CS111 Requirement | Evidence in Red Riding Hood |
|---|---|
| Writing Classes | Wolf, Player — both custom subclasses |
| Methods & Parameters | handleCollision(other, direction) — 2 params |
| Instantiation | GameLevel config object instantiates all objects |
| Inheritance | GameObject → Character → Wolf/Player — 3 levels |
| Method Overriding | update(), draw(), handleCollision() all overridden |
| Constructor Chaining | super(data, gameEnv) in Wolf and Player |
| Iteration | forEach in game loop and destroy sequence |
| Conditionals | Collision type checks, state transitions |
| Nested Conditions | NPC type + proximity + inventory — 3 levels deep |
| Numbers | x, y, velocity, score |
| Strings | Character names, sprite paths, game states |
| Booleans | isJumping, isPaused, isVulnerable |
| Arrays | gameObjects[], level data arrays |
| JSON Objects | NPC config, GameLevel setup objects |
| Mathematical Ops | +=, *, Math.pow() for physics |
| String Ops | Template literals for sprite paths |
| Boolean Expressions | &&, \|\|, ! in compound conditions |
| Canvas Rendering | draw() every frame via requestAnimationFrame |
| Keyboard Events | keydown/keyup listeners for player control |
| GameEnv Config | Object literals configure level and game state |
| Single Responsibility | Each method does exactly one thing |
| Data-Driven Design | GameBuilder Object Literals for all game objects |
| State Management | Pause, transition, and game loop states |
| SDLC | Kanban, feature branches, Selective PRs |
| Documentation | Inline comments on every method |
| Testing | Each object verified before merging via PR |
Anika Seksaria · CS111 · Spring 2026 · GameEngine v1.1