# enchant.js 宿題1-1 ## 課題1: ゲームの基本設定と背景設定 ### タスク: 640x640のゲーム画面(core)を作成してください。 "mori.png"という名前の背景画像を画面に表示してください。 開始コード: enchant(); window.onload = function() { // ここにコードを追加 } <details> <summary>解答</summary> enchant(); window.onload = function() { const BACKGROUND = "res/mori.jpeg" const DISP_SIZE = 640; var core = new Core(DISP_SIZE, DISP_SIZE); core.preload(BACKGROUND); core.onload = function() { var background = new Sprite(600, 338); background.x = 0; background.y = 0; background.scaleX = 1.0; background.scaleY = 2.0; background.image = core.assets[BACKGROUND]; core.rootScene.addChild(background); } core.start(); } </details>