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
476
views
How should bullet reflections be implemented?
I'm working on a tank game where bullets are reflected off of walls. The formula for a reflection is:
$$
r=d−2d⋅n∥n∥2n
$$
where \$d\$ is the incoming vector and \$n\$ is the normal of a wall.
My ...
1
vote
1
answer
112
views
Drawing a line between 2 vectors
I was trying to implement a simple mechanic by drawing a line between the sprite and the mouse, but it's not working that well:
...
1
vote
1
answer
3k
views
Why isnt setting the global_position working?
Previously my items were relative to the player by node hierarchy. But for items like bombs this is not ideal so i tried to add the items to the world scene, but when i try to adjust the position of ...
1
vote
1
answer
3k
views
How should I implement stair climbing?
Im using raycast to detect if a block is to my side. I can use raycast to see if i need to climb stairs but the transition is bad. I immediately reach the top of the stairs when trying to go on them....
2
votes
1
answer
174
views
Vector2 distance_to weird results [closed]
I'm using Vector2.distance_to to get the distance between a MeshInstance and a KinematicBody but the results aren't as expected.
I'm using ...
0
votes
0
answers
89
views
How to play somersault animation during jumping at top point like in Contra games in 2D game (godot, gdscript)?
Here is my jumping code:
...
0
votes
1
answer
2k
views
Getting Parser Error: The identifier "delta" isn't declared in the current scope. in godot
this is the whole code
...
2
votes
0
answers
775
views
Godot 3.2 atlasTexture not creating any texture atlas
When I try to use the new feature of godot that lets you import sprites as an atlasTexture, I dont' get any results.
0
votes
0
answers
1k
views
How to make a 2d game with Ascii art assets
I am new to game development and have been practicing programming games in godot. I am looking to make a minimalist game that uses simple ascii art however I am unsure if I should use UI elements to ...
0
votes
1
answer
829
views
Godot - Get button node in click event not working
How we can get the button reference on the event function that is connected?
My connect signals never works
...
3
votes
1
answer
2k
views
Is it possible to have a script built-in into a custom resource?
Here's a rudimentary custom resource:
extends Resource
export(Resource) var scr
I can drag a pre-made .gd script into this exported property in Inspector, and ...
1
vote
0
answers
92
views
How to get an autotile in Godot 3.1?
I wonder if there's a way to get an autotile just like a single tile using a get_autotile() GDScript function or something like that.
6
votes
1
answer
9k
views
Simple message box in gdscript / godot
I want a single line of code which shows a popup dialog with the words "Hello World!" and an "Ok" button. (I want something simple for now, I know how to make something more complicated but that ...
1
vote
2
answers
958
views
How can I get the NodePath that points to the property, rotation, of the parent node?
The 2nd arg in interpolate_property takes a NodePath, but str of a path to a prop seems fine too. So I'd expect this to work:
<...
0
votes
2
answers
3k
views
Get project's gravity value in Godot
I need to get access project's gravity value which set in Project Settings -> Physics -> 3D -> Gravity, however I couldn't find any related information about this.
How do I get project's gravity ...
3
votes
2
answers
4k
views
How to use Animation Player in Godot like Animated Sprite
So currently I am using the following code to play my sprites (AnimatedSprite Node).
$Sprite.play("Animation Name")
However now I want to use the AnimationPlayer ...
0
votes
1
answer
2k
views
Godot Animation only playing First Frame
I have tried checking if it is already playing, stopping animations before and putting it in a separate function. Whenever I jump it should play 4 Frames of my animated sprite. But it only plays first....
0
votes
0
answers
106
views
In godot, how could I make an explosion not destroy occluded terrain?
This game is in 2D, and is made out of blocks.
Normally, I would simply erase blocks that aren't indestructible and are within range of the explosion. However, if blocks are behind something ...
0
votes
1
answer
16k
views
How do I fix this "identifier is not declared in the current scope" error?
I got this identifier inputevenmousebutton is not declared in the current scope; should I use another identifier?
...
0
votes
1
answer
4k
views
Fixing error(23, 2) Error parsing expression, misplaced: func
When I try to use the GDScript code below, Godot gives me the error:
error(23, 2) Error parsing expression, misplaced: func
Why am I getting this error, and how can I fix it? Is there another input ...
0
votes
2
answers
611
views
Add force to objects while inside area
I'm currently trying to create an area that would somehow push objects to a specific direction. (and also apply angular drag if possible)
I'm currently new to Unity and Godot. I have already seen ...