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

_load_data: Condition !f is true. Returned: ERR_CANT_OPEN (Godot)

I started with Godot about 2 weeks ago, But have been getting _load_data: Condition !f is true. Returned: ERR_CANT_OPEN (Godot) on this code: extends Area2D var points = 0 var pointAdder = 1 var pointMultiplier = 1 # Called when the node enters the…
CATboardBETA
  • 418
  • 6
  • 29
3
votes
1 answer

How to change the saturation and overlay of a sprite in Godot

I have been planning to change my sprite to a bit darker color through changing saturation and hue values. But it seems very tricky to do so as the Godot modules only talk about changing the color of a sprite though the modulate option like this:…
Mana
  • 352
  • 5
  • 22
3
votes
2 answers

Godot 3.1 telling me that lock() and get_pixel() are nonexistent functions

I'm attempting to generate a height map from a noise texture. As far as I understand, in order to call get_pixel() on an image in this context, the image must first be locked. However, when I attempt to run the program, it exits with the error:…
Christopher Bennett
  • 803
  • 1
  • 8
  • 20
3
votes
2 answers

Stopping movement of sprite if it's at the same position as the mouse

I am trying to make a sprite stop moving when it's x and y are the same as the mouse's. For some reason, once the image is in the same position as the mouse the image starts going back and forth in the same axis really fast. I need to make it stop…
dianesis
  • 333
  • 4
  • 17
3
votes
1 answer

How to implement touch scroll in Godot

I'm making a user interface for mobile devices and I need a way to scroll through my items vertically, I managed to do it using a Scroll Container. But the problem is that it takes up space and it won't work using swipe gestures, so my plan is to…
009820
  • 37
  • 2
  • 9
3
votes
4 answers

Godot - Using 2D Sprite Animation

I am studing Godot Engine and I searched about sprite animations, and I couldn't do anything. Is there somthing like in Unity? And after I create the animations, how to change the animations state of a sprite?
Teodor Cristian
  • 349
  • 4
  • 16
3
votes
1 answer

Having multiple Nodes2D in a scene or having none - Godot

I am studying Godot engine and I was wondering why I can't have multiple nodes or element by themselves in the scene. Godot doesn't allow me that. Why?
Teodor Cristian
  • 349
  • 4
  • 16
3
votes
1 answer

Godot - set_fixed_process function

I am trying to understand Godot Game engine, I am following a tutorial, and I wrote a breakout game. Here is the padding code: extends KinematicBody2D func _ready(): set_fixed_process(true) func _fixed_process(delta): var y = get_pos().y …
user193464
  • 380
  • 1
  • 6
  • 25
2
votes
1 answer

Godot 4.1 appears to fire signals twice

I do state appears to, because I do believe I'm missing something obvious. But I've been chasing this problem for quite a while now and I've run out of ideas. I'm basically trying to solve the problem of transitioning between various scenes; and…
Mark Cassidy
  • 5,829
  • 1
  • 22
  • 33
2
votes
1 answer

Why are signals not working for me in Godot?

I'm trying to create a chess board with pieces. Obviously the pieces will need to move and that's where signals come in. I have a drag_piece script that looks like this. extends Area2D var selected = false func _ready(): …
maybe
  • 31
  • 1
2
votes
1 answer

coding conventions when creating a complex system, I have created a modular weapon system in godot

I have created a modular weapon system in godot 4 but I am sure I have not made this system correctly, so I was looking for feedback on how to do it the correct way or Improve it, I know this question might seem broad to answer but simply put I…
Dragon20C
  • 307
  • 2
  • 11
2
votes
1 answer

Check if an object is of a class given the class name in string?

Let's say I have an object and I'm given a class name in string How do I check if the object is of that class? extends Node2D func _ready(): var given_class_name="KinematicBody2D" if($Obj is given_class_name): ...
cak3_lover
  • 1,440
  • 5
  • 26
2
votes
2 answers

Creating animations through a GDScript

I need to create an animation from an array, but it just isn't created in Godot, I don't see it in remote explorer. This list is reduced by 10 times from the original, this is just an example. I had to convert the animation from another program to…
display
  • 35
  • 3
2
votes
2 answers

How do I create a base "class" in Godot?

Godot 4.0 I am creating a 2D game that includes different light sources: candle, candelabra, lantern, torch, etc. Each light source is a StaticBody2D with a CollisionShape2D, a Sprite2D and a PointLight2D. They differ in their sprite texturess and…
2
votes
1 answer

Why isn't this dash omnidirectional?

I was trying to add a omnidirectional dash to my game with this code if Input.is_action_pressed("ui_accept"): velocity = Vector2.ZERO velocity = position.direction_to(get_global_mouse_position()) * 200 And it is only moving the player…