MCPcopy Create free account
hub / github.com/melonjs/melonJS / detectShape

Function detectShape

packages/melonjs/src/level/tiled/TMXObject.js:18–35  ·  view source on GitHub ↗

* Detect the shape type from the TMX object settings. * Shape markers are mutually exclusive; the first match wins. * @param {object} settings - TMX object settings * @returns {string} one of "ellipse", "capsule", "point", "polygon", "polyline", "rectangle" * @ignore

(settings)

Source from the content-addressed store, hash-verified

16 * @ignore
17 */
18function detectShape(settings) {
19 if (typeof settings.ellipse !== "undefined") {
20 return "ellipse";
21 }
22 if (typeof settings.capsule !== "undefined") {
23 return "capsule";
24 }
25 if (typeof settings.point !== "undefined") {
26 return "point";
27 }
28 if (typeof settings.polygon !== "undefined") {
29 return "polygon";
30 }
31 if (typeof settings.polyline !== "undefined") {
32 return "polyline";
33 }
34 return "rectangle";
35}
36
37/**
38 * a TMX Object defintion, as defined in Tiled

Callers 1

constructorMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected