新增box复合体 修复vector2运算问题
This commit is contained in:
@@ -98,6 +98,7 @@ class Main extends eui.UILayer {
|
||||
new Vector2(10, 10),
|
||||
new Vector2(0, 10),
|
||||
new Vector2(0, 0)]));
|
||||
player.addComponent(new VerletDemo());
|
||||
player.addComponent(new SpawnComponent(EnemyType.worm));
|
||||
// console.log(player.transform.position);
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ class MainScene extends Scene {
|
||||
constructor(displayContent: egret.DisplayObject){
|
||||
super(displayContent);
|
||||
|
||||
this.addEntityProcessor(new SpawnerSystem(new Matcher()));
|
||||
// this.addEntityProcessor(new SpawnerSystem(new Matcher()));
|
||||
this.astarTest();
|
||||
this.dijkstraTest();
|
||||
this.breadthfirstTest();
|
||||
|
||||
27
demo/src/game/VerletDemo.ts
Normal file
27
demo/src/game/VerletDemo.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
class VerletDemo extends RenderableComponent {
|
||||
private _world: VerletWorld;
|
||||
|
||||
protected getWidth(){
|
||||
return 800;
|
||||
}
|
||||
|
||||
protected getHeight(){
|
||||
return 600;
|
||||
}
|
||||
|
||||
public onAddedToEntity(){
|
||||
this._world = new VerletWorld(new Rectangle(0, 0, 800, 600));
|
||||
|
||||
this._world.addComposite(new Box(new Vector2(100, 100), 50, 20));
|
||||
this._world.addComposite(new Box(new Vector2(10, 10), 200, 100));
|
||||
this._world.debugRender(this.entity.scene.stage);
|
||||
}
|
||||
|
||||
public update(){
|
||||
this._world.update();
|
||||
}
|
||||
|
||||
initialize() {
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user