How do I draw on text object using behavior

0 favourites
  • 10 posts
From the Asset Store
With this template you will learn how to use the GooglePlay Games native plugin
  • I'm developing a "speech bubble" behavior for Text plugin.

    The purpose of this behavior is to surround the text object with a speech bubble.

    So my question is... is there anyway to draw using a behavior?

    I have tried using

    var ctx = this.inst.runtime.overlay_ctx;

    to get the overlay but no success. Is there anyway that I can draw with behavior?

  • Behaviors can't draw anything. You should make a plugin if you want something to draw.

  • Actually I have been thinking for a while to create a simple sprite compositor behavior that can be added multiple times to a sprite (or sprite-like) object.

    It would allow you to attack another sprite to the base sprite such that animation, position and other relevant options of the base sprite can be updated in the composite sprites.

    Something like:

    composite behavior action "SetCompositeObject(<objectlistOption>)" - sets the object to update.

    composite behavior action "SyncAnimation(<Yes|No>)" - sets animation syncing.

    composite behavior action "SyncPosition(<Yes|No>)" - sets position syncing.

    composite behavior action "SyncPosition(<Yes|No>)" - sets angle syncing.

    composite behavior action "SyncScale(<Yes|No>)" - sets scale syncing.

    composite behavior action "SyncOnCreate(<Yes|No>)" - sets creation syncing.

    composite behavior action "SyncOnDestroy(<Yes|No>)" - sets creation syncing.

    composite behavior condition "OnChangeAnimation(baseObject, animationName, animationFrame)" - triggered on composite object when the base object animation changes.

    composite behavior condition "OnRedraw(baseObject)" - triggered on composite object on redraw of base object.

    Please give feedback, useful or not? The point is to make it easier to manage layered sprites from the base objects point of view. Similar to "pin" behavior in that respect, but from the other direction and gives a way to better control for composite sprite logic.

  • I actually would like to bump this, being able to draw stuff on top of objects using Behaviours would be extremely useful for debugging purposes.

    For example, I have a few objects which are linked together and I would like to draw a physical line between them. That way I can immediately spot if objects are still correctly linked.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • LennardF1989

    Did you somehow miss Ashley's response? The SDK is perhaps your best bet.

  • LennardF1989

    Did you somehow miss Ashley's response? The SDK is perhaps your best bet.Her response is the reason as to why I am bumping a topic from 2012: The SDK doesn't support it.

    Hence I am asking her to reconsider and expose edit-time drawing functions to Behaviours for debugging purposes, my example being one way to apply it.

  • > LennardF1989

    >

    > Did you somehow miss Ashley's response? The SDK is perhaps your best bet.Her response is the reason as to why I am bumping a topic from 2012: The SDK doesn't support it.

    Hence I am asking her to reconsider and expose edit-time drawing functions to Behaviours for debugging purposes, my example being one way to apply it.

    Ashley is a male, btw.

    Also, bump. I see no reason why behaviors shouldn't be able to draw - some possibilities have already been mentioned: a debug behavior, health bars, a speech bubble surrounding text (that has the benefit of being compatible with other text-modifying effects)

  • I think those ideas are better implemented as plugins anyway. For example a speech bubble isn't a kind of behavior that any kind of object can use, it's a new kind of object.

  • So, If I wanted to have npcs with speech bubbles and text that is contained visually inside those speech bubbles... Is the only way to do that, using sprite fonts. I've been trying to find a solution to this for a while. Text objects are just so unpredictable as to where they appear on the screen or how big they'll be on different computers.

    I've never tried sprite fonts. Reading about it makes it look quite complex.

  • Sorry. Nevermind this question.

    Sprite font is exactly what I needed and super easy to use..

    I wish I'd known about this before.

    I need to retype all the text in my game now.

    Ah well.

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