factor player direction as component property
This commit is contained in:
parent
e502ca00de
commit
fb85af7c40
2 changed files with 15 additions and 10 deletions
|
@ -1,4 +1,3 @@
|
|||
import { assert } from "https://deno.land/std@0.221.0/assert/assert.ts";
|
||||
import { v2 } from "../../common/utils.ts";
|
||||
import { Vec2 } from "../../common/utils.ts";
|
||||
import { CompDisplay } from "../components/display.ts";
|
||||
|
@ -19,7 +18,9 @@ export class CompEnemy {
|
|||
|
||||
find_target_from(engine: Engine, pos: Vec2, range: number) {
|
||||
const radius = v2(range, range);
|
||||
const found = engine.one(Query.with(CompPlayer).with(CompId).and(query_in_rect(pos.sub(radius), pos.add(radius))));
|
||||
const found = engine.one(
|
||||
Query.with(CompPlayer).with(CompId).and(query_in_rect(pos.sub(radius), pos.add(radius))),
|
||||
);
|
||||
if (found === null) {
|
||||
this.target = null;
|
||||
return;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue