ゲーム作成用のひな形を用意します。
<!-- index.html --> <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, user-scalable=no"> <meta name="apple-mobile-web-app-capable" content="yes"> <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent"> <title>template</title> <script type="text/javascript" src="js/enchant.js"></script> <script type="text/javascript" src="js/main.js"></script> <style type="text/css"> body { margin: 0; padding: 0; } </style> </head> <body> </body> </html>
// main.js enchant(); window.onload = preloadAssets; var game; var scene; function preloadAssets() { game = new Game(320,480); game.onload = init; game.start(); } function init() { game.scale = 1; game.fps = 30; scene = new Scene(); scene.backgroundColor = "#000"; game.pushScene(scene); main(); } function main() { game.addEventListener(Event.ENTER_FRAME,enterFrame); } function enterFrame(e) { }