- Select manual -

Pointer over

A GUI box node with an image texture and a script that react when pointer over this node.


The “gui” game object contains a GUI component stored in the file pointer_over.gui. The GUI contains the setup with the “button” box node for the button image and the “text” text node for the button label text.

pointer_over.gui has a script attached to it, called pointer_over.gui_script, which contains the button logic.

button gui


function init(self)
  msg.post(".", "acquire_input_focus") 
  self.button = gui.get_node("button") 
  self.text = gui.get_node("text") 
  self.is_over = false 

function on_input(self, action_id, action)
  if action_id == nil then --<5>
    if gui.pick_node(self.button, action.x, action.y) then 
      if not self.is_over then
        gui.set_text(self.text, "HELLO!") 
        self.is_over = true
      if self.is_over then
        gui.set_text(self.text, "BUTTON") 
        self.is_over = false
  1. Tell the engine that this game object wants to receive input.
  2. Get the instance for the node named “button” (the button box).
  3. Get the instance for the node named “text” (the button label).
  4. Trigger for locking multiple execution.
  5. If action_id equal nil (pointer is moving)
  6. Check if the pointer position (action.x and action.y) is within the boundaries of the button node.
  7. Change the label text in pointer over case.
  8. Change the label text to default value.

