Navigation

    Fuze Arena Logo
    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Popular
    • Users
    • Groups
    • Help
    • Discord

    setSpriteScale / getSpriteSize - negative values, is this correct?

    Bug Reporting (FUZE 4 Nintendo Switch)
    2
    2
    144
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • pobtastic
      pobtastic F last edited by

      I'm not convinced this is a bug, as I can see that it could also be useful too? So maybe it's just a request to alter the documentation (and discussion about it?)

      Consider the following code;

      sprite_sheet = loadImage( "Ansimuz/GothicCemeterySkeleton", false )
      sprite = [
        createSprite(),
        createSprite()
      ]
      
      for i = 0 to len( sprite ) loop
        setSpriteImage( sprite[i], sprite_sheet, 21 )
        lastpos = { gWidth() / ( i + 1.5 ), gHeight() / 2 }
        setSpriteLocation( sprite[i], lastpos )
      repeat
      
      setSpriteScale( sprite[0], { 8, 8 } )
      setSpriteScale( sprite[1], { -8, 8 } )
      
      loop
        for i = 0 to len( sprite ) loop
          size = getSpriteSize( sprite[i] )
          printAt( 0, i, "Size ", i, ": ", size )
        repeat
        updateSprites()
        drawSprites()
        update()
      repeat
      

      The output is that size 0 width is 352 but size 1 width is -352. Now ... that's not completely unexpected I guess - but when you're working out the beginning and end of a lerp() say, and one that goes one sprite image offscreen (to give the illusion of "leaving") when it's negative it then needs fudging depending on which side of the screen I'm drawing on. I mean ... the width of a sprite is the width of a sprite, it shouldn't really matter if I'm drawing it back-to-front or not?

      1 Reply Last reply Reply Quote 3
      • Martin
        Martin Fuze Team last edited by Martin

        My understanding is that it is entirely ententional to permit negative values for sprite scale as that's how sprite flipping is done in Fuze, but I'm as surprised as you that sprite width is returning negative because like you say, the width is the width whether it's flipped or not!

        I'm going to raise a bug report for this, scale shouldn't have anything to do with width from a negative / positive point of view...

        1 Reply Last reply Reply Quote 2
        • First post
          Last post