[Solved] What is the function Direction()?

In the laser zombie example, there is an angle that is obtained via the function Direction(). However, I cannot find any documentation on this function, and when I start typing it in the list of matching words in the autocomplete does not bring it up:

image


Yet it is an accepted function when fully typed in:

image


So, what is it and how does it work? How does it differ to Angle()? Is it an obsolete command?


And a BTW, the online zombie laser example is broken. The player sprite doesn’t show, and there are missing objects - those denoted in red and a squiggly line:

image

That example must have been made for GDevelop 4 or lower. The missing objects seems to be particle objects, I guess something went wrong when converting the particles from an old format to a new one.

The Direction() expression allows to get a direaction in which a sprite is going, and is a feature of “8-directions sprites”, a feature from GDevelop 4. The runtime code has not actually changed between GDevelop 4 and 5 so it still functions, but the editor code has been rewritten from scratch, and editor support for this feature was forgotten and never added back. As it is in a semi unsupported state, it is hidden away but still technically works.

2 Likes