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

GDScript is a high-level, progressively typed programming language. It uses a syntax similar to (blocks are indent-based and many keywords are similar). Its goal is to be optimized for and tightly integrated with Godot Engine, allowing great flexibility for content creation and integration.

839 questions
2
votes
2 answers

(Godot Engine) How to calculate the ISO week number of a specific date?

Using Godot 3.6 on Windows: How to calculate the ISO week number of a date given the following parameters: day, month, year? I could not find a way to calculate the week number from the built-in class Time I've also looked into the Calendar Button…
KanaszM
  • 151
  • 9
2
votes
1 answer

Animation player Tree how to use for gdscript (Godot 4.0)

Having issues implementing animation to my script extends CharacterBody2D const SPEED = 300.0 const JUMP_VELOCITY = -400.0 var gravity = ProjectSettings.get_setting("physics/2d/default_gravity") func _physics_process(delta): # Add the…
Kaymush
  • 21
  • 2
2
votes
1 answer

I am getting an error "Invalid call. Nonexistent function 'set' in base 'Nil'."

I am new to Godot. Trying to make a counter for some values of reactor core. Here is my code: extends MarginContainer export var obj="" export var expr_list={"sig":""} export(int) var value_from_model setget set_val onready var…
Nika
  • 19
  • 5
2
votes
1 answer

I tried to shoot an object towards cursor position, but it has a problem

I'm a beginner in Godot I want to shoot an object that is already in the game towards where the cursor's position is, and the method I created for it works fine but depending on the distance between the object and the cursor the speed changes. can…
ÇRØÇÔ
  • 23
  • 3
2
votes
0 answers

Godot - Staticbody3d collision normal issue

I am having problem figure out how the normal work. I am using godot4 RC1. I created a staticbody3D and want to place a 3dobject standing upright like how we stand on earth. this is my code for the staticbody3d: func _on_input_event(camera, event,…
sooon
  • 4,718
  • 8
  • 63
  • 116
2
votes
1 answer

How can I get the current time in Godot?

I'm trying to make a digital clock in my game and need the current time (hours and minutes), formatted as so: HH:MM:SS How can I get the time necessary for this?
LeoDog896
  • 3,472
  • 1
  • 15
  • 40
2
votes
1 answer

Overriding KinematicBody2D movement within Area2D?

I'm trying to create a windy area within which the player would be pushed continuously to the left <- So far this is what I've come up with for the WindyArea: extends Area2D var bodies_within=[] # saves bodies within the area which have…
cak3_lover
  • 1,440
  • 5
  • 26
2
votes
3 answers

I am missing a lifecycle initialization method after _ready()

Disclaimer: new in Godot here. Some experience with Unity I am doing the initialization of my scripts into the _ready() method. But I am missing a method that is automatically called on each script after all the _ready() methods have finished for…
fguillen
  • 36,125
  • 23
  • 149
  • 210
2
votes
1 answer

Shader without loosing self background color?

Is it possible to apply a shader while preserving the self color? so far this is what I've come up with shader_type canvas_item; void fragment(){ vec4 self_color = texture(TEXTURE, UV); vec4 back_color = texture(SCREEN_TEXTURE, SCREEN_UV); …
cak3_lover
  • 1,440
  • 5
  • 26
2
votes
1 answer

How to get which node invoked getter function?

Is it possible to get which node/object has invoked the setter function? why am I asking this? atm I have custom animation player: tool extends Animation func track_insert_key(track_idx : int, time : float, key, transition : float = 1) -> void: …
cak3_lover
  • 1,440
  • 5
  • 26
2
votes
1 answer

wait for the player to reach a position in godot

So I'm working on this project to develop a 2d game. In this game, each new level represents a city with 3 places to explore. The player will start in the center of the paths and can choose to enter each place by clicking on it. Since the path to…
2
votes
1 answer

blurred images using load()

I'm loading my images using load() like this: get_node("%CustomSprite").texture=load(img_path) but they're being loaded in blurry, I saw this video to fix it, so is there any way to reimport images via gdscript? or any work around to make the image…
cak3_lover
  • 1,440
  • 5
  • 26
2
votes
1 answer

Godot: Display EditorInspector on another panel with plugins?

I'm attempting to make a plugin to make loading a dictionary or resources easier. There are many aspects I'm not even sure will work, and I can't seem to find an answer to elsewhere, so I'll ask here. Is it possible to, when clicking on a custom…
2
votes
0 answers

Godot: Rendering Terrain In Separate Thread Slower Than Main Thread?

I'll admit, I'm new to multithreading and I was hoping to dabble in it with my C++ project first but I've hit a snag in my Godot game project where rendering the terrain gave me a small lag spike every time new terrain was generated so I wanted to…
2
votes
1 answer

How do I programmatically load animations in Godot, separating animation from armature/skeleton?

I'm trying to load 3D animations separately from the 3D armature that will be using the animation. I can import animations from 3d formats (.gltf, .escn) and generate Godot animation files by setting the Animation->Storage option to either ".anim"…
Joe Cafe
  • 23
  • 3