Skip to content

例題:エンジン起動

エンジン起動する

スプライトや背景を作成せずに、単にエンジンだけを起動してみましょう。
ステージの枠と制御ボタン(緑の旗ボタン、一時停止ボタン、停止ボタン)が見えるだけです。

動作例

なにも表示しないステージだけが表示されます。


※ TypeScratcherロゴをクリックで表示


index.html

html
<!DOCTYPE html>
<html lang="ja">
  <head>
    <meta charset="utf-8" />
    <link rel="icon" href="data:,">
  </head>
  <body>
    <script type="module" src="./index.ts"></script>
  </body>
</html>

index.htmlについて

index.htmlは、index.tsを呼び出すために用意しているものです。
他サンプルでも同じ内容ですので、sample02以降、index.htmlの記載は割愛します。

index.ts

typescript
import { Typescratcher as Ts } from "@tscratch3/typescratcher";

// 開始
Ts.engine.start();

index.tsについて

@tscratch3/typescratcherのimport、engine.start()、この2つが最小限の構成要素です。