Implement Player

This commit is contained in:
Dennis Schoepf 2021-07-14 16:24:37 +02:00
parent d0e3e51a7d
commit 0b74a918d6
5 changed files with 80 additions and 10 deletions

16
main.ts
View file

@ -1,15 +1,23 @@
import p5 from 'p5';
import { colors } from './src/colors';
import { SCREEN_WIDTH, SCREEN_HEIGHT } from './src/constants';
import { Player } from './src/Player';
const sketch = (s) => {
let player;
s.setup = () => {
s.createCanvas(SCREEN_WIDTH, SCREEN_HEIGHT);
s.noCursor();
player = new Player();
};
s.draw = () => {
s.background(220);
s.rect(200, 200, 200, 200);
s.print(s.mouseX, s.mouseY);
s.background(s.color(colors.greyLighter));
player.follow();
};
};
const p5Instance = new p5(sketch);
export const mp5 = new p5(sketch);