survivors: renaming drawDot to fillDot

adding area for touch movement instead of buttons simulating the keyboard
This commit is contained in:
Sheldan
2025-09-08 22:42:47 +02:00
parent 272a86d7fc
commit 681ba1b632
8 changed files with 106 additions and 55 deletions

View File

@@ -1,12 +1,19 @@
import {Vector} from "./base.ts";
export function drawDot(position: Vector, size: number, color: string, ctx: CanvasRenderingContext2D) {
export function fillDot(position: Vector, size: number, color: string, ctx: CanvasRenderingContext2D) {
ctx.beginPath();
ctx.fillStyle = color;
ctx.arc(position.x, position.y, size, 0, 2 * Math.PI);
ctx.fill();
}
export function drawDot(position: Vector, size: number, color: string, ctx: CanvasRenderingContext2D) {
ctx.beginPath();
ctx.strokeStyle = color;
ctx.arc(position.x, position.y, size, 0, 2 * Math.PI);
ctx.stroke();
}
export function moveInDirectionOf(position: Vector, target: Vector, speedFactor: number): Vector {
let playerVector = Vector.createVector(target, position);
let direction = playerVector.normalize()