@makefully/platypus 4.1.5 → 4.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (136) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/README.md +3 -3
  3. package/lib/platypus.js +1 -1
  4. package/package.json +7 -6
  5. package/src/AABB.js +685 -0
  6. package/src/ActionState.js +121 -0
  7. package/src/AssetManager.js +206 -0
  8. package/src/CollisionData.js +96 -0
  9. package/src/CollisionDataContainer.js +127 -0
  10. package/src/CollisionShape.js +315 -0
  11. package/src/Component.js +231 -0
  12. package/src/Data.js +64 -0
  13. package/src/DataMap.js +204 -0
  14. package/src/Entity.js +404 -0
  15. package/src/EntityLinker.js +113 -0
  16. package/src/EventHandler.js +115 -0
  17. package/src/EventHandlerList.js +251 -0
  18. package/src/Game.js +840 -0
  19. package/src/Gamepad.js +175 -0
  20. package/src/ID3CaptionPlayer.js +61 -0
  21. package/src/Messenger.js +365 -0
  22. package/src/PIXIAnimation.js +622 -0
  23. package/src/RandomSet.js +140 -0
  24. package/src/SFXPlayer.js +120 -0
  25. package/src/StateMap.js +252 -0
  26. package/src/Storage.js +152 -0
  27. package/src/TickerClient.js +48 -0
  28. package/src/TickerServer.js +23 -0
  29. package/src/TimeEvent.js +50 -0
  30. package/src/TimeEventList.js +100 -0
  31. package/src/VOPlayer.js +684 -0
  32. package/src/Vector.js +702 -0
  33. package/src/components/AIChaser.js +161 -0
  34. package/src/components/AIPacer.js +107 -0
  35. package/src/components/AudioMusic.js +151 -0
  36. package/src/components/AudioSFX.js +673 -0
  37. package/src/components/AudioVO.js +301 -0
  38. package/src/components/CollisionBasic.js +826 -0
  39. package/src/components/CollisionFilter.js +74 -0
  40. package/src/components/CollisionGroup.js +448 -0
  41. package/src/components/CollisionTiles.js +608 -0
  42. package/src/components/ComponentSwitcher.js +173 -0
  43. package/src/components/ControllerInput.js +65 -0
  44. package/src/components/Counter.js +165 -0
  45. package/src/components/EntityCamera.js +215 -0
  46. package/src/components/EntityContainer.js +549 -0
  47. package/src/components/EntityController.js +541 -0
  48. package/src/components/HandlerCamera.js +1052 -0
  49. package/src/components/HandlerCollision.js +1318 -0
  50. package/src/components/HandlerController.js +291 -0
  51. package/src/components/HandlerLogic.js +394 -0
  52. package/src/components/HandlerRender.js +217 -0
  53. package/src/components/Interactive.js +502 -0
  54. package/src/components/LevelBuilder.js +524 -0
  55. package/src/components/LogicAngularMovement.js +154 -0
  56. package/src/components/LogicAttachment.js +265 -0
  57. package/src/components/LogicButton.js +466 -0
  58. package/src/components/LogicCarrier.js +39 -0
  59. package/src/components/LogicDestroyMe.js +58 -0
  60. package/src/components/LogicDirectionalMovement.js +325 -0
  61. package/src/components/LogicDragDrop.js +371 -0
  62. package/src/components/LogicImpactLaunch.js +144 -0
  63. package/src/components/LogicPacingPlatform.js +64 -0
  64. package/src/components/LogicPortable.js +112 -0
  65. package/src/components/LogicPortal.js +115 -0
  66. package/src/components/LogicPushable.js +98 -0
  67. package/src/components/LogicRebounder.js +136 -0
  68. package/src/components/LogicRegionSpawner.js +139 -0
  69. package/src/components/LogicRotationalMovement.js +205 -0
  70. package/src/components/LogicSpawner.js +159 -0
  71. package/src/components/LogicStateMachine.js +382 -0
  72. package/src/components/LogicSwitch.js +77 -0
  73. package/src/components/LogicTeleportee.js +68 -0
  74. package/src/components/LogicTeleporter.js +93 -0
  75. package/src/components/LogicTimer.js +178 -0
  76. package/src/components/LogicWindUpRacer.js +179 -0
  77. package/src/components/Motion.js +371 -0
  78. package/src/components/Mover.js +566 -0
  79. package/src/components/Node.js +289 -0
  80. package/src/components/NodeMap.js +295 -0
  81. package/src/components/NodeResident.js +636 -0
  82. package/src/components/Orientation.js +697 -0
  83. package/src/components/RandomEvents.js +73 -0
  84. package/src/components/RelativePosition.js +204 -0
  85. package/src/components/RelayFamily.js +106 -0
  86. package/src/components/RelayGame.js +53 -0
  87. package/src/components/RelayLinker.js +94 -0
  88. package/src/components/RelayParent.js +57 -0
  89. package/src/components/RelaySelf.js +55 -0
  90. package/src/components/Render.js +178 -0
  91. package/src/components/RenderAnimator.js +275 -0
  92. package/src/components/RenderContainer.js +646 -0
  93. package/src/components/RenderDebug.js +319 -0
  94. package/src/components/RenderDestroyMe.js +59 -0
  95. package/src/components/RenderLottie.js +149 -0
  96. package/src/components/RenderProgress.js +120 -0
  97. package/src/components/RenderSpine.js +840 -0
  98. package/src/components/RenderSprite.js +527 -0
  99. package/src/components/RenderText.js +147 -0
  100. package/src/components/RenderTiles.js +1440 -0
  101. package/src/components/SceneChanger.js +128 -0
  102. package/src/components/TiledLoader.js +1459 -0
  103. package/src/components/Timeline.js +314 -0
  104. package/src/components/Tutorial.js +267 -0
  105. package/src/components/Tween.js +296 -0
  106. package/src/components/VoiceOver.js +373 -0
  107. package/src/components/XHR.js +129 -0
  108. package/src/components/index.js +79 -0
  109. package/src/factory.js +305 -0
  110. package/src/index.js +159 -0
  111. package/src/mixins/PIXI.Graphics.js +41 -0
  112. package/src/platypus.css +68 -0
  113. package/src/sayHello.js +50 -0
  114. package/src/shapes/Capsule.js +74 -0
  115. package/src/shapes/Circle.js +43 -0
  116. package/src/shapes/Ellipse.js +117 -0
  117. package/src/shapes/Point.js +191 -0
  118. package/src/shapes/Polygon.js +112 -0
  119. package/src/shapes/Polyline.js +97 -0
  120. package/src/shapes/Rectangle.js +78 -0
  121. package/src/shapes/RoundedRectangle.js +33 -0
  122. package/src/shapes/Segment.js +346 -0
  123. package/src/shapes/adjustedXY.js +19 -0
  124. package/src/shapes/castFromBox2D.js +92 -0
  125. package/src/shapes/castFromObject.js +53 -0
  126. package/src/shapes/castFromPixiGraphics.js +6 -0
  127. package/src/shapes/castFromPixiShape.js +89 -0
  128. package/src/shapes/castToBox2D.js +190 -0
  129. package/src/shapes/castToPixiGraphics.js +100 -0
  130. package/src/shapes/castToPixiShape.js +61 -0
  131. package/src/shapes/checkPointsMap.js +313 -0
  132. package/src/shapes/index.js +35 -0
  133. package/src/utils/array.js +73 -0
  134. package/src/utils/string.js +39 -0
  135. package/lib/243.platypus.mjs +0 -1
  136. package/lib/platypus.mjs +0 -1
@@ -0,0 +1,217 @@
1
+ /* global platypus */
2
+ import {Container} from 'pixi.js';
3
+ import Data from '../Data.js';
4
+ import Interactive from './Interactive.js';
5
+ import createComponentClass from '../factory.js';
6
+
7
+ export default (function () {
8
+ return createComponentClass(/** @lends platypus.components.HandlerRender.prototype */{
9
+
10
+ id: "HandlerRender",
11
+
12
+ properties: {
13
+ /**
14
+ * Defines whether the entity will respond to touch and click events. Setting this value will create an Interactive component on this entity with these properties. For example:
15
+ *
16
+ * "interactive": {
17
+ * "hover": false,
18
+ * "hitArea": {
19
+ * "x": 10,
20
+ * "y": 10,
21
+ * "width": 40,
22
+ * "height": 40
23
+ * }
24
+ * }
25
+ *
26
+ * @property interactive
27
+ * @type Boolean|Object
28
+ * @default false
29
+ */
30
+ interactive: false
31
+ },
32
+
33
+ publicProperties: {
34
+ /**
35
+ * This is the container holding all children's disply objects for this layer. It's an available property on the layer entity.
36
+ *
37
+ * @property worldContainer
38
+ * @type PIXI.Container
39
+ * @default null
40
+ */
41
+ worldContainer: null,
42
+ /**
43
+ * A multiplier that alters the speed at which the game is running. This is achieved by scaling the delta time in each tick.
44
+ * Defaults to 1. Values < 1 will slow down the rendering, > 1 will speed it up.
45
+ *
46
+ * @property timeMultiplier
47
+ * @type number
48
+ * @default 1
49
+ */
50
+ timeMultiplier: 1
51
+ },
52
+
53
+ /**
54
+ * A component that handles updating the render components on entities that are rendering via PIXI. Calls 'handle-render on children entities every tick. Also initializes handlers for mouse events on the layer level.
55
+ *
56
+ * @memberof platypus.components
57
+ * @uses platypus.Component
58
+ * @constructs
59
+ * @listens platypus.Entity#child-entity-added
60
+ * @listens platypus.Entity#load
61
+ * @listens platypus.Entity#pause-render
62
+ * @listens platypus.Entity#render-update
63
+ * @listens platypus.Entity#set-parent-render-container
64
+ * @listens platypus.Entity#tick
65
+ * @listens platypus.Entity#unpause-render
66
+ * @fires platypus.Entity#handle-render-load
67
+ * @fires platypus.Entity#handle-render
68
+ * @fires platypus.Entity#input-on
69
+ * @fires platypus.Entity#render-paused
70
+ * @fires platypus.Entity#render-unpaused
71
+ * @fires platypus.Entity#render-world
72
+ */
73
+ initialize: function () {
74
+ let definition = null;
75
+
76
+ this.worldContainer = this.worldContainer || new Container();
77
+ this.worldContainer.sortableChildren = true;
78
+ this.worldContainer.label = '';
79
+
80
+ if (this.interactive) {
81
+ definition = Data.setUp(
82
+ 'container', this.worldContainer,
83
+ 'hitArea', this.interactive.hitArea,
84
+ 'hover', this.interactive.hover,
85
+ 'relativeToSelf', true
86
+ );
87
+ this.owner.addComponent(new Interactive(this.owner, definition));
88
+ definition.recycle();
89
+ }
90
+
91
+ this.renderMessage = Data.setUp(
92
+ 'delta', 0,
93
+ 'container', this.worldContainer,
94
+ 'tick', null
95
+ );
96
+ },
97
+
98
+ events: {
99
+ "load": function () {
100
+ /**
101
+ * Once the entity is loaded, this component triggers "render-world" to notify other components about the entities' display container.
102
+ *
103
+ * @event platypus.Entity#render-world
104
+ * @param data {Object}
105
+ * @param data.world {PIXI.Container} Contains entities to be rendered.
106
+ */
107
+ this.owner.triggerEvent('render-world', {
108
+ world: this.worldContainer
109
+ });
110
+
111
+ /**
112
+ * This event is triggered once HandlerRender is ready to handle interactivity.
113
+ *
114
+ * @event platypus.Entity#input-on
115
+ */
116
+ this.owner.triggerEvent('input-on');
117
+ },
118
+
119
+ "child-entity-added": function (entity) {
120
+ /**
121
+ * Triggered on an entity added to the parent.
122
+ *
123
+ * @event platypus.Entity#handle-render-load
124
+ * @param data {Object}
125
+ * @param data.delta {Number} The delta time for this tick.
126
+ * @param data.container {PIXI.Container} The display Container the entities display objects should be added to.
127
+ */
128
+ entity.triggerEvent('handle-render-load', this.renderMessage);
129
+ },
130
+
131
+ "pause-render": function (timeData) {
132
+ if (timeData && timeData.time) {
133
+ this.paused = timeData.time;
134
+ } else {
135
+ this.paused = -1;
136
+ }
137
+ if (this.owner.triggerEventOnChildren) {
138
+ /**
139
+ * Notifies children entities that rendering updates have been paused.
140
+ *
141
+ * @event platypus.Entity#render-paused
142
+ */
143
+ this.owner.triggerEventOnChildren('render-paused');
144
+ }
145
+ },
146
+
147
+ "unpause-render": function () {
148
+ this.paused = 0;
149
+ if (this.owner.triggerEventOnChildren) {
150
+ /**
151
+ * Notifies children entities that rendering updates have been unpaused.
152
+ *
153
+ * @event platypus.Entity#render-unpaused
154
+ */
155
+ this.owner.triggerEventOnChildren('render-unpaused');
156
+ }
157
+ },
158
+
159
+ "tick": function (tick) {
160
+ if (this.paused > 0) {
161
+ this.paused -= tick.delta;
162
+ if (this.paused <= 0) {
163
+ this.paused = 0;
164
+ }
165
+ }
166
+
167
+ if (!this.paused) {
168
+ this.renderUpdate(tick);
169
+ }
170
+ },
171
+
172
+ "render-update": function (tick) {
173
+ this.renderUpdate(tick);
174
+ },
175
+
176
+ "set-parent-render-container": function (entity, container) {
177
+ this.setParentRenderContainer(entity, container);
178
+ }
179
+ },
180
+ methods: {
181
+ renderUpdate: function (tick) {
182
+ const message = this.renderMessage;
183
+
184
+ message.gameDelta = (tick && tick.delta) || 0;
185
+ message.delta = message.gameDelta * this.timeMultiplier;
186
+ message.tick = tick;
187
+
188
+ /**
189
+ * Triggered every tick on owner and its children entities.
190
+ *
191
+ * @event platypus.Entity#handle-render
192
+ * @param data {Object}
193
+ * @param data.delta {Number} The delta time for this tick as manipulated by the timeMultiplier.
194
+ * @param data.gameDelta {Number} The delta time for this tick. Unmanipulated by the timeMultiplier. Use for components that should always run according to actual time.
195
+ * @param data.container {PIXI.Container} The display Container the entities display objects should be added to.
196
+ * @param data.tick {Object} Tick object from "tick" event.
197
+ */
198
+ this.owner.triggerEvent('handle-render', message);
199
+
200
+ if (this.owner.triggerEventOnChildren) {
201
+ this.owner.triggerEventOnChildren('handle-render', message);
202
+ }
203
+ },
204
+
205
+ setParentRenderContainer: function (entity, newContainer) {
206
+ platypus.debug.warn("HandlerRender: No longer required to call 'setParentRenderContainer' on layer - just call 'addToParentContainer' on entity.")
207
+
208
+ entity.addToParentContainer(newContainer);
209
+ },
210
+ destroy: function () {
211
+ this.worldContainer = null;
212
+ this.renderMessage.recycle();
213
+ this.renderMessage = null;
214
+ }
215
+ }
216
+ });
217
+ }());