hud.gui_script 466 B

123456789101112131415161718
  1. function init(self)
  2. self.name_node = gui.get_node("player_name")
  3. end
  4. function final(self)
  5. end
  6. function update(self, dt)
  7. end
  8. function on_message(self, message_id, message, sender)
  9. if message_id == hash("update_data") then
  10. local screen_position = message.screen_position
  11. -- Use screen position to set the position of the player name node
  12. screen_position.z = 0 -- "z" should be reset to 0.
  13. gui.set_screen_position(self.name_node, screen_position)
  14. end
  15. end