0 votes

I want to Build a car game so I want to make something like the car in the middle and there are two arrows on each side. how can I do that and code that the car that going to be selected is the car you will play with?

NOTE::: for mobile game

Thanks so much.

Godot version 3.4.4
in Engine by (14 points)

No rotation gizmo or color selector?
And nobody presses left/right buttons on mobile anymore its all about the swipes baby.

Who are your target audience?
What have you tried so far?
When will you get car models or sprites?
Where will the rest of your ui be placed if the car is at the center?
How is it designed in 2D or 3D?

I'm making it in another scene.

with a button leads to this scene called "cars"

1 Answer

+2 votes

You need to have a script which stores the selection made. It might be easier to do if you have this script in Autoload (project settings/AutoLoad).

Make a scene which has 2 buttons and sprite or model for the car. Add a script to scene root and connect signals from both buttons into it. The script should react to buttons by changing the car's texture or model. At the same time, it should set the selected car into the first script (the AutoLoaded script).

When your game starts, have the game check whatever was saved in the first script and load the corresponding car.

Sorry if the answer is not too detailed, but the question is too broad to handle in great detail. If you run into specific problems in implementing the system, feel free to make extra questions :)

by (1,098 points)
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 Frequently asked questions and 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 [email protected] with your username.