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
3
votes
1 answer

What is slowing down RigidBody?

I have created a very simple scene with just a single RigidBody in it. My whole code is below: extends RigidBody func _ready(): self.apply_central_impulse(Vector3(1, 0, 0)) self.gravity_scale = 0 self.linear_damp = 0 self.friction =…
elmo
  • 1,189
  • 1
  • 10
  • 35
3
votes
1 answer

Is there a `HVBoxContainer` for Godot?

Think of an RPG game where you might need to present a list of buttons. A user might enter a room where they have to select from a series of options (buttons). Is there a type of container/panel that would show clickable buttons horizontally, but…
Jay
  • 19,649
  • 38
  • 121
  • 184
3
votes
1 answer

How to Merge Two Dictionaries or Arrays in GDScript (Godot Engine)?

Say I have two Dictionaries (or could be Arrays), each having sub-dictionaries (or sub-arrays): var dict_A = {'a': 1, 'sub_dict': {'hello': 'world', 'quick': 'fox'}} var dict_B = {'b': 2, 'sub_dict': {'hello': 'godot'}} Is there a builtin method…
Renato Byrro
  • 3,578
  • 19
  • 34
3
votes
3 answers

Godot - Input.is_action_just_pressed() runs twice

So I have my Q and E set to control a Camera that is fixed in 8 directions. The problem is when I call Input.is_action_just_pressed() it sets true two times, so it does its content twice. This is what it does with the counter: 0 0 0 0 1 1 2 2 2…
uberflut
  • 120
  • 1
  • 7
3
votes
2 answers

How to get a node in another scene godot?

I am making a game with multiple scenes and need to have varibles that are get_node(node from another scene) and I don't know how to get nodes from another scene.
T-Rex
  • 55
  • 1
  • 8
3
votes
1 answer

How to instance a scene and have it face only an x or z direction?

I'm trying to create a "Block" input that summons a wall at the position the camera is looking at and have it face the camera's direction. It seems to be using the global coordinates which doesn't make sense to me, because I use the same code to…
3
votes
1 answer

Godot: detect "mouse down" inside Area2D and "mouse up" OUTSIDE Area2D

I want to detect a mouse click (and hold) inside an Area2D, and then detect the mouse release both inside or outside the Area2D. Here's what I have so far: extends Area2D #PickArea func _input_event(viewport, event, shape_idx): if event is…
mandmeier
  • 355
  • 5
  • 16
3
votes
1 answer

How do I get a random variant of an enum in GDScript, Godot 3.3?

I have declared an enum like so in GDScript: enum State = { STANDING, WALKING, RUNNING } I want to get a random variant of this enum without mentioning all variants of it so that I can add more variants to the enum later without changing the code…
Newbyte
  • 2,421
  • 5
  • 22
  • 45
3
votes
1 answer

How do I add the sliding transitions in games such as Mega Man,The Legend of Zelda, and Metroid in my Godot game?

Sorry for the long question title. I'm pretty new here. So my question is just as it the title above. I've tried mostly everything and have searched everywhere on the internet. Some pseudo leads I've tried were .linear_interpolate("my screen width"…
3
votes
1 answer

Godot/Gdscript: Why is str2var not working on classes with _init method?

Let's define 2 classes A.gd class_name A var v = null func _init(v_): v = v_ B.gd class_name B var v = null Now, when I try to use str2var/var2str, this is what I get var a = A.new("aaa") var b = B.new() b.v = "bbb" printt("var2str(a):",…
Cyrille
  • 13,905
  • 2
  • 22
  • 41
3
votes
1 answer

How to get global world coordinates of bone in Godot GDscript

I'm writing a program in Godot with GDscript that aims to change the position of multiple bones in an armature. The bone gets translated by a value calculated by the point I want the bone to move to minus the current position of the bone.…
Joe
  • 345
  • 1
  • 14
3
votes
0 answers

How to subscribe to an adonisjs web socket channel in gdscript?

I'm trying to combine adonisjs(v4.1) websocket with gdscript. And that means that I need to connect to adonisjs from godot by gdscript code. Now the more clear question is "because adonisjs socket is running on a channel, how to subscribe to the…
Mahmood
  • 403
  • 2
  • 10
3
votes
1 answer

Simple mode 7 formula / example?

I recently found out about the pseudo-3d effect that utilized SNES mode 7, and want to try to replicate it in the Godot Engine. I tried looking around online, but everything was either explained in a way i couldn't understand, or in a programming…
3
votes
1 answer

(Godot Engine) Fill an 2D Polygon with Tilemap tiles

I have an issue in the Godot Engine that I can't figure it out: How could it be possible (in code) to fill an Polygon2D area with tiles? I have tried to get point positions. Iterate through line's vertex using 2D for loops, and I just can't wrap my…
KanaszM
  • 151
  • 9
3
votes
1 answer

Is there any way to pass a built-in variable by reference in GDScript?

I'm working on a developer console system for my game, and I'm currently working out how implementing variables will work. At first, I thought I'd just use variable pointers to change variables that belong to other objects, but it seems GDScript…
mdkael
  • 31
  • 4
1 2
3
55 56