Questions tagged [gdscript]
GDScript is a high-level, progressively typed programming language designed to work with the Godot Engine. It uses a syntax similar to Python (blocks are indent-based and many keywords are similar).
171 questions
0
votes
1
answer
70
views
Decelerating player's momentum without changing direction
I'm adding deceleration to my player character, decreasing their velocity over time when the player releases the direction keys.
With the code below, at non-perfect angles, the character seems to re-...
0
votes
1
answer
40
views
Godot Multiplayer Player Doesn't Spawn
Godot Version
4.5 Stable
I'm trying to create a multiplayer game. Since this is my first multiplayer game I started with a simple LAN setup.
How it is supposed to work:
When ...
0
votes
1
answer
189
views
Can I reference resource UIDs in save files
In Godot 4.5 beta 6, I have a drag-and-drop situation where the data being moved between nodes is stored using instances of a custom resource.
The resource instance is added to a property called ...
1
vote
1
answer
308
views
Overriding property setter
In Godot 4.5 beta 5, I am trying to override the text setter on a Label node. Following the documentation, I did:
...
0
votes
0
answers
64
views
Instantiated child scene does not rotate with the parent as pivot
Version 4.4
I am starting to learn Godot by creating a game in which my ‘Player’ scene is instantiating and adding a ‘Ball’ scene as its child on starting the game. I position the Ball at a distance ...
0
votes
0
answers
67
views
What am I missing to get my animation working
I use Godot 4.4 and gdscript. I have a 2D isometric character with hundreds of sprite sheets for different angles and weapon status. Its not feasible to do this in ...
3
votes
1
answer
210
views
Arc Slot Layout and Card Display Overlap
I'm struggling with a persistent problem in my Godot 4.4.1 project involving "power slots" arranged around a table or arena background. No matter how I structure my nodes and update my code, ...
0
votes
1
answer
170
views
Godot 4 chip-8 emulator not displaying font correctly
I'm making an emulator for the chip-8 using the Godot 4.3 game engine, It's almost complete and you can play pong on it perfectly fine, But it can't display numbers from the built in font.
Each ...
2
votes
1
answer
420
views
Is await/free in gdscript a potential memory leak?
Consider a situation where a coroutine in node A awaits a signal from node B. If node B gets freed without sending the signal, obviously the coroutine in node A will never finish executing. Does it ...
5
votes
2
answers
666
views
How do I make my chip-8 emulator update at the intended rate?
I'm making an emulator/interpreter for an old console called the CHIP-8 In Godot 4.3 stable. It's going really good so far, I basically just load an external ROM into a virtual RAM (a ...
0
votes
1
answer
159
views
How to control the order of _input_event and _input?
Suppose I have these two classes
...
0
votes
3
answers
575
views
What is the difference between only extends, class_name before extends, and class_name after extends?
I am having trouble understanding the syntax in GDScript, specifically the use of class_name and extends.
I often come across ...
0
votes
0
answers
73
views
Increasing final image scaling with shaders on top to 125%?
When I apply the canvas_item barrel distortion shader to my viewport, there is a noticeable loss of resolution in the center of the screen. Therefore, is it possible to scale the final image + fisheye ...
0
votes
1
answer
140
views
Logic problem for respawn player in godot
I am new to game development and Godot. The code is gathered from multiple tutorials and now i am stuck. It almost seems to work but my problem is the respawn mechanism. Maybe someone can have a look ...
0
votes
1
answer
783
views
How to fix "Identifier not declared in the current scope" error?
When I try to run the following code in Godot, I get the error:
Line 45:Identifier "delta" not declared in the current scope.
I don't know what this means or what I should do about it.
<...
1
vote
1
answer
166
views
How do I make these nested match statements easier to read?
Still coding that awesome Turn based RPG.
I'm currently coding the logic for firstly selecting the attack then selecting the enemy (Or enemies)
...
1
vote
0
answers
124
views
How to list all cached resources?
In Godot 4.3, is there a way to list all cached resources, and their resource_path values? These may be loaded from disk or may belong to packed scenes (which would ...
0
votes
1
answer
200
views
How to use tweens to spin a wheel clockwise in Godot Engine?
How can I spin a roulette wheel in a clockwise direction using a tween?
I've successfully managed to rotate counter-clockwise to the exact segment, but changing the direction to go clockwise is still ...
0
votes
1
answer
232
views
Lerp() issues: cannot convert argument from int to float
I am using Godot 4.3, it is giving me this error and when I change 0 to 0.0, the character stops moving. If I change the last parameter to an integer also it still shoots an error:
...
0
votes
0
answers
152
views
Momentum on a Kinematic Character Controller Does Not Work with Jolt 3D
After a long time, I’ve finally figured out how to add momentum to my Kinematic Character Controller in Godot 4.
Before: https://youtu.be/sPl-uA7OZ0Y
After: https://youtu.be/JvywZp5sQc8
In other words,...
0
votes
1
answer
230
views
Coding a customizable JRPG random action system in Godot 4? [duplicate]
I'm making an open source turn based JRPG in Godot 4.3, I want any programmer to be able to very easily create new enemies with different behaviors by simply customizing export variables in the editor,...
1
vote
0
answers
409
views
Return null or string in gdscript
I want a function that can return something, or not, in gdscript
func test() -> String | null:
return null if random() > 0.5 else "hi"
The syntax ...
1
vote
3
answers
234
views
How to make a derived value setter in godot editor without @tool?
I have some platformer code to make my character jump based on height. I'd like to be able to tune it in the editor using both world units or number of tiles. I can do this with setters:
...
0
votes
1
answer
138
views
How to add water material below sea level in procedural terrain?
I'm trying to create procedurally generated terrain, it works but it just uses simple textures. The lower area below sea level I want to add a water material instead of a simple texture. How can I ...
2
votes
1
answer
92
views
Hard dropping blocks isn't instant and doesn't put it in the correct spot
Godot Version: v4.3.stable.official [77dcf97d8]
I'm trying to add the ability for blocks (frozen RigidBody2Ds) to be hard-dropped instantly (they get placed on the closest surface directly below them) ...
0
votes
1
answer
99
views
Custom signal does not work in pause menu
I have the following pause menu script:
...
0
votes
1
answer
90
views
A problem with PathFollow3D and camera
When the character follows the path, the camera stays still despite being a child node of the character.
The hierarchy and the PathFollow3D script:
...
0
votes
1
answer
92
views
CharacterBody2D knockback not being applied in the correct direction
I'm having a problem with CharacterBody2D knockback in Godot 4.3 stable.
I'm creating a game where enemies (CharacterBody2D) can ...
0
votes
0
answers
874
views
How can I perform hot reload in Godot?
In the documentation for versions 3.5 and 4.3, it mentions that hot reloading is possible:
3.5: https://docs.godotengine.org/en/3.5/getting_started/introduction/godot_design_philosophy.html
4.3: https:...
1
vote
0
answers
66
views
"Node not found" when using Third Person Controller plugin in Godot
I'm trying to add a 3rd person plugin for Godot 4.2. It's my first game using Godot so I'm fairly new to it. I'm guessing I'm just doing something wrong.
I'm trying to use this Third Person Controller ...
0
votes
1
answer
164
views
Rotating Projectile in Godot engine
I have this projectile code in Godot:
...
2
votes
1
answer
81
views
Escape Block Textures Not Loading After Leaving First Room
Godot Version: v4.2.stable.official [46dc27791]
I am trying to have an escape block with a TextureRect that has two different textures--an animated one where it's ...
0
votes
0
answers
84
views
Walking through a portal attached to a wall
I have created portals that work perfectly fine. I walk into one and come out the other side seamlessly. The problem I am having, though, is when the portal is up against a wall my player (A ...
0
votes
2
answers
170
views
How to synchronize NPCs across LAN?
As of now, players are synced using:
...
1
vote
0
answers
96
views
Do doc-strings affect performance in GDScript?
Apparently in Python, doc-strings do slow down programs, at least that's what I've been reading in other questions... but what about GDScript? Should I just use # instead?
1
vote
0
answers
102
views
Game published for web freezes for 2-3 seconds the first time an explosion effect triggers
Using Godot 4.2.1
when exporting my game to HTML5 it runs completely fine until an explosion effect is spawned on screen for the first time when killing a mob, the game freezes for an entire 2-3 ...
0
votes
1
answer
132
views
Godot on signal trigger external animation
It may not matter, but I'm following How to make a Video Game - Godot Beginner Tutorial. I want to implement the dying animation instead of removing CollisionShape2D from the body (parameter passed to ...
2
votes
1
answer
149
views
Theme lookup in Godot 4.2
Trying to understand how theme lookup works in Godot 4.2. Suppose a Control node script has the following two lines in it:
...
0
votes
1
answer
1k
views
adding a knockback effect to a CharacterBody2D in Godot 4.2.1?
i was following a tutorial series on YouTube on creating a Zelda clone in Godot 4.2.1 and everything works fine, but the tutorial never implements a knock-back effect when attacking an enemy so i ...
0
votes
1
answer
87
views
Movement continues for diagonal movement after releasing one key
For example, if I press W key and D key, that would produce a movement in the Northeast position. However, if I release either key (meaning I am holding only W or D at the moment), the movement still ...
0
votes
2
answers
226
views
FP Movement along the wall makes the character move faster and glitches out a little
First Person Movement along the wall makes the character move faster and glitches out a little.
The problem is pretty much visible here:
https://youtu.be/_1dDdCSwVEo
Source:
https://github.com/...
0
votes
0
answers
216
views
How to efficiently path many objects to a moving point?
Working in 3D in the Godot engine, I have an object that moves through space and, like a tornado, is intended to pick up objects in its path.
What I have right now is janky, effectively re-baking the ...
1
vote
2
answers
715
views
Efficient storing of tabular user generated data in Godot
Over the course of the game, the user generates a lot of very simple data. And array of strings (single letters), timestamps (int) and a boolean array, all equal in size. The length of this "save ...
1
vote
2
answers
1k
views
Disable all Player input in Godot 3?
I'm making an "Asteroids" clone in Godot 3.2.3
the way that the Bullet is spawned in-front of the Player ship is simple : the main game node will find the Player node's position and rotation ...
1
vote
0
answers
207
views
How to use await with GDExtension-wrapped external library functions?
I am looking at wrapping functionality from an external C++ library with GDExtension for use with Godot 4. Many of these functions have an appreciable runtime before they return the values of interest,...
1
vote
1
answer
188
views
remaking Pong in Godot but the opponent AI cannot locate the ball's coordinate correctly
I'm following a detailed YouTube tutorial on remaking Pong in Godot 3.0 but I have ran into an issue regarding the way the AI opponent reacts to the incoming ball, what's happening is that the ...
3
votes
2
answers
3k
views
I've hit the limit of what ChatGPT can teach me about game development in GDScript — what strategies can I use to keep making progress? [closed]
I felt like I had gained a decent grasp on core coding concepts (variables, if statements, loops) and I familiarized myself with Godot, so I wanted to start making small games to learn more by ...
1
vote
1
answer
139
views
Issue with AttackArea Monitoring Before Attack in Godot 2D Game
I'm developing a 2D game where the player character can attack enemies using a designated attack area (Area2D node named AttackArea). I've encountered a problem where the AttackArea is active and ...
0
votes
1
answer
318
views
Sort an array of Node3Ds by distance with closest first
I am working on kart racing game. I have created a series of respawn points (Node3Ds) for when a player falls off of the track. Currently, I am trying to get the closest respawn point to the player ...
0
votes
2
answers
103
views
How do I save data for multiple things sharing the same script?
I have level 0 rusted sword, then I upgrade it and save my game.
I implemented my save system by following Godot tutorials. But with this approach, after exiting and re-launching the game, all rusted ...