Skip to content

codeforkosen/kawakudari

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

kawakudari

kawakudari.mp4

demo

a famous IchigoJam game "kawakudari" in JavaScript!

theme

program

just single HTML

<!DOCTYPE html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width">
<title>kawakudari</title>
<script type="module">
import { onLoad, ticks, input, end, vec, rnd, addScore, remove, text, play } from "https://taisukef.github.io/crisp-game-lib/es/main.js";

window.title = "kawakudari";
window.description = `
[Hold]
move to right
`;
window.characters = [];
window.options = {
  isPlayingBgm: true,
  isReplayEnabled: true,
  seed: 0, // sound seed
  theme: document.location.hash.substring(1), // crt, pixel, dark
};

let y = 20;
let x = 50;
const enemy = [];
const dhit = 3;

window.update = () => { // canvas size 100x100
  if (!ticks) { // init
    enemy.length = 0;
  }
  if (input.isJustPressed) {
    play("select");
  }
  if (input.isPressed) {
    x++;
  } else {
    x--;
  }
  x = (x + 100) % 100;
  text("O", x, y);
  enemy.forEach(e => {
    text("*", e.x, e.y);
    e.y--;
    if (Math.abs(e.y - y) < dhit && Math.abs(e.x - x) < dhit) {
      end();
      play("explosion")
    };
  });
  if (ticks % 10 == 0) {
    enemy.push(vec(rnd(100), 100))
    addScore(1);
  }
  remove(enemy, (e) => e.y < -10);
};

window.addEventListener("load", onLoad);
</script>
</head>
</html>

lib

解説ブログ

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages