9-Patch access in TypeScript

Not favoritedFavorited Favorited 0 favourites
  • 6 posts
From the Asset Store
This is a simple login feature to access Metamask in construct 3. Requires a Chrome Browser and Metamask Extension.
  • I'm writing a level editor inside my game and am working on a module for serializing the current layout state using TypeScript. I'm able to read plugin-specific properties of instances from classes such as ITilemapInstance and ISpriteInstance, but I cannot find out how to read properties from an instance of a 9-patch. Is this a bug within the TypeScript typings or a limitation of the engine itself?

    It looks like instances of 9-patch inside InstanceType extend a simple IWorldInstance, which obviously does not contain properties specific to 9-patches.

    Tagged:

  • There isn't currently a script interface for 9-patch instances. However currently I don't think there's anything to expose on its script interface, as there isn't anything unique to 9-patches that is dynamically configurable (see its event sheet features - there are no conditions, actions or expressions unique to 9-patch). Therefore as it stands it's appropriate that it's represented by the generic IWorldInstance interface. Was there something specific you were hoping to access?

  • I was looking to access and change the properties that can also be found on the instance's data within the project layout json file (left-margin, right-margin, origin, seams, etc.).

    { "type": "ThoughtBubble",

    "properties": {

    "left-margin": 2,

    "right-margin": 7,

    "top-margin": 1,

    "bottom-margin": 5,

    "edges": "stretch",

    "fill": "stretch",

    "initially-visible": true,

    "origin": "top-left",

    "seams": "exact"

    },

    }

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Those properties are not currently changeable at runtime, so there is no way to change them either with event sheets or code. (They are used to slice the image in to 9 GPU textures which are then shared across all instances, so it would take some work to allow them to be alterable, especially if it was meant to work per-instance.)

  • In that case, would it be possible to make them visible with read-only access? I do not need to modify them at runtime because I'm only serializing the layout, not deserializing.

    Also, if this data is made visible, would it be possible to make other plugins' immutable instance data - such as SpriteFont's character set and spacing data - visible as well?

  • Yes, we could add read-only properties for those.

Jump to:
Active Users
There are 0 visitors browsing this topic (0 users and 0 guests)