size.script 728 B

12345678910111213
  1. function init(self)
  2. local rectangle_size = go.get("#stone", "size") -- <1>
  3. local square_size = go.get("square#stone", "size") -- <2>
  4. label.set_text("#info", "" .. rectangle_size.x .. "x" .. rectangle_size.y) -- <3>
  5. label.set_text("square#info", "" .. square_size.x .. "x" .. square_size.y) -- <4>
  6. end
  7. --[[
  8. 1. Read the size of the sprite with id `stone` on the same game object as this script (the game object with id `rectangle`).
  9. 2. Read the size of the sprite with id `stone` on the game object with id `square`.
  10. 3. Set the text of the label with id `info` on the same game object as this script (the game object with id `rectangle`).
  11. 4. Set the text of the label with id `info` on the game object with id `square`.
  12. --]]