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).

Filter by
Sorted by
Tagged with
0 votes
2 answers
36 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 ...
buzzbuzz20xx's user avatar
1 vote
0 answers
20 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,...
R.M.'s user avatar
  • 141
1 vote
1 answer
87 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 ...
buzzbuzz20xx's user avatar
3 votes
2 answers
2k 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 ...
buzzbuzz20xx's user avatar
0 votes
0 answers
63 views

Enemies not registering hits from the player in Godot

I am making a 2D game where the player can attack enemies using a designated Area2D node as an attack area. I set up signals to manage attack phases and ensure ...
buzzbuzz20xx's user avatar
1 vote
1 answer
59 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 ...
buzzbuzz20xx's user avatar
0 votes
1 answer
74 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 ...
mjbelanic's user avatar
0 votes
2 answers
62 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 ...
Xenophile's user avatar
  • 101
6 votes
4 answers
510 views

In a tile based game, with units that can move a specific amount per turn, how do i make my pathfinding avoid damage unless it is the only valid path?

i am making a 3d tactics game, visually similar to something like final fantasy tactics. it's tile based, with units able to move up and down the level onto buildings and up staircases and what have ...
graveyard's user avatar
0 votes
0 answers
66 views

How to rotate Scene Collection TileSet

I am using a scene in a TileMap node, but I can't seem to be able to rotate it. I tried rotating it in code, but that doesn't work. I also tried rotating it in the editor using the TileMap node. Is it ...
TheJalfireKnight's user avatar
3 votes
1 answer
383 views

Is there a way to instantiate a custom class decided at runtime in GDScript?

Can I instantiate a custom class during runtime through a String without knowing the value of the string when writing the code? Example: ...
Gidan's user avatar
  • 33
0 votes
0 answers
19 views

Duplicated the player scene but only the running animation is not playing

First time asking a question here, so hopefully it goes well! So, I had a player scene set up with a custom state machine, for now handling the idle, run and jump stages, currently set up as nodes: ...
Pantherith's user avatar
0 votes
1 answer
58 views

Can't compare integer variable loaded from save data, but another identical variable works fine

this works: ...
Atsinganoi Dragon's user avatar
1 vote
1 answer
131 views

How to take a screenshot beyond the viewport?

I have a large level design & I'm trying to take a pixel perfect screen shot of a particular area and/or the entire map bound within a region like this: The region can be changed in size and ...
cak3_lover's user avatar
1 vote
1 answer
113 views

Why can't I get the AnimationTree node?

This is my code: ...
shadowxstrike's user avatar
2 votes
1 answer
454 views

Hide Children of Node

I am making a addon for my friends, and I am trying to make a custom node. It works, but I have a problem, the children of the custom node is visible in the scene dock. The ...
TheJalfireKnight's user avatar
2 votes
1 answer
202 views

Setting A Panel texture in GDScript

I am messing around with Godot, and I couldn't seem to find a way to set the texture of a Panel node in Godot. First I tried using the ...
TheJalfireKnight's user avatar
0 votes
0 answers
73 views

Pixel platformer character collides with blocks above while there's still a visible gap

I was trying to the set up a tile map for a 2D pixel art game in Godot 4.1 (following a tutorial) and realized that there seems to be an issue or something I am not aware of with the way collisions ...
JAL's user avatar
  • 1
1 vote
2 answers
496 views

Simple Circuit System

I want to make a simple circuit system in Godot. Here's what I mean by that. (The circuit isn't realistic) I just want a battery object and a ...
TheJalfireKnight's user avatar
1 vote
1 answer
545 views

Actual Custom Nodes in Godot

So I am creating a plugin for Godot 4, and I want to create an actual custom node. What do I mean by that? First to create a custom node I do: ...
TheJalfireKnight's user avatar
1 vote
1 answer
373 views

Area2D only detecting body_exited once

I am new to game development, I am practicing by creating a pong game. I currently have an Area2D set up with a signal listening for ...
zeroparity's user avatar
0 votes
1 answer
252 views

Curves in Godot 4

I'm trying to figure out how to use curves to ease variable values in Godot 4. Ok, I've created a curve like this: @export var test_curve: Curve I set up my curve ...
ThetaJones's user avatar
0 votes
1 answer
130 views

"Springy legs" for a First Person Controller in Godot 4

I'm a total beginner, so I barely know what I'm doing, but here goes: I'm using this First Person Starter template and I would like to add a "springy legs" feature on character landing. The ...
ThetaJones's user avatar
0 votes
1 answer
77 views

How do I determine which pixel is under the cursor when looking at an equirectangular image through a camera?

I am working on a game. The camera is freely rotatable by the user. The background is displayed from an equirectangular image. I need to know which pixel of the background image is located under the ...
Matthew Carson's user avatar
0 votes
1 answer
237 views

How can I change scenes when the player touches another CollisionShape2D in Godot 3.5?

I need to know how I can change scenes in Godot 3.5 when the player touches another CollisionShape2D. I've tried this: ...
shadowxstrike's user avatar
0 votes
1 answer
289 views

Is it possible to do conditional compilation in Godot at this time, via export settings?

In a number of other engines I've worked with, including Unreal and Unity, there's been support for not only preprocessor commands, but conditional compilation based on platform. As an example, in ...
Michael Macha's user avatar
0 votes
1 answer
299 views

Parameter "current->parent" is null, don't see why

I'm using Godot for my current project, and it's been going great; but there's a bug I don't understand. I have a certain very simple script on my title screen: ...
Michael Macha's user avatar
3 votes
1 answer
132 views

How to make a CharacterBody2D slide out of StaticBody2D instead of teleporting?

I am trying to replicate Mario Maker's On/Off switches in Godot 4.1. In my current version, if the player got stuck inside the block after it was toggled on, the player just teleports out it. I know ...
Jason O'Neil's user avatar
0 votes
0 answers
163 views

How do I copy GPU buffers in Godot like in Unity?

How would I convert even a section of the following code, which was taken from this GitHub Source to Godot C# or GDScript? I'm trying to make a Godot version of this project, but I don't know how to ...
Ethan's user avatar
  • 145
2 votes
0 answers
310 views

How to make a callable type safe?

I can write a function like this: func foo(someCallableThatShouldReturnBool: Callable): if someCallableThatShouldReturnBool.call(): # do something ...
Kutub Gandhi's user avatar
1 vote
1 answer
141 views

Scene Doesn't Change After Animation Complete

I'm encountering an issue in Godot 4 with my 2D character where the "Hurt" animation plays correctly when the character's health reaches 0, but the scene does not change as expected. Here's ...
Askani's user avatar
  • 111
1 vote
0 answers
376 views

Dialogue Manager Godot 4 Signals

When using the Dialogue Manager addon on Godot, I am trying to run a function to change the sprite of a character. My function look like this under my character script: ...
TheJalfireKnight's user avatar
3 votes
1 answer
118 views

How can I check if `call`, `callv` failed

In Godot, how can I check whether e.g. Call(...) or Callv(...) succeeded or failed? By failed I mean due to e.g. missing method, ...
geekley's user avatar
  • 133
1 vote
0 answers
95 views

Sprite2D texture repeat switches from Mirror to Disabled when resizing window

In Godot 4, I set the texture repeat of a Sprite2D to 'Mirror', When I run the game, it works fine except when I resize the window — then the texture repeat switches to 'disabled'. Is there a ...
Shahzaib Hassan's user avatar
1 vote
1 answer
316 views

Stay Upright Within Rotating Area

I am making a game that takes place in space and I want you to be able to stay upright in a spaceship even if it rotates. I have this set up: Its a platform and an area that rotates. I have ...
TheJalfireKnight's user avatar
0 votes
1 answer
757 views

How to assign a Resource Array to a variable in Godot 4?

In Godot 3, you could do this: export var (Array, Resource) test_variable I tried to recreate this in Godot 4, but I could not figure out how. This is what I tried:...
TheJalfireKnight's user avatar
3 votes
1 answer
391 views

How to Y-Sort a multi-tile entity as a single tile?

I am trying to use Y-Sorting on a tilemap tree to Y-Sort the whole tree, but it is Y-Sorting each tile of the tree instead of the tree as a whole: I have tried adjusting the Y-Sort Origin but that ...
TheJalfireKnight's user avatar
0 votes
0 answers
145 views

Two CollisionShape2D's Overlapping

I am trying to make a game in Godot 4.1.1 and I encountered a problem. Whenever my player collides with the enemy, their collision shapes overlap and the enemy stays connected to the player. Here's ...
TheJalfireKnight's user avatar
1 vote
1 answer
779 views

_ready(): Node not found: "Pivot/Camera" + player falls through the floor

I'm relatively new to Godot 4.0.3. I have two problems which seem to depend on each other so I put both of them into one single question. I know, these issues have been reported multiple times on ...
EarthAndMoon's user avatar
0 votes
1 answer
47 views

Testing for creating Party Member Scenes continuously - Able to create multiple but after the first is custom type is not determined

For my quick test to see if I can create multiple combatants for my battles, I would like to be able to continuous create party members/enemies in order to get to the correct amount of combatants ...
BoydyBoydy's user avatar
2 votes
2 answers
3k views

How do I create and import a class in GDScript

I would like to create and import a class in GDScript. Here is some non-functional pseudo code to explain what I'm trying to do: ...
Seph Reed's user avatar
  • 235
0 votes
1 answer
61 views

Loading Custom Resources for Test Cases - Copying the main way and loading in tres files with code

I am at the start of testing my game. I have just loaded in GUT and I am attempting to load some resources so that I can see the players stats and validate that they are initialised. Basic assert to ...
BoydyBoydy's user avatar
0 votes
1 answer
73 views

How do i put the enemy in an idle state without breaking everything

very simple logic but my brain is fried for now, so I don't get how to ad the option for an enemy to sometimes just go idle without breaking the entire animation logic... i tried adding a randomized ...
Cei's user avatar
  • 863
1 vote
1 answer
213 views

Fanning cards in 2D leads to cards continuing to move forever

I'm using this video as guide for my Godot 3.5 project, but for some reason the code does fan the card but also the cards keep moving and spreading forever. The code: ...
Progs's user avatar
  • 93
0 votes
1 answer
110 views

How to prevent accidental double-tap dodge when changing directions?

...
Cei's user avatar
  • 863
0 votes
0 answers
47 views

Scared enemies run into walls

I set up a basic pyramid shaped enemy kinematic body that runs away from the player when its health is too low and runs towards the player if the enemy has enough health. The enemy also turns to face ...
Cei's user avatar
  • 863
1 vote
1 answer
222 views

How can I utilise world generation through chunks (to reduce lag)

I've been working on a 2D pixel-styled survival game(with the Godot Game Engine), from the birds-eye view(not a side scroller like Terraria) - where the world would look like a map if zoomed out. So ...
Apex's user avatar
  • 11
0 votes
1 answer
196 views

simplest combat system i can do with code?

This is my actual set up, and for the moment I'm using this tutorial : https://www.youtube.com/watch?v=Mek4XtMhcMs&t=4s which is one of a kind, never found any other guide on how to make 3D melee ...
Cei's user avatar
  • 863
4 votes
2 answers
1k views

How does Godot 4 copy vectors?

I'm an old coder, but a newbie to Godot. I'm using version 4. I got some unexpected (to me) behavior when I tried this code: ...
Adam Smith's user avatar
0 votes
2 answers
605 views

How to break out of nested loops?

Is there a way in Godot's GDScript to quickly/easily break out of nested loops? For example: ...
BWPanda's user avatar
  • 101