Basic Help to Start Out

I can’t seem to get basic things working.
Finding:

  • Mouse Position
  • Mouse Input
  • Any Input

Is there a way to pick up the mouse coordinates, or is my only option to record that position in on_input?

Input binding doesn’t do anything. My on_input functions do not ever get called when I click, or press keys.

  • on_input functions do not trigger
  • clicking on rotated sprites accurately (tested in project example, the engine ignores rotation on object.)

I can do all of this in other game engines from the get-go aside from the clicking on rotated sprites.

Don’t forget to:

msg.post(“.”, “acquire_input_focus”)

in your mainscript to get the inputs going :slight_smile:

Did you read the manual on how input works in Defold? To summarize:

  1. Define your input bindings (defaults to the ones in file input/game.input_binding)
  2. Acquire input focus to receive input in a script using msg.post(".", "acquire_input_focus")
  3. Get input events in on_input() function

Note: To get mouse position updates you must define an input binding for left mouse button (yes, strange, I know)

2 Likes