TrickyWidget's Recent Forum Activity

  • I'm trying to write a behavior that will change the character scale of a sprite font. However, I'm having trouble getting it to work. After digging around in the forum, I came up with this:

    cr.plugins_.Spritefont2.prototype.acts.SetScale.call(this.inst, 0.5);[/code:p5orxfd2]
    That at least doesn't throw any errors, but it also doesn't actually change the scale.
    
    Does anyone know what I'm doing wrong?
    
    Thanks.
  • Not sure I understand. You want to be able to change properties (Size and Position) from a text box?

    Like this:

    [attachment=0:15qx5uax][/attachment:15qx5uax]

    I'm wondering if there's a way to make my behavior's input fancy.

  • Is there a way to do compound properties, like Size and Position are done under Common properties? That is to say, two integer properties that can be set either individually (when expanded) or together in a text?

    Thanks.

  • OK, after talking with the powers that be, it turns out that C2 is smart enough to automatically detect redundant textures and only load them once.

  • Hello again, lunarray . <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile">

    I'm still using LiteTween to great success. Thank you!

    However, I've encountered a bug. When attempting to tween the scale on a sprite font, it gives this error:

    [quote:3s3esi5v]Javascript error!

    TypeError: this.inst.curFrame is undefined

    http://192.168.1.2:50001/lunarray_LiteTween_behavior.js, line 321 (col undefined)

    I'm guessing this might be because scale on sprite fonts is applied only to the text and is independent of the overall size of the instance. So there are two different scales involved.

    For my own use, having one tween value applied to both the text scale and the instance scale would be fine. So far I always want to change both at the same time and at the same scale. However, it would be more robust to have the two different scales available to tween independently. Or if you wanted to go all the way, you could have three scale options for sprite fonts; one for the text, one for the instance, and one that does both. However you see fit. <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile">

    Thanks again!

    Example attached.

  • You could link them manually, using instance UID, and abandon containers. Although the manageability would suffer a bit, you wouldn't have to worry about that duplicate texture problem.

    Thanks for the tip! I thought about trying that, but in this case manageability would suffer quite a lot. There's a whole lot of manipulation of these cards, and the container aspect is used heavily throughout them. The total number of sprites is actually pretty low, so I think I'd rather take a hit on redundant textures than lose container functionality.

  • I'm trying to convert from Texts to Sprite Fonts for performance reasons, and I'm a bit stuck on the differences in how they behave.

    I have a card Sprite, which had seven Texts associated with it (name, stats, etc). I had all of these in a container so that I could easily manage them as a unit.

    However, when using a Sprite Font, the entire font texture appears to be loaded for every individual object. So if I have seven different Sprite Fonts in the container, that's seven copies of the font texture taking up resources. Which is no good.

    The seemingly obvious answer would be to use multiple instances of a single Sprite Font object. But I can't figure out how to make that work properly with containers. If I only have the one Sprite Font object in the container, how will it know which seven instances in particular to select/destroy in association with the rest of the container?

    Thanks!

  • I've got a relatively simple game and I'm trying to optimize its performance on mobile.

    I'm getting pretty decent FPS on both my Android devices. About 50 at rest, down to 30 or so during heavy animation. I can live with that just fine.

    The big problem I'm having is that everything is sluggish in responding to input. I tap a sprite and there's a noticeable lag before it does anything. Sometimes a very long lag. Fairly often, nothing ever happens at all and I have to tap again, possibly several times. This I can't live with.

    I've read all the performance guides and tweaked all the things they say to tweak. WebGL is running. Transparency is trimmed. Sampling is point. Etc, etc.

    The two devices I have to test on are a Samsung Galaxy S III phone (top of the line two years ago) and a LePan II tablet (middle of the road two years ago). I'm using the recommended XDK/Crosswalk method for building my APKs. I'm making heavy use of the LiteTween add-on behavior.

    Unfortunately, due to licensing restrictions with my art, I can't actually post a capx. But debug says I've got 131 objects occupying 19.3 megs of memory. The phone idles around 20% CPU and peaks about 65% (according to cpuutilisation). The tablet is about 10% and 70%.

    I'm primarily aimed at deploying on Android, so this is a really central issue for me. Does anyone have any suggestions?

    Any help would be greatly appreciated. Thanks!

  • I worked out a fairly simple routine for sorting a two-dimensional array by multiple columns (first by D, then by A, etc). It leverages Array.Sort to do the heavy lifting, so it's just a matter of moving the data around to the right places. I couldn't find any examples of this, so I thought I'd share it in case anybody else is searching.

    It looks something like this:

    [attachment=1:1oxs8f6h][/attachment:1oxs8f6h]

    Some caveats:

      Arrange the Sort_Column() calls in reverse order of priority. Array.Sort reverses previous ordering, so you might have to change your "Ascending" or "Descending" to the opposite of what you'd expect, depending on the sorting that happens after that call. Be sure to include the "Ascending" parameter even though it's the default. If you don't, a "Descending" entry from a previous call could be lingering in the Function object which would give the wrong direction.

    I hope this is useful! If you have any questions or improvements, just let me know.

    Example attached!

  • Gah! After all that, it turns out the Nickname addons only work when you already have at least one instance of the tagged objects on the layout. Which isn't at all workable for my scenario. Alas.

    So if anyone else has any thoughts on how to store an object reference in an instance variable, I'd love to hear them!

    Until then, I'm back to my ever-growing lookup table.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • "Action:Create instance into family" is another way to create instance, and it will put the created instance into SOL of this family.

    Thank you for the feedback!

    I just realized that I somehow overlooked the condition in the plugin that does exactly what I need:

    [attachment=0:1vhkb3lg][/attachment:1vhkb3lg]

    Thanks again! Your addons are going to be a real boon to my projects.

  • Whats wrong with this then ?

    The trouble was that Sprite could actually be a great many different objects, so I couldn't reference them collectively that way. However, your proposal got me looking over things again, and I realized that I'd been a total idiot! The nickname plugin offers exactly the condition that I needed:

    [attachment=1:1t4xufkl][/attachment:1t4xufkl]

    Voila! All I needed was to have all possible sprites in a family (which they already were) and then use the nickname picker (that I somehow overlooked like five times yesterday) to select it.

    Thanks so much for your help! This will save me a great deal of effort.

TrickyWidget's avatar

TrickyWidget

Member since 30 Jun, 2014

None one is following TrickyWidget yet!

Trophy Case

  • 10-Year Club
  • Email Verified

Progress

11/44
How to earn trophies