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

How can I animate a 3D actor at current location, and have it not snap to origin? GODOT

How can I animate a 3D actor at current location, and have it not snap to origin? Hey, was wondering what a decent solution for fixing an animation issue where when I define a anim within an 3D kinematic body node (my player) and want to play a…
Xavier R
  • 1
  • 1
0
votes
3 answers

Getting the name of the variable as a string in GD Script

I have been looking for a solution everywhere on the internet but nowhere I can see a single script which lets me read the name of a variable as a string in Godot 3.1 What I want to do: Save path names as variables. Compare the name of the path…
Mana
  • 352
  • 5
  • 22
0
votes
1 answer

Enums and static typing

I have declared an enum in some gdscript code. Then, I want to declare some variables to be of that type of enum. Is this possible. I know GDScript allows to declare a static type of a var. MEvery language I have used allows you to treat an enum as…
Scorb
  • 1,654
  • 13
  • 70
  • 144
0
votes
1 answer

Godot 3.1 variable not declared in scope error

EDIT: This is GDScript, not sure if that is obvious or not. I’m a hobbyist learning GDScript for Godot 3.1. I am just trying something out, and I cannot understand why my code throws this error: ubMyAge is not declared in this scope. It occurs in…
0
votes
1 answer

Nonexistent function get_viewport in base Nil

I am running a script: func _ready(): screensize.get_viewport().get_rect().size set_process(true) spawn_fruit(5) I am getting an error: Nonexistent function get_viewport in base Nil I've seen this error on other peoples scripts for…
0
votes
1 answer

Timer.start() not being called as expected

I am new to godot, and programming. I'm having trouble implementing a Timer node. I am writing a simple script to implement a zelda-like camera system. The camera system works as intended, however I would like to freeze the character (and eventually…
CAGoss
  • 1
  • 1
0
votes
1 answer

Do instanced objects Area 2D's not detect the mouse

I am trying to get a dynamically instanced kinematicBody2D with an area 2D attached to handle mouse entered/exit inputs. I have created my area 2D with correct collision body, and have tested a similar collision body for detecting some area 2d's and…
notme21
  • 47
  • 9
0
votes
1 answer

I am having issues with the move_and_slide and move_and_colide functions in GODOT

I trying to create a basic evolution simulator, and to do that I require my randomly created creatures to move towards the nearest food. I am confident in the code that gets the direction for the creatures, as I have tested it by modifying the…
notme21
  • 47
  • 9
0
votes
0 answers

Why does this variable keep changing to false in gdscript?

I'm trying to make this script make the ground still. When the player jumps it is supposed to make the ground and start moving and not stop. But, it is only moving when the player jumps. My Code: extends Area2D #Script-Purpose: move and delete…
0
votes
1 answer

best way to get a node's position in godot 3d

I am very new to godot and in a 3d scene what is the best way to get a node's coordinates. I have looked into it a bit and simply writing "translation" gets me a Vector3 with the positon of that node. I do not understand this and it seems strange.…
Partin22
  • 13
  • 3
  • 5
0
votes
1 answer

Converting Vector in x/y form to magnitude/angle in Godot

For a game that I am getting started making I have had to learn vector math to calculate forces. To convert a vector from x and y to magnitude and angle I have read that I for the angle have to use the function tan^-1(y/x). Is this correct and if so…
Partin22
  • 13
  • 3
  • 5
0
votes
2 answers

Godot, GDScript - Play Animation on Right Click

Any insight onto why this code doesn't work? When I right click, the game crashes and gives the error: "Invalid call. Nonexistent function 'play' in base 'Array'". func _ready(): anim_Play =…
DALEmuh
  • 51
  • 1
  • 5
0
votes
1 answer

How to have a sprite go in a direction depending on the mouse position?

I am looking for a sprite (a bullet to be more specific), to come out of another sprite (the end of the gun) by clicking the left mouse button, and then have the bullet go in the direction of where the mouse was, and then not change position after…
AndrewG
  • 1
  • 2
0
votes
1 answer

Formula for calculating the power and in which direction of an object when multiple forces act on it

I am working on a small game and i have run into one fundamental problem, when multiple forces act on an object what is the best formula to use in order to calculate the resulting direction and power? I know that this can be calculated by drawing…
Partin22
  • 13
  • 3
  • 5
0
votes
1 answer

How to fix 'invalid set index position on base kinematic body' error in Godot?

In Godot i'm trying to get a kinematic body to teleport to the position of the mouse and i get this error: Invalid set index 'position' (on base: 'KinematicBody') with value of type 'Vector3'.I don't want to use move and slide as I want the item to…
GRPAT
  • 39
  • 2
  • 5