Navigation

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

    Sprite Properties

    Coding
    6
    6
    665
    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.
    • pianofire
      pianofire Fuze Team last edited by pianofire

      In case people hadn't realised sprites have properties. These can be accessed directly without using the getter and setter methods to read/write values.

      So for instance you can do sprite.rotation = angle rather than setSpriteRotation(sprite, angle)

      The full list is shown below:

      x                     horizontal position
      y                     vertical position
      rotation              rotation angle
      xscale                horizontal scale
      yscale                vertical scale
      r                     red colour value
      g                     green colour value
      b                     blue colour value
      a                     alpha colour value
      xorigin               horizontal origin 
      yorigin               vertical origin
      depth                 display depth
      visible               visibility
      x_speed               change in x per update
      y_speed               change in y per update
      rotation_speed        change in rotation per update
      xscale_speed          change in xscale per update
      yscale_speed          change in yscale per update
      r_speed               change in r per update
      g_speed               change in g per update
      b_speed               change in b per update
      a_speed               change in a per update
      anim_speed            animation speed
      anim_frame            animation frame
      show_collision_shape  show or hide collision shape
      

      It is also possible to add you own properties. So for instance you can do:

      sprite.hitpoints = 100

      1 Reply Last reply Reply Quote 20
      • Dave
        Dave Fuze Team last edited by

        This isn't documented and thank you so much for putting that here @pianofire

        I'll make sure to add this information to the sprite tutorial, or perhaps do a separate document for this.

        1 Reply Last reply Reply Quote 4
        • SteveZX81
          SteveZX81 F last edited by

          This is gold! thank you.

          1 Reply Last reply Reply Quote 2
          • A
            AtomAlexander F last edited by

            Must know more how do I use this information?

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

              It just means that instead of having to do

              setSpriteLocation(sprite, x, y)
              

              You can instead just say:

              sprite.x = nnn
              

              Which as you can see means you don't need to specify both if only one has changed.

              That's one example. @pianofire has given the fuill list of properties. The keen-eyed will also notice that there is at least one that does not have an equivalent "setSprite" variant function.

              I'll leave you to work out which one(s) as a learning exercise

              1 Reply Last reply Reply Quote 2
              • M
                MikeDX last edited by MikeDX

                bonus prizes for discovering which values can only be set or read by setsprite() and getsprite() functions and not via their sprite.name property 😊

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