Skip to content

mogba/godot-hello-world

Repository files navigation

godot-hello-world

Notes

Window

For 2D sprite-based games, it is necessary to adjust the viewport size so the sprites on screen don't stay to big. Besides that, the viewport size must also be streched to keep the coherent to the window size.


Nodes

Nodes are the main entities/game objects of Godot.

Nodes can be structured as node trees, in which children nodes will be linked to the behavior of the parent node.


Scenes

Nodes of different types can be grouped as scenes and be used or instantiated inside other scenes. This is like a class in object-oriented programming, in which the class instance will have all of its properties and behave in a specific way. Things like the player nodes can be grouped as a scene and be instantiated in different levels, NPCs, objects in scenarios, etc.


YSort

Setting the scene or the wrapper node where the entities like the player or NPCs are at as a YSort node will sort the nodes visibility by the Y position. So if the player node's Y position is bigger than a bush's, for example, the bush will be displayed behind the player.


Movement

There are multiple ways of doing it, but something that one must have in mind is that the movement can be affected by eventual lags or stutters while the game is running. If the intention is to compensate the lags, then movement variables have to be calculated considering the delta time, which is the time that has passed in the real world since the last frame ran. Contrary to that, considering the delta time on the calculations might lead players to have less time to react to certain events in the game.


AnimationPlayer and AnimationTree

AnimationPlayer will handle the animations like a set of sprites of a spritesheet to animate a character or a moving object.

AnimationTree will handle the behavior of the animations, when they will be started and transition to other animations.

On the AnimationTree, it is necessary to set up the root with the different animations for, say, a character. Each box in the AnimationTree's root will handle an animation, and multiple animations can be set to transition to each other by linking the arrows.

These propertis/nodes can than be referenced in the code. For example, an animation state can be triggered by the player's input.

AnimationPlayer Tracks

The AnimationPlayer node supports multiple kinds of tracks, which can be used, for example, to add animation sprites of a spritesheet or to add Call Method Tracks, which are used to call methods from a script and update or alternate a state or execute some other action when an animation finishes executing or reaches a specific point.


Tile sets

Tile sets can be defined with TileMap nodes. The tile set texture must be defined and also how it will behave when placed in the game's world. This behavior definition is made with the bitmask functionality.


_Process and _PhysicsProcess


AnimatedSprite


Signals


Manipulation of node instances in the code


Parent and child nodes interaction

"Calling down and signaling up"

This means that a parent node should interact with its chidlren by calling a method of the child and a child should interact with its parent or respond to the parent's interact by emitting a signal.


AutoLoad (singletons)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages