console.log("Raytracer (frameworkv3 + paperdolls) starting"); var game = new Game(); window.onload = function () { game.preloadImagesThenStart( [ { name: "stone", url: "images/stone.png" }, { name: "wood", url: "images/wood.png" }, { name: "shotgun", url: "images/shotgun.png" }, { name: "machinegun", url: "images/machinegun.png" }, { name: "pulserifle", url: "images/pulserifle.png" } ], function () { Tiles.bindImages(game.images); World.loadLevel(0); Player.resetToSpawn(); var w = Math.max(320, window.innerWidth - 2); var h = Math.max(240, window.innerHeight - 2); var scene = new RaycastScene(w, h); scene.npcLight = 1; game.loadScene(scene); NpcSystem.initEmpty(); NpcSystem.addNpc({ x: 48 + 64, y: 48, facingDeg: 180, clip: "walk", animating: true, label: "walker" }); NpcSystem.addNpc({ x: 48 + 128, y: 48 + 96, facingDeg: 90, clip: "walk", animating: false, time: 0.25, label: "guard" }); NpcSystem.addNpc({ x: 48 + 32, y: 48 + 160, facingDeg: 0, clip: "attack", animating: true, label: "attacker" }); NpcSystem.addNpc({ x: 200, y: 100, facingDeg: 270, clip: "walk", animating: true, label: "side" }); NpcSystem.load( "paperdolls/male-body/", "male-body-atlas.ppda", "paperdolls/male-sword/", "male-sword-atlas.ppda" ).then(function () { console.log("Paperdolls loaded (body + sword)"); }).catch(function (err) { console.error("Paperdoll load failed", err); }); window.addEventListener("resize", function () { scene.size.x = Math.max(320, window.innerWidth - 2); scene.size.y = Math.max(240, window.innerHeight - 2); }); } ); };