File tree 5 files changed +12
-11
lines changed
5 files changed +12
-11
lines changed Original file line number Diff line number Diff line change 1
1
import { SpriteSheetAnimation } from "@serbanghita-gamedev/component" ;
2
- import { EntityDeclaration } from "@serbanghita-gamedev/ecs" ;
3
- import { TiledMapFile } from "@serbanghita-gamedev/tiled" ;
4
- import { PhysicsBodyPropsDeclaration } from "@serbanghita-gamedev/component/PhysicsBody" ;
5
- import { SpriteSheetPropsDeclaration } from "@serbanghita-gamedev/component/SpriteSheet" ;
2
+ import { TiledMapFileContents } from "@serbanghita-gamedev/tiled" ;
3
+ import { PhysicsBodyPropsDeclaration , SpriteSheetPropsDeclaration } from "@serbanghita-gamedev/component" ;
6
4
7
5
export async function loadLocalImage ( data : string ) : Promise < HTMLImageElement > {
8
6
const img = new Image ( ) ;
@@ -25,7 +23,7 @@ export type Assets = {
25
23
"entities/animations" : { [ key : string ] : { [ key : string ] : SpriteSheetAnimation } } ;
26
24
"entities/declarations" : EntityDeclaration [ ] ;
27
25
"maps/images" : { [ key : string ] : HTMLImageElement } ;
28
- "maps/declarations" : { [ key : string ] : TiledMapFile } ;
26
+ "maps/declarations" : { [ key : string ] : TiledMapFileContents } ;
29
27
} ;
30
28
31
29
export type EntityDeclaration = {
Original file line number Diff line number Diff line change @@ -8,3 +8,4 @@ export { default as TiledMapFile } from "./TiledMapFile";
8
8
export { default as Position } from "./Position" ;
9
9
export { default as Tile } from "./Tile" ;
10
10
export { default as TileMatrix } from "./TileMatrix" ;
11
+ export { default as PhysicsBody , PhysicsBodyPropsDeclaration } from "./PhysicsBody" ;
Original file line number Diff line number Diff line change 1
- import Entity , { EntityDeclaration } from "./Entity" ;
2
- import System , { SystemSettings } from "./System" ;
1
+ import Entity from "./Entity" ;
2
+ import System from "./System" ;
3
3
import Query , { IQueryFilters } from "./Query" ;
4
4
import Component from "./Component" ;
5
5
import { hasBit } from "@serbanghita-gamedev/bitmask" ;
6
6
import ComponentRegistry from "./ComponentRegistry" ;
7
+ import { EntityDeclaration } from "@serbanghita-gamedev/assets" ;
7
8
8
9
export default class World {
9
10
public declarations = {
Original file line number Diff line number Diff line change 5
5
6
6
import Component from "./Component" ;
7
7
import ComponentRegistry from "./ComponentRegistry" ;
8
- import Entity , { EntityDeclaration } from "./Entity" ;
8
+ import Entity from "./Entity" ;
9
9
import Query from "./Query" ;
10
10
import System from "./System" ;
11
11
import World from "./World" ;
12
12
13
13
export {
14
14
Component , ComponentRegistry ,
15
- Entity , EntityDeclaration , Query ,
15
+ Entity , Query ,
16
16
System , World
17
17
}
Original file line number Diff line number Diff line change @@ -74,7 +74,8 @@ export default class Rectangle {
74
74
return ! ( this . topRightX < rectangle . topLeftX || this . bottomLeftY < rectangle . topLeftY || this . topLeftX > rectangle . topRightX || this . topLeftY > rectangle . bottomLeftY ) ;
75
75
}
76
76
77
- public intersectsWithPoint ( point : Point ) : boolean {
78
- return point . x >= this . topLeftX && point . x <= this . topRightX && point . y >= this . topLeftY && point . y <= this . bottomLeftY ;
77
+ public intersectsWithPoint ( point : Point , tolerance : number = 0 ) : boolean {
78
+ return point . x >= this . topLeftX - tolerance && point . x <= this . topRightX + tolerance && point . y >= this . topLeftY - tolerance && point . y <= this . bottomLeftY + tolerance ;
79
79
}
80
+
80
81
}
You can’t perform that action at this time.
0 commit comments