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

I came across a problem, when creating my game on godot

I'm making a top down style game where the weapon revolves around the character. When I aim with my mouse to the right the sprite is normal... however, when aiming to the left I would need to use Flip V to invert my sprite and weapon to be normal.…
Caio Vitor
  • 21
  • 2
2
votes
2 answers

How to reference node in Godot

I'm using gdscipt and I'm trying to set up a state machine. I'm trying to access PlayerStateMachine/PlayerStateMachineManager.gd by using onready var statemachine = get_node("PlayerStateMachine/PlayerStateMachineManager.gd") but I keep getting the…
C Hale
  • 31
  • 1
  • 3
2
votes
2 answers

Connect python local server with godot

I'm trying to send data to a python server: import socket s = socket.socket(socket.AF_INET,socket.SOCK_STREAM) s.bind(('127.0.0.1',6000)) s.listen(5) while True: clientsocket,address = s.accept() print(f"Got connection from {address}…
cak3_lover
  • 1,440
  • 5
  • 26
2
votes
1 answer

Is there an event for when a raycast hits an object?

Is there an event for when a Raycast collides with an object? I've been looking all over the internet for it, but there's just no results. Please help!
neksodebe
  • 65
  • 8
2
votes
1 answer

enemy follow player my "player" when it enters the "enemy" detection zone the enemy continues forward (to the left)

what is happening is that my "enemy" is not following the "player", when my player enters the detection area the "enemy" continues straight ahead (to the left). thank you, if you understand something or need more information let me know detection…
2
votes
1 answer

Godot : how can i add a script to autoload only in script?

Im asking how i can add a script to autoload in godot with only lines of code in one file -> to run functions and get vars from this file to a 2. file.
Résu
  • 29
  • 2
2
votes
0 answers

Problem with transfering image data between apps

In Python, I have this: retL, imgL = wallie.vidStreamL.read() wallie.lastL = cv2.cvtColor(imgL, cv2.COLOR_BGR2RGB) bytes = bytearray(wallie.lastL.tobytes()) return bytes, len(bytes) So I take an BGR image (OpenCV default, right?), convert it and…
smsware
  • 429
  • 1
  • 13
  • 41
2
votes
4 answers

How do I create a timer in Godot?

How do I create a timer in Godot which destroys the script's object after a given amount of time? I am looking to remove bullets from a game after a while to reduce lag.
FluffyPancakes1
  • 56
  • 1
  • 1
  • 3
2
votes
1 answer

Kinematic Body 2D not moving

I'm trying to game a game using the Godot Engine but I'm stuck at the beginning! I can't make my KinematicBody2D move! This is my Player.GD script extends KinematicBody2D var velocity = Vector2.ZERO var move_speed = 480 var gravity = 1200 var…
xSh4doow
  • 21
  • 1
2
votes
1 answer

Export Struct-like objects for arrays

I have been bashing my head about this and can't seem to figure it out. In another engine, I could make a struct, then make an array of that struct that I could then edit in the inspector. There seems to be no way of doing this that I can find in…
2
votes
2 answers

godot how to know if a click is inside a sprite :

I have a p12 Sprite that have a KinematicBody2D and the KinematicBody2D have a Collision polygon2d. I'am trying to check if a mouse clik is inside p12 : var inside : bool = p12.get_node("KinematicBody2D").has_point(to_local(pos)) or var inside :…
Bussiere
  • 500
  • 13
  • 60
  • 119
2
votes
1 answer

How to draw a Shape2D in toolmode?

I'm adding a collision shape using Physics2DServer like this: Physics2DServer.body_add_shape(_body, _shape, Transform2D.IDENTITY, collision_disabled) based on this solution but I can't see what the shape visually is, so is there a way to draw (and…
cak3_lover
  • 1,440
  • 5
  • 26
2
votes
1 answer

Collision detection and overlapping detection in same node?

Is it possible to make a single node which collides like a RigidBody2D but at the same time when collision is disabled it works like an Area2D node and can detect overlapping? for example: I have an appendage and it behaves like an Area2D node, but…
cak3_lover
  • 1,440
  • 5
  • 26
2
votes
1 answer

AnimationPlayer seek() using threading

I have a script attached to an AnimationPlayer node and it does some long calculations, so in order to avoid the game engine from hanging while those calculations take place I created a separate thread for that function, but the seek() function…
cak3_lover
  • 1,440
  • 5
  • 26
2
votes
1 answer

How to get Euler angles from two transforms in Godot

I have a Transform that is rotated by an angle on an axis. Is it possible to get the Euler angles for the rotation using the Transform before rotation and the Transform after rotation? I tried using Transform.basis.get_euler(), to get the Euler…
Joe
  • 345
  • 1
  • 14