basic version without world movement

Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
2026-04-25 14:23:45 +09:00
parent 3b0d5b4864
commit 5620f1860f
4 changed files with 114 additions and 16 deletions

View File

@@ -1,29 +1,21 @@
<script>
import { onMount } from 'svelte';
import { initializeGame, updateGame } from './game.js';
let id; // the div in the HTML
let sprite;
const sketch = (p5) => {
p5.setup = async () => {
p5.createCanvas(400, 300);
sprite = new p5.Sprite();
sprite.img = '/assets/monster.png';
sprite.diameter = 100;
sprite.scale = 0.5;
};
window.setup = async () => {
createCanvas(400, 800).parent(id);
initializeGame();
};
p5.draw = () => {
p5.clear();
p5.fill(100);
p5.ellipse(p5.mouseX, p5.mouseY, 20, 20);
sprite.debug = p5.mouse.pressing();
};
window.draw = () => {
updateGame();
};
// On startup
onMount(function () {
let myp5 = new p5(sketch, id);
new p5();
});
</script>