Multi-Resolution Game Development With GameBuilder Studio Check it out!
NEW Version 0.9.7 has arrived! New Blazing Fast Particle Engine & More Game Actions. Check it out
Why do Renderers react different when reducing their size property?
  • Hi all,

    this is a post (and a question) regarding the general understanding of the renderers/operations. My goal was to shrink an entity until its gone. The different renderers seem (or seemed at first) to act very differently to the "Interpolate Property"-operation I used. I set two operations, one to shrink the spacial x, and in a second one the y, from their current value to 0. I made a little sample file for that operation to a Shape-, a Sprite- and a SpritesheetRenderer:
    image
    https://dl.dropboxusercontent.com/u/48190256/shrinking.zip

    - the ShapeRenderer did what I expected - it shrunk and stod that way.
    - the SpriteRenderer shrunk down, but after the operation was finished, it popped up in same size again without beeing able to be shrunken again.
    - the SpriteSheetRenderer started flickering, like one image being shrunk and one staying in original size popping up several times each second.

    In the last case, I know now that there is an option in every SpriteSheetRenderer called "Override Spatial Size", which was the reason for the flickering. It got two contradicting orders (stay the same and shrink). Unchecking this box will make the SpriteSheetRenderer behave like a SpriteRenderer.
    But I'm still a little puzzled about the Renderer popping up again in full size after the spatial it is bound to has been shrunken to 0. This doesn't happen if the final size of the spatial is >0 (, like 1, 2, 10 or something). I guess contrary to the ShapeRenderer, the SpriteRenderer gets confused if its spatial goes to 0. Of course you can get around that with setting the alpha value of the renderer to 0 or something similar (like destroying the entity if not needed any more).

    Hope that was helpful and maybe someone has an answer to the behavior of the SpriteRenderers popping up again with their spatial at size 0.

  • 3 Comments sorted by
  • @Cavaron this is because you should never have a size of 0 for renderers. To achieve what you want you should be reducing the scale to 0,0. Also you don't need two actions to achieve this. The Interpolate Action will animate the value of a point object. So you can pass the scale property and have it animate to 0,0 by passing a point object in the expression using a helper method called setPoint(0,0).


  • @Lavon thanks, that was helpful. First I tried to use the "Entity.Sprite.Renderer.scaleProperty" pointer without luck (what's that for btw.?), but then I did set the "Entity.Sprite.Renderer.scale" to "setPoint( 0, 0 )" - works fine now. Thx!
  • Ah, you explained the property-thing in another other question, I missed that. I will try to get it in my mind "...propertys" are for references, so no actual number has to be copied to exist in two places blocking memory. Right?

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion