0 votes

I'm Stuck please help.

I need the main function of the Game and i don't know how to do that.
I watched many tutorials tried many things, but i can't do it.
I need a Touch function. with that function i want to controll the score,time and level up.
I can't go forway on my Game without that function.
Please explain as simple as possible my English is not the best :/ with script if possible :/

in Engine by (136 points)

Have you looked at the official documentation? Try to find the documentation in a language you can fully understand. Look on the documentation page here. Scroll down to the "Translations" section on the right side of the page to find a suitable language. Then learn about how scenes are setup to function (the article "Scenes and nodes" describes this). After reading that article, read the articles on scripting (the English articles are here and here).

Hello and sorry i'm really bad at telling my problems.

func process(delta: float) -> void:
if Input.is
Score += 1
$ScoreCount.text = str(Score)

(this is the script from the Player Scene, The Player is loaded to the Main Scene) but i can't connect this to the Main Scene where The ScoreCount is.
Is it not possible to connect a Signal or Input from 1 Scene to another?. I tried to connect a Texturebutton before but it wouldn't let me connect either. So i thought i try it out with Touch input. i hope you can understand my problem.

1 Answer

+1 vote

Hi, Yes, you can connect from one Scene to another. There are many ways to do that.

In your case, it might be useful to do this with a signal. This means when you get a ui_touch event you can do your local processing to update the Score and then Emit a ScoreUpdated signal which you can connect to a function in Main Scene to update the score.

More details on signals here

Another way to do that is to have your Player scene reach out and update the Main scene using a nodepath. To do that, Player needs to know the nodepath to reach Main. You can read up about nodepaths in the docs. These can be fragile if you change the design of your node tree, so be careful when designing this :-)

There is an end to end example of that approach here or another one here

by (495 points)

I struggle so so hard man please help,

So i have 4 Players Scenes.
One of them is loaded randomly in the Main Scene.
How do i make that when the Player (RigidBody2D,CollisionShape2D,Sprite) is clicked or touched (i have created "uitouch" input) that the Score gets + 1 (on the Main Script).
signal my
signal,emit_signal(), i have no idea how to use them.
I tried, of course, but failed very hard.

maybe i can change the Sprite with a TextureButton if its easier.

:/ Lost

Hi Rayu. I don't have a touch device where I can try this, however this question seems to have a working solution for triggering an action when something is touched

In your project, have you confirmed that your touch event is actually being called? i mean, is your problem only getting that touch event from the Player script to your Main script?

Or are you not even getting a touch event?

Thank you for your effort,

I've found this tutorial on YT


i searched before but somehow didn't find that. 2 days later YT recommended it to me

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.