Questions tagged [godot]
Godot is a 2D and 3D open source game engine developed by Godot Engine community. It features a built-in development environment which runs on Windows, OS X and Linux and can create games targeting PC, mobile and web platforms.
godot
2,132
questions
23
votes
3
answers
8k
views
Godot: what are .import files, and should you commit them to git?
In Godot, when you import images and other assets into the editor, there's an additional <filename>.import file created.
What are those .import file used for? Should you commit them to your ...
19
votes
2
answers
6k
views
How to write Tests in Godot engine
Soo I'm developing a game with the Godot engine and I want to create some test for the code to be sure that everything is working, I can't test the game with simple actions it takes 5-10 minutes. Is ...
15
votes
11
answers
28k
views
Android : App not installed
Newbie here.....I made my first game with Godot game engine and exported to android successfully.....copied to my phone, it installs and runs fine. After a couple of hours, I made some changes and ...
15
votes
1
answer
25k
views
How do I implement structures in GDScript?
Is there an equivalent of a C# structure/class in GDScript?
E.g.
struct Player
{
string Name;
int Level;
}
15
votes
2
answers
14k
views
Can Godot and GDScript store functions in variables?
I am confused by part of the Godot Docs for the GDScript language. About midway down the page, in the "Referencing Functions" section, it says you can't store functions in variables, and then seems to ...
15
votes
1
answer
2k
views
How do I adapt AStar in Godot to platformers?
I've been looking for a robust method of pathfinding for a platformer based game I'm developing and A* looks like it's the best method available. I noticed there is a demo for the AStar implementation ...
14
votes
7
answers
17k
views
Godot Keyboard Events
I am studying the Godot Engine and GDScript and I searched on the internet about keyboard events, but I didn't understand. Is there something in Godot like: on_key_down("keycode")?
12
votes
8
answers
30k
views
Godot 3d get Forward Vector
I was wondering if there was a way to get the forward vector of a spatial node in godot 3d.
In unity this would simply be transform.forward.
Godot gives me a rotational vector but im not sure how to ...
11
votes
2
answers
25k
views
How do I detect collisions in Godot?
I have 3 scenes. one that is named "KinematicBody2D.tscn" which a KinematicBody2D node. this scene is a player which moves from left to right across the screen. I also have a scene named &...
11
votes
1
answer
10k
views
Godot 3.2.1. Can't change this state while flushing queries. Use call_deferred() or set_deferred() to change monitoring state instead
In my 2D game player has the ability to destroy crates, objects with two collision shapes. When destroyed, crate spawn items that also have collision shapes. But when the following function called ...
11
votes
2
answers
18k
views
Godot how to center text on label?
I just made a new Godot project and created a Label with text. Even with Align: center the text stays top left when I run the game.
Label.tscn
[gd_scene format=2]
[node name="Label" type="Label" ...
10
votes
1
answer
7k
views
Godot listening to signals from multiple instances of the same scene
I have the following Scenes:
Player
Enemy
Attack
When an Attack collides with the Enemy, the Enemy emits a "onHit" signal.
The Player listens for that signal and bounces back.
This is all ...
10
votes
1
answer
44k
views
How do I detect collision in Godot?
I'm making a game in Godot and I can't figure out what code I can use for a Death Plane (an area where an entity passes through and it de-spawns or dies).
10
votes
2
answers
18k
views
How to make image fit screen in Godot
I am new in godot engine and I am trying to make mobile game (portrait mode only). I would like to make background image fit screen size. How do I do that? Do i have to import images with specific ...
10
votes
2
answers
10k
views
How to load textures from a spritesheet in Godot 3
I've just got started with Godot yesterday, and I'm starting a game. I drew a few spritesheets for it. It seems much more efficient to pack all of the frames of an animation into a single image file, ...
9
votes
2
answers
8k
views
How do I get which Control node currently has focus?
I'm trying to determine which Control node has just changed focus. Another Control node has been set up for using focus by changing the focus mode on the node to All. From within that node's script, I ...
9
votes
3
answers
4k
views
How to convert global enum values to string in Godot?
The "GlobalScope" class defines many fundamental enums like the Error enum.
I'm trying to produce meaningful logs when an error occurs. However printing a value of type Error only prints the integer, ...
8
votes
5
answers
9k
views
How can I pause a Thread for some seconds in Godot?
How can I pause execution for a certain amount of time in Godot?
I can't really find a clear answer.
8
votes
1
answer
8k
views
Using a custom class in Godot
I have a simple network chat program created in Godot that I am using to teach basic encryption to high school students with. I would like to add a custom built encryption class to allow students to ...
8
votes
1
answer
1k
views
Godot java.lang.IllegalStateException: Service without Chimera impl
I'm published a game made with Godot 3.5.2
But Play Console report that there is an error relate to stack call java.lang.IllegalStateException: Service without Chimera impl
Error happen on motorola ...
7
votes
1
answer
5k
views
Why do some nodes use "position" and others use "rect_position"?
What's the technical reason for this? It seems strange to me that they can't all just use position. Is it a legacy thing?
7
votes
2
answers
7k
views
using different programming language in godot game engine?
I want to bind a different programming language to the Godot game engine. Is there an instructional document or video on this topic? For example, how was this project done: godot-rust. If I can learn ...
7
votes
1
answer
19k
views
How do I change sprites in scripts?
I'm trying to make a dating sim as a easy first game programming-wise. I don't know how to change the character sprites inside the scripts.
character_sprite.gd
extends Sprite
var char_tex = load("...
7
votes
1
answer
1k
views
Generating country-shaped geometry on the surface of a sphere in Godot
I am currently working on a game in Godot which involves rendering countries on a globe. I have very little prior experience with Godot, but have experimented with it in the past.
I am using this ...
7
votes
0
answers
977
views
Godot Engine published app gets security alert after adding AdMob
I recently released a simple game made with Godot Engine and after adding the Google AdMob library to display ads, I get this security alert :
Your app contains URL credentials, which is often ...
6
votes
2
answers
5k
views
How do I setup the esc key to exit Godot Application?
I have a question about something I'm getting stuck on with a new 2D project. I added a sprite background and it shows no problem when I run the test. I setup the esc key as "key_exit" in the Input ...
6
votes
1
answer
4k
views
GDScript. How to make your own library in Godot and access it from your game scripts
I wonder how can I create a script, which contains methods I want to use in multiple scripts. I don't think I want to create a global singleton for it, because I am not storing any global data which ...
6
votes
1
answer
6k
views
Godot - How do I create a subarray of a list in Gdscript?
I know it's possible to slice an array in python by array[2:4]. The way I get around this is to just loop through the indexes I want and append them to the new_list. This way requires more work is ...
6
votes
1
answer
6k
views
How to convert a string to enum in Godot?
Using Godot 3.4, I have an enum setup as:
enum {
STRENGTH, DEXTERITY, CONSTITUTION, INTELLIGENCE, WISDOM, CHARISMA
}
And I would like to be able to make the string "STRENGTH" return the ...
6
votes
1
answer
6k
views
Godot cannot export to android Could not find keystore, unable to export, how to fix?
Keystore create by the docs of godot. Video of export video if erase all still this error. Windows 10, Godot stable 3.3.2, default version
6
votes
2
answers
929
views
More ideas of how to prevent slope slide down with KinematicBody2D?
I have a basic code below. I am trying that the player not slide down on slopes. My slopes now are 45°. If the player stop movement on slope, it will slide down (maybe because velocity.y += delta * ...
6
votes
1
answer
5k
views
Godot engine collision with KinematicBody doesn't work
I was fiddling around with the Godot engine and tried a little game.
But I can't seem to get an info on colliding.
if is_colliding():
print ("Collision with " + get_collider())
get_node("...
6
votes
2
answers
351
views
How to make user-controls in Godot automatically show their children inside an intenal container of my choice?
Consider a control that behaves as a decorator to user provided controls, like a window frame. I want my control to have all the common logic of the window (title bar, draggable window borders, ...
6
votes
0
answers
2k
views
AttributeError: 'SConsEnvironment' object has no attribute 'android_add_dependency'
I'm trying to compile godot with this module: admob
https://github.com/kloder-games/godot-admob
But I have this error when I compile:
scons platform=android target=release android_arch=arm64v8
...
5
votes
1
answer
9k
views
Error The following features required to run Godot projects on the Web are missing: Cross Origin Isolation, SharedArrayBuffer
I exported the godot project to HTML5 and after uploading to itch.io I got the error Error The following features required to run Godot projects on the Web are missing: Cross Origin Isolation - Check ...
5
votes
2
answers
6k
views
How to call a variable from a preload script in godot?
When I make a preload script in godot and put a variable in there, how do I call the variable in my other scripts?
Is there a special way to call the variable that I don't know or is there a better ...
5
votes
1
answer
9k
views
Unexpected "Identifier" in class body error when using export in Godot 4.0.2
I'm currently working on a project in Godot 4.0.2 and I'm having trouble using the export keyword in my scripts. Every time I try to use it, I get an "Unexpected 'Identifier' in class body" ...
5
votes
5
answers
6k
views
Using C# async delays in Godot
I am currently experimenting with Godot C# making a basic shooter and for the gun's fire rate I have been experimenting with different delay systems. Node Timers work although I'm trying to make the ...
5
votes
2
answers
8k
views
Godot make item follow mouse
I am making a 2D platformer in Godot 3.0 and I want to have the player throw/shoot items using the mouse to aim (similar to bows and guns in Terraria). How would I go about doing this? I am using ...
5
votes
1
answer
902
views
Sync to physics change in godot 4
I am in the process of converting my game from godot 3 to godot 4.
Previously in godot 3 when I was using rotating platforms, my player would sink a few pixels into the rotating platforms while they ...
5
votes
1
answer
1k
views
Downloaded glb 3D model cut in half
I have this assignment that requires me to use some 3d model assets from the internet. I'm very new to this course. So, I tried to use car asset from https://www.cgtrader.com/items/2518230/download-...
5
votes
1
answer
2k
views
(Godot Engine) Merging more than two polygons using Geometry's merge_polygons_2d() Method
Considering the following scenario: given an n number of Polygon2D nodes that act like "shadows" (black color with halved alpha value), how to combine all of them into an single Polygon2D ...
5
votes
1
answer
1k
views
Why is Pygame so much slower than 2d game engines?
I am a godot user and a Python user. In pygame, in a simple game like pong, I had an average of 55-60 FPS in fullscreen. In addition, when ported to Kivy, I had an average FPS of 60-70FPS. But when I ...
5
votes
1
answer
7k
views
Godot - making labels on demand, and setting their font size with GDscript
Not to over explain, I basically need to create an unknown number of Labels, with unknown text. All fine and dandy - works.
I can't seem to find how to change their font size though.
Here's what I ...
5
votes
1
answer
6k
views
Don't know how to reference other scene into script
I can't link SliceAndCoagulatorScene to the script to set its visible to false I've tried get_node, $res://...
extends Node2D
onready var main_scene = get_node(".")
onready var ...
5
votes
0
answers
151
views
Error message: > Could not create service of type FileHasher using BuildSessionServices.createFileHasher(). > java.io.FileNotFoundException
I've been trying to export my Godot app to a .aab to upload to the play store. I've successfully exported the first version of this, but exporting the second version after some edits to the code ...
5
votes
1
answer
2k
views
How to use Neovim as External editor for Godot (Godot executable permissions)
I am trying to configure Godot to use launch Neovim in iTerm2 when I double click on a file containing code in the editor, however, a terminal window pops up instead with the following error:
/Users/...
4
votes
5
answers
44k
views
How do I create a timer in Godot?
How do I create a timer in Godot which destroys the script's object after a given amount of time? I am looking to remove bullets from a game after a while to reduce lag.
4
votes
2
answers
5k
views
How do I loop an animation in a Godot animation player?
I'm trying to loop an idle animation that I have in an AnimationPlayer, but it keeps on only playing once. Is there any way for me to make it loop?
4
votes
1
answer
5k
views
When should I use a KinematicBody or a RigidBody for 2D platformer characters?
Which Physics body would be the best for, let's say the player character, enemy and collectibles. StaticBodies are quite different and easy but it is very confusing when we have to choose between a ...