As infuriating, frustrating and up its own arse as #Python can be, I have to admit that list comprehensions go unreasonably hard. I wish more languages had this. I wish "We have Python at home" #GDScript had this.

I literally keep forgetting that this is a thing because I only use Python for Nikola and then I remember and it feels like cheating somehow.

Significant whitespace is still the Devil's palimpsest and I will die on this hill.

Playbook is coming along - mostly done.
Save seems to work.
But! load seems to work, but doesn't update UI properly. May need to rewrite quite a bit of how it works.
For individual changes, Signals bounce around a bit, updating the individual entry. But when all is loaded at once, I need to send everything, without over-writing values.

#godot #gamedev #gdscript #ttrpg #rpg #BladesInTheDark

tip of the day. Whenever I want to make a gif animation of my godot app or game I use this [1] function to create an image at certain points in the program. Like after sending a signal, redrawing a component or on a timer. I have it in a screenshot class that names them "yyyymmdd-idx.png".

Then I use imagemagick to convert [2] them into a gif.

[1] get_viewport().get_texture().get_image().save_png

[2] convert -delay 20 -loop 0 *.png anim.gif

#godot #gdscript #gif #tips

Frame guessing for sprite sheets without meta information is working!

And the debug visualization looks awesome! 😎

(When there are no json or txt files that provid meta information I try to guess it using the bitmap class through alpha mask and polygon extraction.)

#godot #gdscript #godottool #mipgam

If there are no meta information available I am going to guess the frames by extracting polygons.

Using these bitmap functions you can convert an image alpha to a bitmap alpha mask. The bitmap can create polygons based on the transparent boundaries.

Bitmap.create_from_image_alpha
Bitmap.opaque_to_polygons

#godot #gdscript #godottool #mipgam

Added a new Atlas Info inspector to the right panel. Showing the extracted meta information like columns, rows, layers and frames.

My custom tab container can now also be collapsed and expanded.

next: make a condensed tree view where I show single file folders one layer up to reduce the amount of clicking.

backlog: Then add a gallery to show animated sprites in a grid.

#godot #gdscript #godottool #mipgam

The tool can now parse different metadata sources to determine the frame-information for a given image file.

Currently implemented are #aseprite json, list as txt and cols & rows encoded in the filename. Adding more when I come across them in my #pixelart library.

The tool uses the extracted frames to animate the file when you select it in the explorer panel.

next: display the animations in a grid if the tool detects multiple layers and/or rows.

#godot #gdscript #godottool #mipgam

#Godot's `wrap()` function is useful for when you have a list of players (e.g. blue, green, red, etc.) and you want to change whose turn it is:

```
# Next player's turn.
current_player = wrap(current_player + 1, 0, PLAYERS.size())
```

https://docs.godotengine.org/en/stable/classes/[email protected]#class-globalscope-method-wrap

#Godot4 #GDScript #GameDev #Programming

@GlobalScope

Global scope constants and functions. Description: A list of global scope enumerated constants and built-in functions. This is all that resides in the globals, constants regarding error codes, keyc...

Godot Engine documentation

Anyone else annoyed by how many constants/variables they have to create just to avoid having magic numbers in their code...?

#GameDev #Porgramming #Godot #Godot4 #GDScript

Is there a better way to write the following?

```
var piece = get_piece_on_marker(marker)
if piece:
piece.move()
```

Something like:

```
if (piece = get_piece_on_marker(marker)):
piece.move()
```

i.e. It assigns the variable, and tests it, all on the same line. Is something like that possible in #Godot?

#GDScript #Godot4 #GameDev