Slight problem with animation object orientation.


So I’m trying to add an animation when the tank fires, now, I understand I have to make the animations on all orientations ( or directions), but I can’t figure out how to tell Gdevelop WHERE the turret is being pointed at, so it chooses the right animation. I’m sure resolving this is stupid easy but I’m not figuring it out.

I’m not sure what are you trying to do, what kind of animation you wan to play and when.
If you want to put something on the tip of the turret, you can use a custom point similar to when creating the bullets. From turret.PointX(Canon), Canon is the name of the point which is stay in the same relative position to the tip of turret at all times. So this is one way to go.

If you want know the direction of the turret and you want to do something based on that value, there is a condition to compare the current direction of the object to a value and in case you want to use the value, there is also the expression turret.Direction() which is return the direction in degrees.
There is also conditions to compare if something is rotated toward an other object or specific position and action to rotate object toward specific point or object or value.

In case it doesn’t answer you question, could you share more detail what are you trying to do exactly?

I think your answer explains what I need,

look at the pictures, on the first one, there’s some smoke coming out of the turret, on the seccond one, the same exact smoke in the same direction, which is wrong, now, I can modify the smoke in order to point, in this case, north, but I had no idea how to tell gdevelop on which direction is the turret pointed at so it chooses the right animation, the one with the smoke going north, instead of east.


Make the smoke animation angle the same as the turret (but be sure the “base direction” is the same as the turret; I mean, the turret and the smoke must be facing towards the same direction when they’re at 0 degrees without changes, that way you can be sure they’re rotating coherently). I recommend to set the origin point of the smoke animation at the place when it’s supossed to being fired from the turret.

[size=85]The red point is the spot where the “fire point” must be placed in the turret sprite, and also the spot where the origin point must be configured for the smoke sprite[/size]

Here’s an example on how to do it using the particle-emitter: fx_positioning