Skip to content

u/Paxtian

In this archive from Sep 2023 to Nov 2026

15
posts
288
comments
12
media
1.8k
score
3 saved before deletion

Top posts

Top comments

Limited exports, and there are editor shortcuts for GDScript that you can't use in C#.

The limited exports are due to be fixed with the next release of .net I believe, so that'll be taken care of very soon. I don't think there's a way to incorporate the editor/ inspector shortcuts into another IDE without some interface between the two, but I'm not sure. I wouldn't expect that feature. Mostly I'm thinking of the ability to drag a node from the inspector into the script editor, and the node path is replaced with its relative name.

83 points

Read up on Object Oriented Programming as a design paradigm. Basically the script attached to, say, your player should only be responsible for the player. So your player script shouldn't be doing things like killing enemies, switching levels, quitting the game, etc.

That said, the reason this is "correct" is because it helps avoid bugs. If you're working solo, you know where you've put everything (although if your project is large you may forget).

But let's say you're working on a large game with a large team. The person handling the player might say, "If the user hits "Escape," that means they want to quit the game, so I'll just code in the player script "If escape is pressed, quit the game."

But the team responsible for say game systems or inventory management might say, "If the player hits 'CTRL+Q,' that's what quits the game. If the player hits Escape, that brings up the inventory screen. So we'll code that as part of inventory management." Now there's crazy behavior when the player and inventory manager are merged together. Who should take priority?

OOP says, single responsibility principle. The player script controls the player, NOT whether the game is quit. Inventory management is done by the inventory manager, not game quitting.

Another example. Say you're making an FPS with limited ammo guns. The player shoots. Who controls the UI to show how many bullets remain? Player script? UI? Something else? Because if that gets screwed up, you might double or triple count how many bullets to remove from the overall count.

Good practice is to have some single source of truth that tracks the ammo count. The player script asks that "Hey how many bullets do I have?" If it's more than 0, allow the player to shoot. In Godot, this would send a signal saying "For whoever cares, the player just shot a bullet." The single source of truth would listen for that signal and update accordingly. The UI would also listen for that signal and say, oh, the player just shot, let's ask the single source of truth how many bullets are left and update the display accordingly.

This gets really complex quickly, but if you follow it it'll help avoid bugs and weird behaviors that you didn't intend.

32 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.