5cf42a5e5d
Frontend: - HTML5 Canvas isometric tilemap renderer - Eichenhafen starting city (procedural) - Click-to-move A* pathfinding - Player stats, HP/SP/EXP bars, skill bar, minimap - 3 NPCs (merchant, class master, innkeeper) - 6 monster spawns with aggro AI - Combat: auto-attack, damage numbers, EXP/gold - Player death + respawn Backend: - FastAPI server with SQLite - Ollama LLM bridge for events + dialogue - Event validation (no soft-lock) - NPC dialogue generation Design: - Full DESIGN.md with architecture, formulas, milestones - 6 base classes + 6 advanced classes - 3 fixed cities, dynamic events
21 lines
448 B
JavaScript
21 lines
448 B
JavaScript
// camera.js — Camera follows player
|
|
|
|
class Camera {
|
|
constructor() {
|
|
this.x = 0;
|
|
this.y = 0;
|
|
this.targetX = 0;
|
|
this.targetY = 0;
|
|
this.smoothing = 0.1;
|
|
}
|
|
|
|
follow(targetX, targetY) {
|
|
this.targetX = targetX;
|
|
this.targetY = targetY;
|
|
}
|
|
|
|
update() {
|
|
this.x += (this.targetX - this.x) * this.smoothing;
|
|
this.y += (this.targetY - this.y) * this.smoothing;
|
|
}
|
|
} |