Sprite cropped size

0 favourites
  • 6 posts
From the Asset Store
220 Food Sprites in 16x16 pixel size. Perfect for items for a retro style game.
  • Hi,

    How do i get a sprite frame's cropped size? I know I can get the object size (.Width) and the original sprite size (.ImageWidth), but I need to get the real, current frame's width after it's been cropped in the editor.

    (In case you're wondering why, I'm using it for a variable spacing bitmap font. Should be really easy if there's a way to get that value per frame).



  • It would be ".ImageWidth" since cropping changes the image.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Yes, but ".ImageWidth" seems to only return the width of the first animation frame. I need it to return the width of an arbitrary frame within the animation, or even the last frame used.

    I'm assuming it can't be done, unless someone writes a plugin :-(


  • System: on start of layout
      Local number curFrame = 0
      -> System curFrame = Sprite.AnimationFrame
      -> Sprite: set frame to 4
      -> Text: set text to Sprite.ImageWidth
      -> Sprite: set frame to curFrame

    Doesn't work?

  • every tick > .imageWidth didn't worked?

  • I don't have my computer around right now, but maybe the issue is that I'm not updating every tick? The sprite objects containing the characters are created at the start of layout only, for performance reasons.

    I'll try what Telles0808 suggested and update it on every tick... but I really think it shouldn't matter, you should always get the post-cropped size using .ImageWidth regardless of when.



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