diff options
Diffstat (limited to 'lib')
52 files changed, 55 insertions, 126 deletions
diff --git a/lib/components/angle.js b/lib/components/angle.js deleted file mode 100644 index 65feeab..0000000 --- a/lib/components/angle.js +++ /dev/null @@ -1,25 +0,0 @@ -import { Component } from '@serpentity/serpentity'; - -/** - * Component that stores an angle - * - * @extends {external:Serpentity.Component} - * @class AngleComponent - * @param {object} config a configuration object to extend. - */ -export default class AngleComponent extends Component { - constructor(config) { - - super(config); - - /** - * The properthy that holds the angle - * - * @property {number} angle - * @instance - * @memberof AngleComponent - */ - this.angle = this.angle || 0; - } -}; - diff --git a/lib/components/body.js b/lib/components/body.js index fc17e17..6034d3e 100644 --- a/lib/components/body.js +++ b/lib/components/body.js @@ -21,5 +21,5 @@ export default class BodyComponent extends Component { */ this.body = this.body || null; } -}; +} diff --git a/lib/components/control_map.js b/lib/components/control_map.js index 4edf318..462ad8b 100644 --- a/lib/components/control_map.js +++ b/lib/components/control_map.js @@ -54,4 +54,4 @@ export default class ControlMapComponent extends Component { */ this.map = this.map || []; } -}; +} diff --git a/lib/components/coupled_entities.js b/lib/components/coupled_entities.js index 29db813..d3374c9 100644 --- a/lib/components/coupled_entities.js +++ b/lib/components/coupled_entities.js @@ -21,5 +21,5 @@ export default class CoupledEntitiesComponent extends Component { */ this.coupledEntities = this.coupledEntities || []; } -}; +} diff --git a/lib/components/dash.js b/lib/components/dash.js index 77807ef..4f482aa 100644 --- a/lib/components/dash.js +++ b/lib/components/dash.js @@ -48,4 +48,4 @@ export default class DashComponent extends Component { */ this.currentCooldown = 0; } -}; +} diff --git a/lib/components/elastic.js b/lib/components/elastic.js index ee41cf8..dc3a67d 100644 --- a/lib/components/elastic.js +++ b/lib/components/elastic.js @@ -8,5 +8,5 @@ import { Component } from '@serpentity/serpentity'; * @param {object} config a configuration object to extend. */ export default class ElasticComponent extends Component { -}; +} diff --git a/lib/components/force.js b/lib/components/force.js deleted file mode 100644 index f0e460c..0000000 --- a/lib/components/force.js +++ /dev/null @@ -1,43 +0,0 @@ -import { Component } from '@serpentity/serpentity'; - -/** - * Component that stores a force vector - * - * @extends {external:Serpentity.Component} - * @class ForceComponent - * @param {object} config a configuration object to extend. - */ -export default class ForceComponent extends Component { - constructor(config) { - - super(config); - - /** - * The properthy that holds the x component of the vector - * - * @property {number} x - * @instance - * @memberof AngleComponent - */ - this.x = this.x || 0; - - /** - * The properthy that holds the y component of the vector - * - * @property {number} y - * @instance - * @memberof AngleComponent - */ - - this.y = this.y || 0; - /** - * The properthy that holds the z component of the vector - * - * @property {number} z - * @instance - * @memberof AngleComponent - */ - this.z = this.z || 0; - } -}; - diff --git a/lib/components/grab.js b/lib/components/grab.js index ab808a8..df41360 100644 --- a/lib/components/grab.js +++ b/lib/components/grab.js @@ -57,4 +57,4 @@ export default class GrabComponent extends Component { */ this.currentCooldown = 0; } -}; +} diff --git a/lib/components/grab_area.js b/lib/components/grab_area.js index 3966c83..c462910 100644 --- a/lib/components/grab_area.js +++ b/lib/components/grab_area.js @@ -30,5 +30,5 @@ export default class GrabAreaComponent extends Component { */ this.constraint = this.constraint || null; } -}; +} diff --git a/lib/components/grabbable.js b/lib/components/grabbable.js index 223b95c..a6efb81 100644 --- a/lib/components/grabbable.js +++ b/lib/components/grabbable.js @@ -7,5 +7,5 @@ import { Component } from '@serpentity/serpentity'; * @class GrabbableComponent * @param {object} config a configuration object to extend. */ -export default class GrabbableComponent extends Component {}; +export default class GrabbableComponent extends Component {} diff --git a/lib/components/max_velocity.js b/lib/components/max_velocity.js index 70bf343..fd696ea 100644 --- a/lib/components/max_velocity.js +++ b/lib/components/max_velocity.js @@ -21,5 +21,5 @@ export default class MaxVelocityComponent extends Component { */ this.maxVelocity = this.maxVelocity || 20; } -}; +} diff --git a/lib/components/pixi_container.js b/lib/components/pixi_container.js index 5e5cb1f..c98f165 100644 --- a/lib/components/pixi_container.js +++ b/lib/components/pixi_container.js @@ -22,4 +22,4 @@ export default class PixiContainerComponent extends Component { */ this.container = this.container || null; } -}; +} diff --git a/lib/components/points.js b/lib/components/points.js index 02b7e44..d366502 100644 --- a/lib/components/points.js +++ b/lib/components/points.js @@ -7,5 +7,5 @@ import { Component } from '@serpentity/serpentity'; * @class PointsComponent * @param {object} config a configuration object to extend. */ -export default class PointsComponent extends Component {}; +export default class PointsComponent extends Component {} diff --git a/lib/components/points_collider.js b/lib/components/points_collider.js index ceec7ee..09cc621 100644 --- a/lib/components/points_collider.js +++ b/lib/components/points_collider.js @@ -31,5 +31,5 @@ export default class PointsColliderComponent extends Component { */ this.pointsTarget = this.pointsTarget || 'nobody'; } -}; +} diff --git a/lib/components/winner.js b/lib/components/winner.js index 74de1c8..1045578 100644 --- a/lib/components/winner.js +++ b/lib/components/winner.js @@ -21,6 +21,6 @@ export default class WinnerComponent extends Component { */ this.winner = this.winner || null; } -}; +} diff --git a/lib/factories/sumo.js b/lib/factories/sumo.js index 009ba8c..b436ef2 100644 --- a/lib/factories/sumo.js +++ b/lib/factories/sumo.js @@ -3,13 +3,13 @@ import { Entity } from '@serpentity/serpentity'; // Components -import AngleComponent from '../components/angle'; +import AngleComponent from '@serpentity/components.angle'; import BodyComponent from '../components/body'; import ControlMapComponent from '../components/control_map'; import CoupledEntitiesComponent from '../components/coupled_entities'; import DashComponent from '../components/dash'; import ElasticComponent from '../components/elastic'; -import ForceComponent from '../components/force'; +import ForceComponent from '@serpentity/components.force'; import GrabAreaComponent from '../components/grab_area'; import GrabbableComponent from '../components/grabbable'; import GrabComponent from '../components/grab'; diff --git a/lib/nodes/controllable.js b/lib/nodes/controllable.js index bb6f3b3..e2ec8a6 100644 --- a/lib/nodes/controllable.js +++ b/lib/nodes/controllable.js @@ -10,7 +10,7 @@ import ControlMapComponent from '../components/control_map'; */ export default class ControllableNode extends Node { -}; +} /** * Holds the types that are used to identify a controllable entity diff --git a/lib/nodes/dasher.js b/lib/nodes/dasher.js index 9662c68..b4a279d 100644 --- a/lib/nodes/dasher.js +++ b/lib/nodes/dasher.js @@ -2,7 +2,7 @@ import { Node } from '@serpentity/serpentity'; import BodyComponent from '../components/body'; import DashComponent from '../components/dash'; -import ForceComponent from '../components/force'; +import ForceComponent from '@serpentity/components.force'; /** * Node identifying an entity that has a control mapping @@ -12,7 +12,7 @@ import ForceComponent from '../components/force'; */ export default class DasherNode extends Node { -}; +} /** * Holds the types that are used to identify a dasher entity diff --git a/lib/nodes/drawn_dasher.js b/lib/nodes/drawn_dasher.js index 162593f..c3e03d1 100644 --- a/lib/nodes/drawn_dasher.js +++ b/lib/nodes/drawn_dasher.js @@ -11,7 +11,7 @@ import PixiContainerComponent from '../components/pixi_container'; */ export default class DrawnDasherNode extends Node { -}; +} /** * Holds the types that are used to identify a drawn dasher entity diff --git a/lib/nodes/drawn_grabber.js b/lib/nodes/drawn_grabber.js index 49af6d4..6508681 100644 --- a/lib/nodes/drawn_grabber.js +++ b/lib/nodes/drawn_grabber.js @@ -11,7 +11,7 @@ import PixiContainerComponent from '../components/pixi_container'; */ export default class DrawnGrabberNode extends Node { -}; +} /** * Holds the types that are used to identify a drawn grabber entity diff --git a/lib/nodes/elastic.js b/lib/nodes/elastic.js index 090a6a7..a205836 100644 --- a/lib/nodes/elastic.js +++ b/lib/nodes/elastic.js @@ -11,7 +11,7 @@ import ElasticComponent from '../components/elastic'; */ export default class ElasticNode extends Node { -}; +} /** * Holds the types that are used to identify an elastic entity diff --git a/lib/nodes/grab_area.js b/lib/nodes/grab_area.js index 9f6c3e0..eaee271 100644 --- a/lib/nodes/grab_area.js +++ b/lib/nodes/grab_area.js @@ -10,7 +10,7 @@ import GrabAreaComponent from '../components/grab_area'; */ export default class GrabAreaNode extends Node { -}; +} /** * Holds the types that are used to identify an entity with a grab diff --git a/lib/nodes/grabbable.js b/lib/nodes/grabbable.js index 4711764..fae7326 100644 --- a/lib/nodes/grabbable.js +++ b/lib/nodes/grabbable.js @@ -11,7 +11,7 @@ import GrabbableComponent from '../components/grabbable'; */ export default class GrabbableNode extends Node { -}; +} /** * Holds the types that are used to identify a grabbable entity diff --git a/lib/nodes/grabber.js b/lib/nodes/grabber.js index db61365..216f9aa 100644 --- a/lib/nodes/grabber.js +++ b/lib/nodes/grabber.js @@ -12,7 +12,7 @@ import GrabComponent from '../components/grab'; */ export default class GrabberNode extends Node { -}; +} /** * Holds the types that are used to identify a grabber entity diff --git a/lib/nodes/limited_velocity.js b/lib/nodes/limited_velocity.js index 554f68c..fc9f336 100644 --- a/lib/nodes/limited_velocity.js +++ b/lib/nodes/limited_velocity.js @@ -11,7 +11,7 @@ import MaxVelocityComponent from '../components/max_velocity'; */ export default class LimitedVelocityNode extends Node { -}; +} /** * Holds the types that are used to identify a limited velocity entity diff --git a/lib/nodes/physical.js b/lib/nodes/physical.js index 77139ec..ff4dd00 100644 --- a/lib/nodes/physical.js +++ b/lib/nodes/physical.js @@ -10,7 +10,7 @@ import BodyComponent from '../components/body'; */ export default class PhysicalNode extends Node { -}; +} /** * Holds the types that are used to identify an entity with a physical diff --git a/lib/nodes/physical_with_attributes.js b/lib/nodes/physical_with_attributes.js index 96ba79d..4b92748 100644 --- a/lib/nodes/physical_with_attributes.js +++ b/lib/nodes/physical_with_attributes.js @@ -1,6 +1,6 @@ import { Node } from '@serpentity/serpentity'; -import AngleComponent from '../components/angle'; +import AngleComponent from '@serpentity/components.angle'; import BodyComponent from '../components/body'; import PositionComponent from '@serpentity/components.position'; @@ -13,7 +13,7 @@ import PositionComponent from '@serpentity/components.position'; */ export default class PhysicalWithAttributesNode extends Node { -}; +} /** * Holds the types that are used to identify an entity with a physics diff --git a/lib/nodes/physical_with_external_force.js b/lib/nodes/physical_with_external_force.js index 32695c7..5a9e118 100644 --- a/lib/nodes/physical_with_external_force.js +++ b/lib/nodes/physical_with_external_force.js @@ -1,7 +1,7 @@ import { Node } from '@serpentity/serpentity'; import BodyComponent from '../components/body'; -import ForceComponent from '../components/force'; +import ForceComponent from '@serpentity/components.force'; /** * Node identifying an entity that has externally applied force @@ -11,7 +11,7 @@ import ForceComponent from '../components/force'; */ export default class PhysicalWithExternalForceNode extends Node { -}; +} /** * Holds the types that are used to identify an entity with a physical diff --git a/lib/nodes/points.js b/lib/nodes/points.js index 40404b4..38a7712 100644 --- a/lib/nodes/points.js +++ b/lib/nodes/points.js @@ -10,7 +10,7 @@ import PointsComponent from '../components/points'; */ export default class PointsNode extends Node { -}; +} /** * Holds the types that are used to identify a points keeping entity diff --git a/lib/nodes/points_collider.js b/lib/nodes/points_collider.js index 4b8fe92..a9d4584 100644 --- a/lib/nodes/points_collider.js +++ b/lib/nodes/points_collider.js @@ -12,7 +12,7 @@ import PointsColliderComponent from '../components/points_collider'; */ export default class PointsColliderNode extends Node { -}; +} /** * Holds the types that are used to identify an entity that can give out diff --git a/lib/nodes/renderable.js b/lib/nodes/renderable.js index 12227a3..5cf0fad 100644 --- a/lib/nodes/renderable.js +++ b/lib/nodes/renderable.js @@ -10,7 +10,7 @@ import PixiContainerComponent from '../components/pixi_container'; */ export default class RenderableNode extends Node { -}; +} /** * Holds the types that are used to identify a renderable entity diff --git a/lib/nodes/renderable_couple.js b/lib/nodes/renderable_couple.js index 39ab886..ffe568d 100644 --- a/lib/nodes/renderable_couple.js +++ b/lib/nodes/renderable_couple.js @@ -12,7 +12,7 @@ import PixiContainerComponent from '../components/pixi_container'; */ export default class RenderableCoupleNode extends Node { -}; +} /** * Holds the types that are used to identify a renderable couple diff --git a/lib/nodes/renderable_with_attributes.js b/lib/nodes/renderable_with_attributes.js index 817036c..7eff2b9 100644 --- a/lib/nodes/renderable_with_attributes.js +++ b/lib/nodes/renderable_with_attributes.js @@ -1,6 +1,6 @@ import { Node } from '@serpentity/serpentity'; -import AngleComponent from '../components/angle'; +import AngleComponent from '@serpentity/components.angle'; import PixiContainerComponent from '../components/pixi_container'; import PositionComponent from '@serpentity/components.position'; @@ -13,7 +13,7 @@ import PositionComponent from '@serpentity/components.position'; */ export default class RenderableWithAttributesNode extends Node { -}; +} /** * Holds the types that are used to identify a renderable with external diff --git a/lib/nodes/winner.js b/lib/nodes/winner.js index 8c5a448..51a3b23 100644 --- a/lib/nodes/winner.js +++ b/lib/nodes/winner.js @@ -10,7 +10,7 @@ import WinnerComponent from '../components/winner'; */ export default class WinnerNode extends Node { -}; +} /** * Holds the types that are used to identify a winner keeping entity diff --git a/lib/sumo.js b/lib/sumo.js index 835e910..f353fe0 100644 --- a/lib/sumo.js +++ b/lib/sumo.js @@ -31,8 +31,6 @@ import Serpentity from '@serpentity/serpentity'; import { Application } from 'pixi.js'; import { Engine } from 'matter-js'; -/* global window document */ - const internals = { kBackgroundColor: 0xd8c590, kNoElementError: 'No element found. Cannot render.', diff --git a/lib/systems/apply_force.js b/lib/systems/apply_force.js index 4adc55d..aff0c4c 100644 --- a/lib/systems/apply_force.js +++ b/lib/systems/apply_force.js @@ -93,5 +93,5 @@ export default class ApplyForceSystem extends System { force.y = 0; } } -}; +} diff --git a/lib/systems/attributes_to_renderable.js b/lib/systems/attributes_to_renderable.js index e5c66a0..072bb60 100644 --- a/lib/systems/attributes_to_renderable.js +++ b/lib/systems/attributes_to_renderable.js @@ -70,4 +70,4 @@ export default class AttributesToRenderableSystem extends System { renderable.container.container.rotation = renderable.angle.angle; } } -}; +} diff --git a/lib/systems/control_mapper.js b/lib/systems/control_mapper.js index c39aea3..c0ab05e 100644 --- a/lib/systems/control_mapper.js +++ b/lib/systems/control_mapper.js @@ -2,8 +2,6 @@ import { System } from '@serpentity/serpentity'; import ControllableNode from '../nodes/controllable'; -/* global navigator window */ - const internals = { gamepadState: { }, @@ -153,5 +151,5 @@ export default class ControlMapperSystem extends System { currentObject[finalProperty] += finalValue; } } -}; +} diff --git a/lib/systems/create_coupling_line.js b/lib/systems/create_coupling_line.js index 8e5e9d7..13aca78 100644 --- a/lib/systems/create_coupling_line.js +++ b/lib/systems/create_coupling_line.js @@ -85,6 +85,7 @@ export default class CreateCouplingLineSystem extends System { initialPosition = true; continue; } + lineGraphic = lineGraphic.lineTo(position.x, position.y); } } @@ -92,5 +93,5 @@ export default class CreateCouplingLineSystem extends System { rootGraphic.addChild(lineGraphic); } } -}; +} diff --git a/lib/systems/dash.js b/lib/systems/dash.js index f648d36..e25e7af 100644 --- a/lib/systems/dash.js +++ b/lib/systems/dash.js @@ -111,6 +111,6 @@ export default class DashSystem extends System { dasher.dash.locked = false; } -}; +} diff --git a/lib/systems/detect_points_collision.js b/lib/systems/detect_points_collision.js index c84f3fc..21e6dad 100644 --- a/lib/systems/detect_points_collision.js +++ b/lib/systems/detect_points_collision.js @@ -97,4 +97,4 @@ export default class DetectPointsCollisionSystem extends System { } } } -}; +} diff --git a/lib/systems/detect_winner.js b/lib/systems/detect_winner.js index e7fbd76..610effb 100644 --- a/lib/systems/detect_winner.js +++ b/lib/systems/detect_winner.js @@ -100,5 +100,5 @@ export default class DetectWinnerSystem extends System { } } -}; +} diff --git a/lib/systems/draw_dash.js b/lib/systems/draw_dash.js index 5ce9043..cb04eb5 100644 --- a/lib/systems/draw_dash.js +++ b/lib/systems/draw_dash.js @@ -100,4 +100,4 @@ export default class DrawDashSystem extends System { frown.visible = false; smile.visible = true; } -}; +} diff --git a/lib/systems/draw_grab.js b/lib/systems/draw_grab.js index 21ffdcd..2808783 100644 --- a/lib/systems/draw_grab.js +++ b/lib/systems/draw_grab.js @@ -111,5 +111,5 @@ export default class DrawGrabSystem extends System { effort.visible = false; shadow.visible = false; } -}; +} diff --git a/lib/systems/elastic.js b/lib/systems/elastic.js index b94d371..0813216 100644 --- a/lib/systems/elastic.js +++ b/lib/systems/elastic.js @@ -90,4 +90,4 @@ export default class ElasticSystem extends System { constraint.stiffness = internals.kBaseStiffness; } } -}; +} diff --git a/lib/systems/grab.js b/lib/systems/grab.js index c50d1d9..7d7d73b 100644 --- a/lib/systems/grab.js +++ b/lib/systems/grab.js @@ -176,4 +176,4 @@ export default class GrabSystem extends System { return constraint; } -}; +} diff --git a/lib/systems/physics_to_attributes.js b/lib/systems/physics_to_attributes.js index e054710..8daa570 100644 --- a/lib/systems/physics_to_attributes.js +++ b/lib/systems/physics_to_attributes.js @@ -70,4 +70,4 @@ export default class PhysicsToAttributesSystem extends System { physicalEntity.angle.angle = physicalEntity.body.body.angle; } } -}; +} diff --git a/lib/systems/physics_world_control.js b/lib/systems/physics_world_control.js index 370701e..88c60e4 100644 --- a/lib/systems/physics_world_control.js +++ b/lib/systems/physics_world_control.js @@ -109,5 +109,5 @@ export default class PhysicsWorldControlSystem extends System { Engine.update(this.engine, currentFrameDuration); } -}; +} diff --git a/lib/systems/reduce_velocity.js b/lib/systems/reduce_velocity.js index 6521014..f831f41 100644 --- a/lib/systems/reduce_velocity.js +++ b/lib/systems/reduce_velocity.js @@ -66,5 +66,5 @@ export default class ReduceVelocitySystem extends System { console.log(limitedVelocityEntity.body.body.velocity, limitedVelocityEntity.maxVelocity.maxVelocity); } } -}; +} diff --git a/lib/systems/render.js b/lib/systems/render.js index 83c740d..8bfa4bf 100644 --- a/lib/systems/render.js +++ b/lib/systems/render.js @@ -92,4 +92,4 @@ export default class RenderSystem extends System { this.application.render(); } -}; +} diff --git a/lib/systems/render_points.js b/lib/systems/render_points.js index f7fd410..8e4885e 100644 --- a/lib/systems/render_points.js +++ b/lib/systems/render_points.js @@ -111,4 +111,4 @@ export default class RenderPointsSystem extends System { internals.blueBar.addChild(blueBar); } } -}; +} diff --git a/lib/systems/render_winner.js b/lib/systems/render_winner.js index ecda168..5095f23 100644 --- a/lib/systems/render_winner.js +++ b/lib/systems/render_winner.js @@ -116,5 +116,5 @@ export default class RenderWinnerSystem extends System { } } } -}; +} |