This project implements part of the std15.h API (from c4ij) with HTML Canvas API, and Kawakudari Game on top of it.
It will allow programming for IchigoJam-like targets that display IchigoJam FONT on screen using a TypeScript programming language.
window.onload = (e) => {
const canvas = <HTMLCanvasElement> document.getElementById("main");
const context = canvas.getContext('2d');
if (!context) {
alert("HTML canvas 2d context is not supported in your environment...");
return;
}
const std15 = new Std15(context,512,384,32,24);
var frame = 0;
var x = 15;
var running = true;
document.addEventListener("keydown", (e) => {
if (e.key === "ArrowLeft") --x;
if (e.key === "ArrowRight") ++x;
});
setInterval(() => {
if (!running) return;
if (frame % 5 == 0) {
std15.locate(x,5);
std15.putc('0'.charCodeAt(0));
std15.locate(Math.floor(Math.random() * 32.0),23);
std15.putc('*'.charCodeAt(0));
std15.scroll(DIR_UP);
if (std15.scr(x,5) != 0) {
std15.locate(0,23);
std15.putstr("Game Over...");
std15.putnum(frame);
running = false;
}
}
std15.drawScreen();
++frame;
},16);
};
Download and install web browser which supports HTML Canvas API.
Download and install TypeScript suitable for your environment.
- Start browser application.
- Open directory of this project in the file manager application like 'Explorer' or 'Finder'.
To build it
$ npx tsc kawakudari.ts ichigojam.ts
To run it
Drug 'kawakudari.html' to the browser window.
To restart it
Reload the browser.
This work is licensed under a Creative Commons Attribution 4.0 International License.