1234567891011121314151617181920212223242526 |
- import Entity from "../Entity.js";
- import Texture from "../Texture.js";
- import Tile from "../Tile.js";
- import assets from "../assets.js";
-
- import TPlatform from "../traits/TPlatform.js";
- import TCollider from "../traits/TCollider.js";
- import TPhysics from "../traits/TPhysics.js";
-
- export default class FallingPlatform extends Entity {
- constructor(level, width = 5) {
- super(level);
-
- this.bounds.size.set(width, 0.5);
- this.addTrait(new TCollider(this));
- this.addTrait(new TPlatform(this));
- this.addTrait(new TPhysics(this));
-
- this.texture = new Texture(assets.tiles,
- Tile.createLine(this.bounds.size.x, "platform"));
- }
-
- draw(ctx) {
- this.texture.drawAt(ctx, this.bounds.pos);
- }
- }
|