GDScript Questions

2

GD.Print(nameLabel.GetRect().Size); nameLabel.Text = name; GD.Print(nameLabel.GetRect().Size); After setting the text, the length will become longer. I want to get the size after the change, but it s...
Mills asked 5/3 at 2:3

10

Hello, I am completely new to godot, and I need help with some code for changing scenes. I have an area 2d with a collisionpolygon for the shape, and I would like to know how to make it so when a char...
Aeromedical asked 21/2 at 18:40

5

When i am writing something (poorly thought out) like : class_name DataSet extends Resource @export var resource_type: String = "Resource" @export var resource_set: Array[resource_type] The engine ...
Ezara asked 3/3 at 21:16

6

Hello, I have a function in my code to apply damage to the health of a creature. However, the changes to the current_creature_health variable do not persist outside of the function, when it is called...
Exhalant asked 29/2 at 19:55

2

Hello! I'm currently encountering an issue with a game project I'm making. When I start a new game and pause the game, the game seems to unpause and start running after a few seconds. I've posted a vi...
Astute asked 2/3 at 1:41

6

So, the movement code in my game broke. It's only the player's movement that has broke and all other things like enemies have normal movement extends CharacterBody2D @onready var _animated_sprite = $...
Euglena asked 1/3 at 21:0

2

Simple routine using a key to toggle move an icon between an inventory rack and an (unseen) reserve. I can move an item from the reserve to the rack, or vice-versa, but only once! After that, find_nod...
Sabayon asked 1/3 at 4:16

11

I have a simple exercise where I have a row of buttons and when I click on one it copies the texture to a simple TextureRect that follows the mouse. I want to click to place the texture but the event ...
Aileenailene asked 27/2 at 3:53

5

Hi! I can't find a way to manage some of my resources without having to hardcode string paths somewhere. And I would prefer to avoid that at all costs because I am still making frequent changes to t...
Prine asked 28/2 at 19:16

4

I have a script that is autoloaded called "state". The script extends a Node. It just has some basic funcs, nothing relevant. The bug I am reporting is, I never wrote "class_name State" on this script...
Tunicle asked 12/4, 2023 at 3:20

2

I am trying to save an Array[Switch] to a file using store_var() and FileAccess. However, when loading it back it comes back as an untyped Array. ## Saves switches to the file specified in SAVE_PATH ...
Drakensberg asked 28/2 at 14:33

5

Edit: Resolved ! See my last comment I want to change the font color of a button when I press on hit. So I call add_theme_color_override("font_color", Color.RED) in the function called when I press a...
Spiffy asked 23/2 at 20:45

2

wizwon Hard to debug from screenshots. Post a MRP.
Matchbook asked 27/2 at 16:29

2

Solved

I am new to coding and I cant figure out this problem for the life of me. Is there anyone out there willing to give some input?
Emmen asked 27/2 at 3:16

4

Hi all! I made my world a specific way that worked well, but now I need to change up the system to allow it to be bigger and more dynamic. In my old system, to get references to nodes like minable roc...
Mithgarthr asked 26/2 at 17:37

4

Solved

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 opponen...
Importunate asked 26/2 at 13:32

2

Hey, I've been trying to get this piece of code to work. I am trying to make a game where you can kill an enemy with your mouse click. I have tried it by using signals but i am not sure i am doing it ...
Santana asked 21/2 at 12:0

1

Hi everyone. I wasn't quite sure how to title this, but it's something I've been tinkering with for awhile and just can't quite get it to work right. The little mspaint diagram might help explain what...
Barramunda asked 26/2 at 2:36

3

If anyone has any insight on this, it would be greatly appreciated! I've been experimenting in 3d with godot 4.2 lately, trying to implement various pieces of first person shooter interaction functio...
Leguminous asked 19/2 at 20:7

4

Hi, I would like to understand how I can build a battle system based on a pure script without invoking any nodes to visualize anything? I have a system built that uses nodes and attached scripts to ...
Duncan asked 23/2 at 17:36

7

Hey y'all, I wanted to experiment with the new barycentric coordinate function coming in 4.2, but I seem to be getting some odd results with meshes imported from Blender. In a new project I'm using th...
Clientage asked 6/10, 2023 at 5:11

3

This is more of a math question. I want to understand how percentage calculation works, for something like crit chance, hit chance or item drops. Is this code here roughly correct? Any feedback on ho...
Caught asked 23/2 at 19:51

1

`extends TileMap @export var gridSizeX : int @export var gridSizeY : int var dic = {} var coords : Vector2 var is_Empty : bool var NwborderX : int = 4 var NwborderY : int = 24 func _ready(): #P...
Gonick asked 22/2 at 3:53

1

Hi, I think what i want to do is quite easy, but i'm still stuck... I want (with gdscript) to load a mesh in my scene (actually an obj, but i Can change this to gltf if it's help) and add per vertex ...
Barricade asked 11/2 at 13:52

8

so i felt like i had gained a decent grasp on core coding concepts (variables, if statements, loops) and i familiarized myself with Godot and so i wanted to start making small games to learn more by a...
Bentley asked 21/2 at 10:4

© 2022 - 2024 — McMap. All rights reserved.