How do I draw on text object using behavior

For developers using the Construct 2 Javascript SDK

Post » Fri Jul 06, 2012 8:47 am

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?
B
7
S
2
G
1
Posts: 18
Reputation: 1,340

Post » Fri Jul 06, 2012 1:25 pm

Behaviors can't draw anything. You should make a plugin if you want something to draw.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,600

Post » Mon Aug 06, 2012 2:28 am

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.
B
14
S
4
G
4
Posts: 20
Reputation: 3,676

Post » Sun Dec 15, 2013 7:13 pm

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.LennardF19892013-12-15 19:16:11
B
4
Posts: 6
Reputation: 210

Post » Sun Dec 15, 2013 7:29 pm

@LennardF1989

Did you somehow miss Ashley's response? The SDK is perhaps your best bet.zenox982013-12-15 19:30:06
If your vision so exceeds your ability, then look to something closer.
Moderator
B
120
S
28
G
68
Posts: 4,849
Reputation: 48,299

Post » Sun Dec 15, 2013 7:33 pm

[QUOTE=zenox98] @LennardF1989

Did you somehow miss Ashley's response? The SDK is perhaps your best bet.[/QUOTE] 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.LennardF19892013-12-15 19:39:47
B
4
Posts: 6
Reputation: 210

Post » Wed Feb 05, 2014 1:19 pm

[QUOTE=LennardF1989] [QUOTE=zenox98] @LennardF1989

Did you somehow miss Ashley's response? The SDK is perhaps your best bet.[/QUOTE] 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.[/QUOTE]

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)
B
35
S
8
G
8
Posts: 532
Reputation: 6,868

Post » Wed Feb 05, 2014 1:38 pm

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.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,600

Post » Fri Jun 05, 2015 2:55 pm

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.
B
10
S
2
Posts: 36
Reputation: 686

Post » Sat Jun 06, 2015 12:17 am

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.
B
10
S
2
Posts: 36
Reputation: 686

Next

Return to Javascript SDK

Who is online

Users browsing this forum: No registered users and 0 guests