Error when following a tutorial

Hello! I’m following this tutorial:

https://gamedevacademy-org.translate.goog/defold-tutorial/

But I’m getting the following error:

Without a piece of code, it works:

I would like to understand the reason for the error.

Thank you very much!

This is the complete code:

Please share code as text, not as images. It is much easier for anyone trying to help to mark text and suggesting solutions. You can surround code with three back-ticks to get syntax highlighting etc here on the forum.

2 Likes

The problem is that increase_text must be defined before it is used. Move the function above on_input.

1 Like

The tutorial missed that local variables need to be defined before they are used.

1 Like

I’ve sent Zenva an email pointing out the mistake. It should hopefully be fixed soon.

2 Likes

The change worked perfectly. Thank you very much for the explanation!

Just an observation. I imagined that the tutorial would teach how to detect clicks on the object, but it detects it on the entire screen. So I’ll look for the next tutorial.

If you wish to detect a click on a gui node (ie something that can be used to create a button) then please have a look at this example:

Overall manual on the GUI component:

1 Like

Thanks! I did a lot of research on how to detect a click on an object (without using a gui) and realized that it’s not trivial for a beginner. But I will study.

1 Like

Hey Zenva founder here, thanks for reporting this issue! We have now fixed the tutorial and project files.

4 Likes