Skip to content

u/Valivator

In this archive from Jun 2022 to Oct 2026

2
posts
29
comments
0
media
117
score

Top posts

Top comments

  1. delta is the time between the current frame and the last frame, so in _physics_process it will be 1/60 of a second, unless you change the physics tick rate. In _process it will be framerate-dependent.

  2. Therefore, to get faster as you go, you should use:

velocity.y += GRAVITY*delta

This will constantly increase the velocity.y value, leading to the effect you want.

14 points

This is an interesting question! If the node you want is a child (or descendant) of the current node then you should save that node as a variable at the top of your script. If the node subsequently gets renamed or moved in the hierarchy then you have a single place to fix it.

It's true that this will not throw an error when you rename/move it, but at least it is easier to fix :/

If the node you want is not a descendant then the "canonical godot" way to access it is....to not. The idea behind godot is that scenes should work all on their own, without needing sibling/cousin/parent/other relations, other than their own descendants. I would look at these two other patterns and see if they fit for your project, I will use the example of a door that should open when a boss dies.

Mediated by a common ancestor. This is the "godot-ish" way of doing it. With this pattern, instead of the door directly getting the boss enemy node and connecting its "open" function to the boss's "on death" signal, their common ancestor the level scene handles that for them. This nicely keeps the door logic separate from the boss logic, so if later you want a door that opens when the player pulls a lever you don't need new logic in the door scene, you can just reuse it and connect it in the level script.

Signal bus. This is a popular one in the godot community because it reduces boilerplate code. The signal bus is an autoload that will emit signals for you, and anybody can subscribe to them. And, importantly, anybody can access it because it is an autoload. So the door node will hook its "open" function to a "boss died" signal from the signal bus, and the boss node will tell the signal bus to emit a "boss died" event when it dies. Now it is easy for other things to also happen when the boss dies: the treasure chest can open, fx can play, the music can change; all just by hooking up to the "boss died" event from the signal bus.

Disclaimer: i am not a professional and i am more or less parroting docs/tutorials

9 points

Subreddits

Keyboard shortcuts

Move and act

jork
Next / previous post or comment
Enteroro
Open the post
f
Open the media viewer
s
Save
h
Hide (the toast has Undo)
Tab
Right after an action: the toast's Undo
x
Collapse the comment
v
Next layout: cards, compact, grid

Go to

/
Search
gthenh
Home
gthena
All
gthens
Subreddits
gthenl
Library
?
This list
Esc
Close a menu or this list

In the viewer

←or→
Previous / next file
↑or↓
Previous / next post
korj
Previous / next post
Space
Play / pause
m
Mute
z
Zoom
s
Save
o
Open the post (on its own page: back to it)
Esc
Close

Keys do nothing while you type in a box.