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

Godot area2D bullet, speed isn't the same depending on the direction

I am making a top-down 2D game in Godot 3.1. In where the player shoots a bullet where it's looking at. I am using Godot 3.1 and Gdscript. I have a bullet scene with the following nodes Area2D > Sprite > CollisionShape2D > Timer With…
Tomas Daniel
  • 1
  • 1
  • 3
0
votes
1 answer

How can i get the rest of a division in Godot 3.1?

I want to get the rest of a big number if I divide it by 100, and I can't find anything. Can you help me?
Gergő Szabó
  • 57
  • 1
  • 6
0
votes
1 answer

Need help understanding code example from Godot Docs

I am trying to learn collisions in Godot 3D, but I am having some difficulty understanding this code example from the Godot Docs here: Godot Docs - Advanced Vectors How can I understand this code? Specifically, in the section that reads if (min_A >…
0
votes
0 answers

How to initialize a node from the other scene in the instanced scene?

So, I have an instanced scene with kinematicBody2D Soldier. I previously wrote a script where it was getting the position of an "enemy" sprite and "drawing" a circle around it. If soldier enters this area, he rotates to the sprite and starts…
The Developer
  • 319
  • 2
  • 4
  • 15
0
votes
0 answers

I added sound to my game, but since the the sound doesn't go through it shuts down my game is there something wrong with my indentation?

I added sound to my game, but after I played my game for a few clicks it would close and say (Attempt to call function'play' in base 'null instance' on a null instance) and I went to stack exchange and they said there was something wrong with my…
0
votes
0 answers

Change control property with signal emit inside class in Godot

I have Option Button that contains several items. Changing the current item is connected to a function that performs logic. When I do it by mouse it works as expected. But when I try do it in code (for example, in _ready() functions, then the signal…
Shatur95
  • 93
  • 1
  • 9
0
votes
1 answer

Manually rotate 3D-object's local UP-axis toward World's UP-axis?

My object can have any(unknown) rotation in the world. I need to interpolate this object's local UP-axis, towards the World's UP-axis, without touching the object's other local rotations (imagine a buoy righting itself after a wave-hit). But, I only…
Ole Sauffaus
  • 534
  • 3
  • 13
0
votes
1 answer

3D submarine propelled by 'thrusters' without physics ... Local oriented thrust to global movement?

Imagine a cube with 4 thrusters on each face, like a small space-capsule. These collectively generate thrust in 12 directions (Forward, Backward, Left, Right, Up, Down, +Yaw, -Yaw, +Pitch, -Pitch, +Roll, -Roll) Thrust for each direction is…
Ole Sauffaus
  • 534
  • 3
  • 13
0
votes
1 answer

How can I access the mesh data of a MeshInstance?

I'm trying, without success, to access the data of a mesh from a MeshInstance node. I've imported a 3d object, opened it as "New Inherited", turned it as "Unique" and saved it as foo.mesh. Then, on a new scene, I did create a MeshInstance and loaded…
Victoralm
  • 203
  • 3
  • 12
0
votes
0 answers

Rotate mesh about another element?

I want to have the camera move with a mesh. Foward/backward motion was easy: if (Input.is_key_pressed(KEY_W)): self.translation.z -= movement_speed; # relies on camera script to move camera if (Input.is_key_pressed(KEY_S)): …
user8866053
0
votes
1 answer

Godot Problematic CustomStyle, how can fix this?

Godot version: 3.1 STABLE OS/device including version: WINDOWS/OS I’m making a movable window in my game, and I’ve used the popup() function. The fact is that I want to style it like a terminal, so I have made a custom style (StyleBoxFlat). The…
LukeCage
  • 1
  • 3
0
votes
4 answers

Flip horizontally and vertically single frames of an animated sprite

I have 4 (0-3 animation frames) different images of a coin animation with differet states of it spinning. I would like to make it look like its spinning by adding another 2 frames (4-5) to make it look like it spins. In current situation it looks…
Eternal
  • 303
  • 1
  • 2
  • 16
0
votes
1 answer

my questions is about code in GDscript (language programing in godot engine)

sprite (attack) is not working in case : if Input.is_action_just_pressed("ui_attack"): $Sprite.play("attack") but in case: if Input.is_action_pressed("ui_attack"): $Sprite.play("attack") it's working !!!! what is the solution code pleas?!!…
Godev
  • 1
0
votes
1 answer

How to discourage direction changes with AStar

Can I make the builtin AStar choose the shortest path with the least direction changes? I currently build my graph like so: extends GridMap var _astar = AStar.new() func _ready(): var id = 0 for c in get_used_cells(): var weight =…
rcorre
  • 6,477
  • 3
  • 28
  • 33
0
votes
1 answer

Enemies stop moving when on screen, but will function off screen

In godot 3.0, I have a platformer set up. I realized there was an issue with lag, so I designed it so pieces are destroyed after they get off screen to the left. For the most part, enemies will function. Except the last one, who will fire…